ublas::matrix sharing storage with ublas::vector
It is possible for a vector and a matrix to share the same storage, as long as the dimensions agree? Some of the algorithms I am implementing require some objects to be treated as an arbitrarily sized matrix, and sometimes as a vector, and it would be convient to have a matrix and a vector share the same memory. -- Stephen
On Wednesday 27 November 2002 04:10, Stephen Crowley wrote:
It is possible for a vector and a matrix to share the same storage, as long as the dimensions agree?
Some of the algorithms I am implementing require some objects to be treated as an arbitrarily sized matrix, and sometimes as a vector, and it would be convient to have a matrix and a vector share the same memory.
I suppose you want to treat one particular row or column of the matrix as a vector. You can do for instance : matrix< double > m(10,10) ; matrix_row< matrix< double > > row(m,0) ; // first row of matrix m
participants (2)
-
Stephen Crowley
-
Toon Knapen