fedvasu
fedvasu

Reputation: 1252

Fortran-style multidimensional arrays in C++

Is there a C++ library which provides Fortran-style multidimensional arrays with support for slicing, passing as procedural parameter and decent documentation? I've looked into blitz++ but its dead!

Upvotes: 6

Views: 1175

Answers (2)

big_gie
big_gie

Reputation: 3009

I highly suggest Armadillo:

Armadillo is a C++ linear algebra library (matrix maths) aiming towards a good balance between speed and ease of use

It is a C++ template library:

A delayed evaluation approach is employed (at compile-time) to combine several operations into one and reduce (or eliminate) the need for temporaries; this is automatically accomplished through template meta-programming

A simple example from the web page:

#include <iostream>
#include <armadillo>

int main(int argc, char** argv)
{
    arma::mat A = arma::randu<arma::mat>(4,5);
    arma::mat B = arma::randu<arma::mat>(4,5);

    std::cout << A*B.t() << std::endl;

    return 0;
}

Upvotes: 2

learnvst
learnvst

Reputation: 16195

If you are running OSX the you can use the vDSP libs for free.

If you want to deploy on windows targets then either license the intel equivalents (MKL) or I think that the AMD vector math libs (ACML) are free.

Upvotes: 0

Related Questions