10

I am having some trouble figuring out how to set the rows and columns of a MatrixXd at runtime in Eigen. Can anyone point me to some documentation or give some pointer on how to do this?

Thanks.

vPraetor
  • 313
  • 1
  • 3
  • 13
  • 1
    have you read the documentation: http://eigen.tuxfamily.org/dox/group__DenseMatrixManipulation__chapter.html. in particular the following pages: the Matrix class, Block operations, and advanced initialization? – ggael Nov 06 '13 at 22:31
  • Yes i did. From what i could see all the code snippets seem to mention some variables for setting up MatrixXd. I figured this out though... i just declare a variable MatrixXd without specifying any rows or columns and at the point where the size is known just use setZero() with the known size. – vPraetor Nov 06 '13 at 22:57

1 Answers1

13

You can define a MatrixXd size at runtime by using the method resize(nrow, ncol). You can read more about resizing a dynamic matrix in this link and its API definition here.

Spiralwise
  • 338
  • 3
  • 18