Boost logo

Ublas :

From: Vardan Akopian (vakopian_at_[hidden])
Date: 2006-02-10 15:08:51


Hi Gunter,

I've always used the shallow_array_adaptor for that purpose.

Here is our discussion about that
http://lists.boost.org/MailArchives/ublas/2005/08/0651.php

And here is a little example how I use it
http://lists.boost.org/MailArchives/ublas/2005/07/0530.php

Note: I still haven't update to 1.33.x, so YMMV

-Vardan

P.S. Is there a way to search the ublas mailing list archives direcly
from there? Or do we need to laverage google? It's so hard to find old
posts...

On 2/10/06, Gunter Winkler <guwi17_at_[hidden]> wrote:
> Hello,
>
> I have the following problem:
>
> I have a pointer to a double array: const double *data;
> and an integer size
>
> I would like to use this as a vector in ublas routines.
>
> I expected that
>
> carray_adaptor<const double> shared(size, data);
> vector<const double, carray_adaptor<const double> > v(size, shared);
>
> does the job. Unfortunately it does not compile because the copy constructor
> of carray_adaptor is private. But this make the adaptor quite useless,
> because I am not able to convert it into a vector_expression (without copying
> the data).
>
> What is the rigth way to solve my problem?
>
> Should we support a syntax like
>
> vector<double> v(size);
> matrix<double> m(size, size);
> const double *external_data;
>
> v = prod(m, external_vector_adaptor(size, external_data));
>
> this would be very convenient.
>
> mfg
> Gunter
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>
>
>
>