Armadillo C++: most efficient way to calculate using submatrix

54 Views Asked by At

Suppose I have two armadillo matrices A and B, and I want to calculate matrix product of two submatrices from both. I wonder what is the most efficient way to achieve it? Thanks

arma::mat A;
arma::mat B;

// suppose the dimensions work, I want to take product of two submatrices
arma::mat Asub = A.rows(1,2);
arma::mat Bsub = B.rows(3,4);

arma::mat result = Asub * Bsub;

// the calculation above needs copy and paste and looks to be inefficinet.

Efficient way to calculate product of two submatrices

0

There are 0 best solutions below