Created attachment 725 [details]
Program demonstrating issue
See attached program, which triggers an assertion error in debug mode. Assertion error happens when evaluating the product of a dynamically-sized block of a row vector and another matrix into a preallocated matrix (of the correct size).
Also, the results are wrong (with no error or crash) when compiled in release mode (compare c to d in attached program).
The problem is in
product_evaluator<Product<Lhs, Rhs, LazyProduct>,
ProductTag, DenseShape, DenseShape>::coeff(Index) const
where (src/Core/ProductEvaluator, line 535):
const Index row = RowsAtCompileTime == 1 ? 0 : index;
But in your case RowsAtCompileTime is Dynamic, so the wrong choice is made.
A quick-fix would be to use MaxRowsAtCompileTime here, though I'm not entirely sure if this breaks in other situations.
Btw: Strangely, it also works with
d.noalias() = a_block * b;
In this case the coeff(Index, Index) method of the product_evaluator is called (for reasons not obvious to me).
Also, this worked in 3.2 --> block3.3
It's rather unusual to call block on a vector. Anyway, here is a quick fix:
Let me write a full unit test before closing the bug.
I agree, but somebody used this in our codebase and it broke when we updated to the most recent version.
Thanks for the fix!
Sure, I was just looking for an excuse on the lack an appropriate unit test, fixed now:
Summary: Bug 1283: add regression unit test
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1283.