What are the differences between the various boost ublas sparse vectors?

3.5k Views Asked by At

In boost::numeric::ublas, there are three sparse vector types.

I can see that the mapped_vector is essentially an stl::map from index to value, which considers all not-found values to be 0 (or whatever is the common value).

But the documentation is sparse (ha ha) on information about compressed_vector and coordinate_vector.

Is anyone able to clarify? I'm trying to figure out the algorithmic complexity of adding items to the various vectors, and also of dot products between two such vectors.

A very helpful answer offered that compressed_vector is very similar to compressed_matrix. But it seems that, for example, compressed row storage is only for storing matrices -- not just vectors.

I see that unbounded_array is the storage type, but I'm not quite sure what the specification is for that, either. If I create a compressed_vector with size 200,000,000, but with only 5 non-zero locations, is this less efficient in any way than creating a compressed_vector with size 10 and 5 non-zero locations?

Many thanks!

1

There are 1 best solutions below

3
On BEST ANSWER

replace matrix with vector and you have the answers

http://www.guwi17.de/ublas/matrix_sparse_usage.html