Fastor icon indicating copy to clipboard operation
Fastor copied to clipboard

Binary operators on tensor views

Open tbb300 opened this issue 4 years ago • 1 comments

Not sure if the below is supposed to work or not, but seems strange that there is inconsistent behavior between operator += and operator +. Should this work? If not is there an easy way to get the desired behavior of taking a slice of a higher dimensional tensor and adding to a lower dimensional tensor?

Fastor::Tensor<double,2,2,2> test1 = 1;
Fastor::Tensor<double,2,2> test2 = 3;
test2 += test1(1,Fastor::all,Fastor::all); // <- works fine
test2 = test2 + test1(1,Fastor::all,Fastor::all); // <- compiles but throws runtime_error EXPRESSION SHAPE MISMATCH

tbb300 avatar May 04 '21 12:05 tbb300

This is certainly a bug. I will have a look. Thanks for reporting.

romeric avatar May 21 '21 21:05 romeric