Mapping array back to an existing Eigen matrix

Viewed 16806

I want to map an array of double to an existing MatrixXd structure. So far I've managed to map the Eigen matrix to a simple array, but I can't find the way to do it back.

void foo(MatrixXd matrix, int n){

 double arrayd = new double[n*n];
 // map the input matrix to an array
 Map<MatrixXd>(arrayd, n, n) = matrix;  

  //do something with the array 
             .......
// map array back to the existing matrix

}
2 Answers
Related