Hello,

I have a 3d array and I want to compute the eigendecomposition of each slice 
[,, k]. I am trying to make Rcpp see the relevant slice of the 3d array as a 
matrix. My experiments, along the lines illustrated below, have so far been 
unsuccessful. Does anybody have a suggestion? Thank you in advance!


   NumericVector cpp_Sigma(Sigma); // 3d array, with dim(Sigma) = c(M,M,K), as 
a vector
   NumericMatrix tmpMatrix;
   List var_eigen;
   Function eigen("eigen");
   int k=2; // 3rd slice, for example

   tmpMatrix = cpp_Sigma[k * M * M]; 
   tmpMatrix.attr("dim") = Dimension(M, M);
   var_eigen = eigen(tmpMatrix);
   return var_eigen;

Best,
Giovanni
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to