Boost logo

Ublas :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-06-15 08:20:34


----- Original Message -----
From: "Toon Knapen" <toon.knapen_at_[hidden]>
To: "ublas mailing list" <ublas_at_[hidden]>; <ublas_at_[hidden]>
Sent: Wednesday, June 15, 2005 3:30 AM
Subject: Re: [ublas] Aliasing for += and -=

> christopher diggins <cdiggins_at_[hidden]> wrote:
>
> So IIUC you are suggesting that the uBLAS should not have views (like
> matrix_row, matrix_col, matrix_range etc). Of if uBLAS would have views
> that
> they are not implemented as being a proxy to the original data but instead
> copy the data.

Yes, precisely.

> This is certainly a good idea in many cases. For instance if you're going
> to
> perform a lot of operations on a matrix_range, it might be much better for
> performance to make sure that the data in the matrix_range is continuous
> in
> memory. Currently I advise people to assign their matrix_range to another
> matrix in such cases. At the end of the operations they should however not
> forget that they need to assign the matrix to the matrix_range if their
> intention was to modify the matrix that is pointed to by the matrix_range.
>
> To conclude I think both approaches (proxy-views and deep-copy views) are
> both necessary.

Me too. This is why I suggested two namespaces. Perhaps the namespaces would
better be named:

boost::numeric::ublas::proxy
boost::numeric::ublas::deep_copy

The other alternative is to use a #define USE_PROXY, but I don't
particularly like that approach.

> Deep-copy views however can be implemented using proxy-views
> (as I described above). And actually deep-copy views are plain containers
> instead of being views. And whenever we have expressions with containers
> instead of views we can safely ignore aliasing.

Right and when we can ignore aliasing our basic operations are more
efficieint.

Thanks for so eloquently articulating my point!

Christopher Diggins
http://www.cdiggins.com