Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary operators on tensor views #140

Open
tbb300 opened this issue May 4, 2021 · 1 comment
Open

Binary operators on tensor views #140

tbb300 opened this issue May 4, 2021 · 1 comment
Labels

Comments

@tbb300
Copy link

tbb300 commented May 4, 2021

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
@romeric romeric added the bug label May 21, 2021
@romeric
Copy link
Owner

romeric commented May 21, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants