Re: vector view of a matrix

Hugues Demers <[email protected]> Tue, 3 Feb 2004 10:50:37 -0500
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <20040203155037.GA478@neptune>
On Tue, Feb 03, 2004 at 05:44:52AM +0000, Janusz opechowski wrote:
> hello !
> 
> Say :
> 
> int n ; // size of square matrix
> double *a ;  //pointer to memory of a row matrix 
> 
> typedef mtl::external_vec<double > mvec;
> 
> mvec b(a,n*n); // b is all you need
> 
> cheers
> Janusz
>

Yes, I thought about that, but (I did not state that clearly) I want to
have two mtl objects, an mtl::matrix and an mtl::dense1D. I want to
operate differently on those two using mtl algorithms. Is there such a
thing as having a vector view of a matrix as you can have a blocked view
of a matrix? Maybe if I could get a pointer to the allocated memory of a
mtl::matrix and initialized a mtl::vector with it. But that would be
against the point of using the mtl I suppose.

Hugues

> 
> 
> 
> 
> 
> 
> 
>  --- Hugues Demers <[email protected]> wrote:
> > Hi,
> > 
> > I just discovered the MTL and I think it would fit
> > my needs perfectly.
> > Now I would like to know if it's possible to have a
> > vector view of a
> > matrix. Suppose a have this matrix:
> > 
> > M = [1 2]
> >     [3 4]
> > 
> > I want to have this view on it 
> > 
> > V = [1 2 3 4]. 
> > 
> > I don't want to duplicate the memory. Iterators
> > won't do, because I want
> > to be able to do something like:
> > 
> > dot( V, V ). 
> > 
> > Is it possible to have those two representations?
> > 
> > Sorry, if I missed this in the doc, but it's rather
> > poor on the subject.
> > 
> > Thank you,
> > Hugues Demers
> > _______________________________________________
> > This list is archived at
> http://www.osl.iu.edu/MailArchives/mtl-devel/ 
> 
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping" 
> your friends today! Download Messenger Now 
> http://uk.messenger.yahoo.com/download/index.html
> _______________________________________________
> This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/