各种boost ublas稀疏向量之间有什么区别?
在 boost::numeric::ublas
中,有 三种稀疏向量类型。
我可以看到,mapped_vector 本质上是一个从索引到值的 stl::map
,它将所有未找到的值视为 0(或任何常见值) 。
但文档中关于压缩向量和坐标向量的信息很少(哈哈)。
有人能澄清一下吗?我试图弄清楚将项目添加到各种向量的算法复杂性,以及两个此类向量之间的点积的算法复杂性。
一个非常有用的答案表明,compressed_vector 与 compressed_matrix 非常相似。但似乎,例如,压缩行存储仅用于存储矩阵——不仅仅是向量。
我看到 unbounded_array 是存储类型,但我也不太确定其规范是什么。如果我创建一个大小为 200,000,000 的压缩向量,但只有 5 个非零位置,这是否比创建一个大小为 10 和 5 个非零位置的压缩向量效率更低?
非常感谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用向量替换矩阵,你就得到了答案
http://www.guwi17.de/ublas/matrix_sparse_usage .html
replace matrix with vector and you have the answers
http://www.guwi17.de/ublas/matrix_sparse_usage.html