Boost logo

Ublas :

Subject: Re: [ublas] interpreting ublas::vector as a matrix?
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2011-12-08 12:10:42


Hi Thomas,

thanks for the reply. I'lll try that tomorrow. I allready tried to write a
storage adaptor myself but i got a lot of compiler errors, so a real ublas
think might fix that :)

Do you know, why this feature is a) undocumented and b) must be activated
using a define? Are there restrictions? Can I rely on the fact, that it
will be included in future releases of boost?

Thanks a lot!

Greetings,
Oswin

> Hi Oswin,
>
> how about
>
> #define BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR
> #include <boost/numeric/ublas/matrix.hpp>
>
> boost::numeric::ublas::matrix<std::complex<double>,
> boost::numeric::ublas::column_major,
> boost::numeric::ublas::shallow_array_adaptor<std::complex<double> >
> > vv(10, 10,
> boost::numeric::ublas::shallow_array_adaptor<std::complex<double> >
> (100, &v(0)));
>
> more or less, but I hope you get the idea.
>
> Regards,
> Thomas
>
>
>> -----Original Message-----
>> From: ublas-bounces_at_[hidden] [mailto:ublas-
>> bounces_at_[hidden]] On Behalf Of Oswin Krause
>> Sent: Thursday, December 08, 2011 1:26 PM
>> To: ublas_at_[hidden]
>> Subject: [ublas] interpreting ublas::vector as a matrix?
>>
>>
>> Hi list,
>>
>> is there an easy way to interpret the contents of a vector as a matrix?
>>
>> e.g. like that for a 10 times 10 matrix and a vector with 100 elements:
>> first row = v(0)...v(9)
>> second row = v(11)...v(19)
>> ...
>> nth row = v(90)...v(99)
>>
>> I would like not to copy the vector into a matrix since the call to new
>> plus
>> copying of the elements into a matrix could easily exceed the runtime
>> of
>> the whole function.
>>
>> Is there maybe an adaptor I could use? Or could I just change a tiny
>> bit
>> of another adaptor to make this work?
>>
>> Greetings,
>> Oswin
>>
>>
>>
>>
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: thomas.klimpel_at_[hidden]
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: Oswin.Krause_at_[hidden]
>