[eigen] Assignment to MatrixBase fails assertion or SEGVs

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


In general, eigen sets the lhs to the size of the rhs.

This assignment using MatrixBase compiles nicely but fails at run time:
Assertion failed: (rows() == other.rows() && cols() == other.cols()), function lazyAssign, file /u/lsst/products/DarwinX86/eigen/2.0.9/ include/Eigen/src/Core/Assign.h, line 406.

If you use static-sized arrays, you get a SEGV (g++ 4.3.4; os/x 10.6)

(I care because of the way that SWIG generates code (see yesterday's problems); I have almost everything working --- at least if you only want one type of Eigen arrays (e.g. float, RowMajor) playing with numpy at a time)

				R


#include "Eigen/Core.h"

using namespace Eigen;

int main() {
#if 0
    MatrixBase<Matrix2f> noinit;
    Matrix2f mat;
#else
    MatrixBase<MatrixXf> noinit;
    MatrixXf mat(2, 2);
#endif

    noinit = mat;
}




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/