Array of pointers to Eigen Matrices

后端 未结 2 1255
别那么骄傲
别那么骄傲 2021-02-09 18:38

I am using MatrixXd matrices from Eigen on my code, and at a certain point I need a 3D one. Since Eigen does not have tridimensional matrix types, as it is optimized just for li

相关标签:
2条回答
  • 2021-02-09 18:54

    Either use b->coeffRef(i,j) to get a read/write reference, or dereference b: (*b)(i,j), or use a reference for b:

    MatrixXd& b = CVM[k];
    b(i,j) = 47;
    
    0 讨论(0)
  • 2021-02-09 18:57

    Just use operator()(int,int)

    CVM[k].operator()(i,j) = 47;
    

    or

    CVM[k](i,j) = 47;
    

    or

    Eigen::MatrixXd* b = &CVM[k];
    b->operator()(i,j) = 47;
    

    Here k is the matrix, i is the row, and j is the column.

    0 讨论(0)
提交回复
热议问题