Re: [eigen] Special topic page on Aliasing

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/8/5 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
> On Wed, 4 Aug 2010, Benoit Jacob wrote:
>
>>>> 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.
>>
>> Wait... indeed this example is already mentioned on page 2 of the
>> tutorial and the output does show the aliasing problem. What's
>> happening?? I thought we were catching this?? See
>> checkTransposeAliasing_impl in Transpose.h ... ?!
>
> After a bit of a search, I found out that this example is compiled with
> EIGEN_NO_DEBUG (see the last line in doc/snippets/CMakeLists.txt) and thus
> the assertion is not checked. I'll add something to the aliasing docs page
> to clarify this.

Indeed you're right, this particular example is special-cased in
changeset 9f599d546c:

+ei_add_target_property(compile_tut_arithmetic_transpose_aliasing
COMPILE_FLAGS -DEIGEN_NO_DEBUG)

I'm not a fan of this! It can give the wrong impression that Eigen is
a dangerous place where such simple, common lines of code can silently
give wrong results. If we want to give examples of aliasing problems,
we should rather come up with examples that aren't caught by Eigen.
For example:

   Matrix2f m;
   m.row(1) = m.col(0);

Benoit

>
>
> Jitse
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/