Boost logo

Boost Users :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2002-11-27 03:53:35


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net