简体   繁体   中英

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

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!

replace matrix with vector and you have the answers

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM