I have the following code snippet:

Eigen::MatrixXcd Recon = Eigen::MatrixXcd::Zero(p.nPoints*p.na, p.numEl);

// Do some functions to add data to Recon

outputs[0] = factory.createArray<std::complex<double>>({static_cast<size_t>(p.numEl),static_cast<size_t>(p.na),static_cast<size_t>(p.nPoints)});
                  
for(int i = 0; i < p.na; i++) {
   for (int j = 0; j < p.nPoints; j++) {
      for (int n = 0; n < p.numEl; n++) {
         outputs[n][i][j] = Recon( i*p.nPoints + j ,n);
      }
   }
}

How can I adjust my code above so that I am mapping the data in outputs to the data in Recon instead of copying it element by element?

0

There are 0 best solutions below