Bugzilla – Bug 784
assigning products to traingularView does not warn for size mismatch
Last modified: 2014-06-15 19:41:46 UTC
MatrixXd m1, m2;
m2.triangularView<Lower>() = m1*m1;
This should warn that the size of m2 is different from the size of m1*m1 (unless compiled with -DNDEBUG) but it does not. Instead it produces invalid reads when run under valgrind.
Note that the product is necessary, "m2.triangularView<Lower>() = m1" without the product does produce a warning.
I added an assertion
That fixes the immediate problem, we should add a regression-test and transplant to 3.2 (therefore I leave this bug open for now)
I'm actually not sure anymore, whether my patch might be too strict. E.g., shall the following work?
MatrixXd m1(4,3), m2(3,3);
m1.triangularView<Upper>() = m2*m2;
There is always the workaround of inserting a .topRows(3) after m1.