Assertion error while evaluating product of AutoDiffScalar<VectorXd> with derivs initialized and CwiseBinaryOp containing AutoDiffScalars with uninitialized derivs
Submitted by twa..@..il.com
Assigned to Nobody
Link to original bugzilla bug (#1281)
Version: 3.3 (current stable)
Description
Created attachment 724
Program triggering assertion error
See attachment.
For AutoDiffScalar<VectorXd>, the derivatives vector is initialized as a null matrix, so that allocations only happen when needed. This causes an assertion error in debug mode when an AutoDiffScalar<VectorXd> with derivatives initialized is multiplied by a CwiseBinaryOp of AutoDiffScalar<VectorXd>s, for which m_lhs and m_rhs have uninitialized derivative vectors.
Assertion error (on clang, but also occurs on MSVC 2015 32 bit):
Assertion failed: (aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()), function CwiseBinaryOp, file /Users/twan/code/eigen/Eigen/src/Core/CwiseBinaryOp.h, line 109.
Attachment 724, "Program triggering assertion error":
main.cpp