Boost logo

Boost :

Subject: Re: [boost] Interested in a generic safe n-dimensional matrix/vector library?
From: sguazt (marco.guazzone_at_[hidden])
Date: 2011-02-22 03:29:50


On Tue, Feb 22, 2011 at 4:11 AM, Andrey Asadchev <asadchev_at_[hidden]> wrote:
> Hi.
>
> I am working on a tensor library (in the spirit of FTensor).   Perhaps you
> are interested as well?
> http://code.google.com/p/asadchev/source/browse/#svn%2Ftrunk%2Fprojects%2Fboost%2Ftensor
>
> example:
>
>    tensor::tensor<3> A(10,10,10);
>    size_t size[] = { 10, 10, 10, 10 };
>    tensor::tensor<4> B(size), C(size);
>
>    tensor::index<'a'> a;
>    tensor::index<'b'> b;
>    tensor::index<'c'> c;
>    tensor::index<'d'> d;
>    tensor::index<'e'> e;
>
>    // using dgemm underneath
>    contract(1, B(b,0,a,0), C(a,c,d,0), 0, A(b,c,d));
>    A(b,c,d) = contract(B(b,0,a,0), C(a,c,d,0));
>    A(b,c,d) = 5.0*contract(B(b,0,a,0), C(a,c,d,0));
>    A(b,c,d) -= 5*contract(B(b,0,a,0), C(a,c,d,0));
>    A(b,c,d) += 4*contract(B(b,0,a,0), C(a,c,d,0));
>
> int i = 9;
>
> // arbitrary tensor ops using templates
> A(c,d,i) = C(b,c,a,i)*A(a,b,i);
> A(i,i,i) = C(b,c,a,i)*(A(a,b,c) + B(a,b,i,c));

Hi,
while not extending the Boost.uBLAS library?
http://www.boost.org/doc/libs/1_45_0/libs/numeric/ublas/doc/index.htm

It works very well with matrix and vector.
It uses expression templates.
It handles special matrices (like sparse matricies).
It easly integrates with LAPACK/UBLAS thanks to Boost.Numeric-Bindings.

Best,

-- Marco


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk