Re: [eigen] Special topic page on Aliasing

[ Thread Index | Date Index | More Archives ]

2010/8/1 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
> Hello,
> I started a special topic page on Aliasing; you can see the start at
> My idea is to explain aliasing from a user's perspective, and mention as
> little about the internals of Eigen as possible.
> However, I'm now wondering whether we need this page. There is quite a bit
> of overlap with the page "Lazy Evaluation and Aliasing" at
> In my mind the main topic of that page is lazy evaluation. Perhaps the need
> to learn about lazy evaluation is a bit less immediate for the user (that's
> why I very immodestly bumbed 'my' aliasing page to the above the lazy
> evaluation page in the Overview page).
> I think that the pages are sufficiently different that it's useful to have
> both, but I want to give others a chance to comment first before I do more
> work on the aliasing page.

Sorry for the long delay replying. Thanks for starting this page. As I
already mentioned, I think it's good to have many special-topics pages
and it's OK to have some redundancy between them. So a page on
aliasing is very welcome alongside a page on lazy evaluation.

I have a few comments about the content. The example a=a.transpose()
is a bit special as we do catch it with an assertion in Eigen. So it's
not really dangerous (not any more than any other illegal op) it's
just illegal.

It's still good to use that as your first example of assignment
exposing aliasing issues at the top. But below, instead of the
dichotomy safe/dangerous, I would rather distinguish 4 cases:
 - totally safe operations (e.g. coeff-wise ops)
 - operations that are safe because Eigen is taking care of
introducing a temporary (e.g. m = m*m).
 - operations that are illegal, and that Eigen catches (e.g. m = m.transpose())
 - operations that are dangerous (silently give wrong result) -
explain that this is the "generic case" and give an example e.g.
m.row(i) = m.col(j) for suitable i,j.

Thanks again for getting this rolling.


> Cheers,
> Jitse

Mail converted by MHonArc 2.6.19+