Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-06-15 03:45:00

On Wednesday 15 June 2005 04:31, christopher diggins wrote:
> ----- Original Message -----
> From: "Ian McCulloch" <ianmcc_at_[hidden]>
> To: <ublas_at_[hidden]>
> Sent: Tuesday, June 14, 2005 9:55 PM
> Subject: Re: [ublas] Aliasing for += and -=
> > christopher diggins wrote:
> >>> I don't think the tradeoff's work that way. Whether aliases appear in
> >>> an
> >>> expression depends purely on how the user writes it,
> >>
> >> It also depends on whether the library actually uses aliases in the
> >> first place.
> >
> > What does it mean for the library to *use* aliases? How does the library
> > know whether arguments are aliases (except in some special cases) ?
> It doesn't, but a matrix and vector library does not have to allow aliasing
> in the first place.

This is very odd. Either we are all talking at cross purposes or you are
missing something fundamental.

> Aliasing is a technique of allowing memory to be shared, which is supposed
> to save superflous copies in some circumstances (but evidently not many).
> This is the only reason I can understand for using aliasing in the first
> place.

The aliases we are talking about are simpler then this! They are simply
matrices/vectors (or elements there of) that appear in more then one place in
an expression.

Even the BLAS 2 operation
        gemv ( 1, A, x, 1, x )
has an alias for 'x' and the result will not be x := A*x

Aliases that appear both on the left and right hand side of an expression are
problematic! Hopefully this clarifies things regarding alias. In the light of
this I have worked on the overview documentation a bit to make things

Any BLAS library has these aliases. As Ian pointed out it is a question of
how you deal with them.

At this point I would like to concentrate on Ian's suggestion on making the
uBLAS default to be the noalias assignment. Ian makes some persuasive

I would like to introduce and 'alias' function equivalent to the existing
'nolias'. That way users could start to use the no function before a change
is made.