Re: [eigen] Support for trace of tensors

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


The trace operator would be a nice addition to the library.. Unfortunately I don't have the time to implement the operation myself at the moment, but I can help you get started if you're interested in contributing.

Benoit

On Mon, Mar 28, 2016 at 4:42 PM, Christophe Prud'homme <christophe.prudhomme@xxxxxxxxxx> wrote:
Hi

I am evaluating Eigen::Tensor, it is very nice and allows to reduce some of my code a lot.
In tensor calculus the trace is an important operation.
could it be supported by Eigen:Tensor ?

For example
Eigen::Tensor<double,3> S( 2,2,2 );

Eigen::array<DimPair, 1> dims = {{DimPair(0, 1)}}; 

// compute the trace of S along the first and second dimensions
Eigen::Tensor<double,1> V=S.trace( dims );

​Best regards
C.​
--
Christophe Prud'homme
Feel++ Project Manager
Professor in Applied Mathematics 
@ Université de Strasbourg (France)



--
Benoit


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/