c++ 中矢量数组的最佳库
我必须对 1,2,3...9 维向量的数组进行计算,并且这些向量的数量变化很大(比如从 100 到数百万)。当然,如果数据容器可以轻松分解以实现并行算法,那就太好了。
我遇到了 blitz++(对我来说几乎不可能编译),但是还有其他快速的库可以操作矢量数据数组吗? boost::fusion 值得一看吗?此外,vtk的vtkDoubleArray看起来不错,但vtk是仅用于可视化的lib。我必须承认拥有元组数组是一个诱人的想法,但我没有看到任何关于 boost::fusion 和/或 vtkDoubleArray 的基准。正如它们不是为了速度而构建的一样。有什么想法吗?
最好的问候,
强大的多多
I have to do calculation on array of 1,2,3...9 dimensional vectors, and the number of those vectors varies significantly (say from 100 to up to couple of millions). Of course, it would be great if the data container can be easily decomposed to enable parallel algorithms.
I came across blitz++(almost impossible to compile for me), but are there any other fast libs that manipulate array of vector data? Is boost::fusion worth a look? Furthermore, vtk's vtkDoubleArray seems nice, but vtk is lib used only for visualization. I must admit that having array of tuples is a tempting idea, but I didn't see any benchmarks regarding boost::fusion and/or vtkDoubleArray. Just as they are not built for speed in mind. Any thoughts?
best regards,
mightydodol
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Eigen,支持某些编译器上向量的自动向量化(GCC 4、VC++ 2008) 。
Eigen, supports auto-vectorisation of vector on certains compilers (GCC 4, VC++ 2008).
对于线性代数,您可能想要评估 Boost uBLAS,它是完整 BLAS 包的子集。正如您提到的,Boost Fusion也可能是合适的,具体取决于您正在实施的算法。
我相信您可以使用 VTK 的非 GUI 部分,例如
vtkDoubleArray
,而无需如果不需要的话,可以链接到可视化库。请注意,VTK 是为了渲染效率而不是计算效率而设计的。如果您不想渲染结果,不妨使用提供优化算法的科学包之一。有一种并行风格的 BLAS 称为(奇怪的是)PBLAS。我认为这不能通过 Boost 包装来实现,因此您可以直接使用 C 接口。
For linear algebra, you probably want to evaluate Boost uBLAS, which is a subset of the full BLAS package. As you mention, Boost Fusion may also be appropriate, depending on the algorithms you are implementing.
I believe you can use the non-GUI parts of VTK such as
vtkDoubleArray
without linking in the visualisation libraries if you don't need them. Note that VTK is designed for efficiency of rendering, not of calculations. If you don't want to render the results, you might as well use one of the scientific packages that provide optimized algorithms.There is a Parallel flavour of BLAS called (strangely enough) PBLAS. I don't think this is available through the Boost wrapping, so you would use the C interface directly.
如果不知道您想用阵列做什么,就很难给出真正坚定的建议。如果需要对数组进行高性能操作,那么 Blitz++ 可能是您的最佳选择。如果您在编译时遇到问题,那么您可能需要更改编译器或系统。他们确实支持 g++,因此几乎任何内容的最新版本都可以让您继续前进。
我没有使用过 Boost::fusion,但快速阅读手册表明它的主要目标只是制作异构容器。我不认为这就是你想要的。
我尝试过使用 GSL,但发现它对于我想做的任何事情来说都极其尴尬。
Without knowing what yo want to do with your arrays, it's hard to give really firm advice. If high performance manipulation of the arrays is needed then Blitz++ is probably your best bet. If you are having trouble compiling it then perhaps you need to change your compiler or system. They do support g++ so a recent version on just about anything should get you going.
I haven't used Boost::fusion but a quick read of the manual suggests that it's major goal is just to make heterogeneous containers. I don't think that's what you want.
I have tried to use the GSL but find it hopelessly awkward for anything I have wanted to do.
我不是专家,但您可能需要考虑使用 MATLAB API 。
I'm no expert, but you might want to consider using a MATLAB API.
有用于向量或矩阵运算的 GNU 科学库
There is the GNU Scientific Library for operation in vector or matrix
我会尝试使用 Blitz++,它会给你带来非常好的性能。犰狳也相当高效。
I would try using Blitz++, it will give you a really good performance. Armadillo is also quite efficient.