I would like to create a matrix of size 2N x 9
where N
is a dynamic value by vertical stacking 2N
1x9
matrices.
Here's what I tried doing.
using CoefficientMatrix = Eigen::Matrix<T, Eigen::Dynamic, 9>;
using CoefficientRow = Eigen::Matrix<T, 1, 9>;
CoefficientMatrix A(2*N, 9);
for (int i = 0; i < N; i++) {
CoefficientRow ax;
CoefficientRow ay;
// fill in ax and ay
A << ax, ay;
}
But, I get the following runtime error.
Assertion failed: (((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) && m_col == m_xpr.cols() && "Too few coefficients passed to comma initializer (operator<<)"), function finished, file /usr/local/include/eigen3/Eigen/src/Core/CommaInitializer.h, line 120.
I tried parsing through the assertion syntax but I'm not sure what those internal variable names are referring to in terms of my code (new to Eigen).
Thanks for any assistance.