Reputation: 20895
I want to make a diagonal matrix with the C++ linear algebra library eigen, but I do not know the size of the matrix during compile time. Hence,
DiagonalMatrix<Scalar, SizeAtCompileTime> diag1(size);
will not work. The values along the diagonal also differ. Help?
Upvotes: 1
Views: 1704
Reputation: 29205
You need to instantiate the template parameter with what is relevant for you:
DiagonalMatrix<double,Eigen::Dynamic> diag1(size);
Upvotes: 4