Re: vector view of a matrix
Janusz opechowski <[email protected]> Tue, 3 Feb 2004 23:47:40 +0000 (GMT)
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello again So it might be this : 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 - vector view typedef matrix< double, rectangle<>, dense<external> >::type Matrix; Matrix B(a, n,n); // B - matrix view // also check in contrib\examples\external_matrix.cc Cheers Janusz --- Hugues Demers <[email protected]> wrote: > 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/ ________________________________________________________________________ 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/