|
Ublas : |
Subject: Re: [ublas] Matrix view over a bunch of ublas::vector's
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2010-06-24 13:43:34
Hi all,
I agree with Andrea and I suppose that a solution to such problems would come from a horizontal or vertical concatenation expression template. It shouldn't be very hard to develop.
Furthermore to Jesses' answer, one may want to take a look at the generalized_vector_of_vector, that I think can be operated through pointers to stored vectors (maybe it needs a dangerous hack there though). The latter may suffice for what dari wants to do.
Best
Nasos
>
> Hi guys,
> boost::ublas::assignement might not be an efficient choice, for it is
> meant to copy the values, if I'm not mistaken. If, as I have
> understood, the question is how to avoid the copy of this bunch of
> vectors, then I guess the solution is a suitable matrix adaptor that
> on-the-fly acts as a view.
>
> A similar issues arises whenever a plain double* array has to be
> converted on a boost::ublas::vector. In that case an adaptor is
> available (I guess not yet in the official distribution). Similarly, I
> suspect that the code should be something like:
>
> matrix_from_vectors< vect_type > m(n_vectors, a_list_of_vectors)
>
> Eventually, a storage specifier could say if the vectors are intended
> by rows or by columns. If the vectors are not stored toghether, it may
> look like:
>
>
> matrix_from_vectors< vect_type > m(n_vectors);
> m.row(0)=&v0;
> m.row(1)=&v1;
> ...
>
> so that internally only a pointer to the vector is stored. I think
> that the question is really interesting and a good solution might be
> useful for many.
>
>
> Andrea
>
>
>
> --
> Andrea Cassioli
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: nasos_i_at_[hidden]
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4