views:

94

answers:

3

I am looking for advice regarding high performance multi-dimensional array libraries/classes for C++. What I really need is:

  • the ability to dynamically allocate arrays with a size determined at run-time

  • the ability to access and modify single array values (fast)

  • to be able to use simple array arithmetic such as array1 = array2 + 2 * array3

  • a well-maintained library

I have come across various libraries, including:

  • Blitz++, which looks exactly what I need, but which doesn't seem very well maintained (latest stable release was 5 years ago)

  • Boost, which doesn't support array arithmetic, and appears to be a quite slow compared to say Blitz++.

  • Jonn Bowman's array.h which has no documentation.

Does anyone have any other suggestions or comments about the above options?

A: 

Maybe library such as BLAS, a CBLAS exists, but don't remember where.

http://www.netlib.org/blas/

ykatchou
+1  A: 
  • uBlas, a part of Boost. It offers full BLAS level 1-3, and hence lots of array arithmetic functions.
  • Armadillo also seems to be a C++ linear algebra library, which as far as I can see optionally uses LAPACK/Atlas (which of course makes it canonically fast).
  • The GNU Scientific Library offers full BLAS. I don't know how fast it is, or if it can use LAPACK/Atlas.
  • If you don't need anything more fancy than what you list, you can quite easily wrap for example Atlas' BLAS yourself. But you probably don't want to reinvent the wheel if you don't have to.
gspr
+2  A: 

There is a broad and relatively recent survey, including benchmarks, here.

I believe that you can speed up Boost.UBlas by binding it to underlying numerical libraries like LAPACK or Intel MKL, but have not done that.

fwiw, the implementations that seem to come up most often as candidates are Boost.UBlas and MTL. It's my experience that wide adoption is more likely to foster ongoing support and development.

Steve Townsend