matrix inside a matrix?
Is it possible to define a matrix that is part of a larger matrix, without having to create temporaries and copy part of the larger? /----------\ | | | | SM | | |----| LM | | | \----------/ I need to extract a sub-section of a matrix, multiply it, and then copy it back. I am currently using a temporary, but I have a feeling there must be a better way. -- Stephen
Stephen Crowley wrote:
Is it possible to define a matrix that is part of a larger matrix, without having to create temporaries and copy part of the larger?
/----------\ | | | | SM | | |----| LM | | | \----------/
I need to extract a sub-section of a matrix, multiply it, and then copy it back. I am currently using a temporary, but I have a feeling there must be a better way.
I suppose you are using ublas ;o)
`template <typename Matrix> class matrix_range' seems to be
what you are looking for:
==============================================
using namespace boost::numeric::ublas;
matrix<double> LM (10, 10);
// init LM
matrix<double> M1 (4, 4);
// init M1
matrix_range
participants (2)
-
Kresimir Fresl
-
Stephen Crowley