Boost logo

Boost :

Subject: Re: [boost] Interested in a generic safe n-dimensional matrix/vector library?
From: Andrey Asadchev (asadchev_at_[hidden])
Date: 2011-02-21 22:11:29


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));


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