views:

448

answers:

6

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

A: 

I'm no expert, but you might want to consider using a MATLAB API.

suszterpatt
A: 

There is the GNU Scientific Library for operation in vector or matrix

coelhudo
The question was about C++.
Dirk Eddelbuettel
+1  A: 

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.

gavinb
Good thing is that vtkDoubleArray returns a pt to the array so that the performance (based on http://stackoverflow.com/questions/446866/boostmultiarray-performance-question/539001#539001) can be almost the same as it's with native array (i.e. double *pt[sizex*sizey]). Same thing with Eigen with MatrixXd m(sizex,sizey)
dodol
VTK is very complex and I double it's worth it if you only are going to use non visualisation stuff.
FX
+3  A: 

Eigen, supports auto-vectorisation of vector on certains compilers (GCC 4, VC++ 2008).

Michaël Larouche
Eigen reports great peroformance (although i'd like some independent benchmarks), is free and has a great API. I'd look at it before anything else, and I've tried quite a few solutions (PetsC, Atlas, VNL, GSL,...)
static_rtti
+1  A: 

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.

Dr. Tim
Have a look at POOMA http://acts.nersc.gov/pooma/ if parallelisation is really important.Note that Eigen will not give you the degree of multidimesionality that you need.
Dr. Tim
The fact that I have trouble with compiling blitz shows that I'm a noob :). But yes, I'm aware that maybe it's probably the best solution.
dodol
A: 

I would try using Blitz++, it will give you a really good performance. Armadillo is also quite efficient.

corydalus