blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
405 stars 84 forks source link

Update operators don't work with mixed-rank expressions #72

Open slayoo opened 5 years ago

slayoo commented 5 years ago

Migrated from: https://sourceforge.net/p/blitz/bugs/42/

As reported by Patrik Jonsson on 2012-05-09:

If a1 is a 1-dim array and a2 is a 2-dim one, it works fine to do

a2 = a2*a1(tensor::i);

However,

a2 *= a1(tensor::i);

fails with BZ_DEBUG, because the expression is rank1 but is assigned to a rank2 array. I assume that it actually works correctly since the index is used (though I haven't explicitly tested this), so it would be good to figure out how to write the rank test so it doesn't fail.