romeric / Fastor

A lightweight high performance tensor algebra framework for modern C++
MIT License
721 stars 68 forks source link

Allow einsum/tensor contraction/permutation to work on tensor expressions #6

Closed romeric closed 7 years ago

romeric commented 7 years ago

Requested by Sebastian Moeckel:

Is there a way to use binary sub-operation in einsum, without splitting the einsum? I.e. is it possible to write:

Tensor<double,5> A, B, C;
Tensor<double,5,5> D;
.... //some initialization
D = einsum<Index<I>,Index<J>>(A, B - C)

instead of

D= einsum<Index<I>,Index<J>>(A, B) - einsum<Index<I>,Index<J>>(A,C);

I mainly ask, since I have large BinarySubOp expressions (also defining them into a separate variable did fail due to stack overflow).

romeric commented 7 years ago

This feature has now been implemented in 7a4ad88