I would like to create a matrix B from a block of matrix A. The size of A changes, so I'm trying to achieve the following
Eigen::MatrixXd B(A.block<3,N>(0,0));
where N is columns number of A. I get this error the expression must have constant value.
How can I solve this problem? I've tried to use const_cast<>
but I still get the same problem.
I think this would work:
Eigen::MatrixXd B = A.block(0, 0, 3, N);
The API documentation of eigen is here. If N
is a variable, it can't be used as a template function argument (<3,N>
) because those must be compile-time constants (the compiler generates/instanciates a version of the function block
for each combination or template arguments.)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments