Is there a Boost (or other common lib) type for matrices with string keys?

Posted by mohawkjohn on Stack Overflow See other posts from Stack Overflow or by mohawkjohn
Published on 2010-05-21T21:58:10Z Indexed on 2010/05/21 22:00 UTC
Read the original article Hit count: 331

Filed under:
|
|
|

I have a dense matrix where the indices correspond to genes. While gene identifiers are often integers, they are not contiguous integers. They could be strings instead, too.

I suppose I could use a boost sparse matrix of some sort with integer keys, and it wouldn't matter if they're contiguous. Or would this still occupy a great deal of space, particularly if some genes have identifiers that are nine digits?

Further, I am concerned that sparse storage is not appropriate, since this is an all-by-all matrix (there will be a distance in each and every cell, provided the gene exists).

I'm unlikely to need to perform any matrix operations (e.g., matrix multiplication). I will need to pull vectors out of the matrix (slices).

It seems like the best type of matrix would be keyed by a Boost unordered_map (a hash map), or perhaps even simply an STL map.

Am I looking at this the wrong way? Do I really need to roll my own? I thought I saw such a class somewhere before.

Thanks!

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost