Re: [eigen] lazy evaluation in sparse matrix multiply

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


Hi,

thanks for finding the bug.Fixed in rev 925164.

Actually, the evaluate-before-assigning flag is irrelevant for the
sparse path because we *always* evaluate to a different matrix before
assigning it to the result (we can do that because we have very cheap
shallow copy for sparse objects, and we *must* do that otherwise even
m = m+m won't work). So this was a bug of mine :(

Gael

On Thu, Feb 12, 2009 at 11:58 AM, Frederik Heinz
<Frederik.Heinz@xxxxxxxxxxxx> wrote:
> Hi,
>
> in trying out some of the Eigen sparse-matrix functionality, I noticed, that
> unlike dense matrix multiplication, sparse matrices appear to default to
> lazy evaluation of matrix multiplication.
>
> This causes an expression of the type
>
>  M = M * M;
>
> to yield a zero matrix when used with sparse matrices.
>
> Forced evaluation as in
>
>  M = (M * M).eval();
>
> on the other hand, has the desired effect.
>
> I suggest setting the evaluate-before-assigning flag for sparse
> matrix-product expressions.
>
> Regards
> Frederik
>
> P.S.: What is the current status of complex Hermitian sparse (or block
> tridiagonal) eigenproblems in Eigen?
>
>
>
>



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