Re: [eigen] lazy evaluation in sparse matrix multiply |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] lazy evaluation in sparse matrix multiply
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 12 Feb 2009 17:00:34 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ZFJWGo9AFxaiA1e7kcMkLJGe6CWdC46ChiVYFa3vOIE=; b=axwRxZsIQUMOCBNnoJpgHRdLsrv884Xf7T0f4/ts+F9sP8lTKQX76IPIt6x9RHfoUA mjX7Rzuny0Ic1L13IZoN3npns92Bid9ML/wpfpErJcD/+RQdUCRexdlKuZcPv2BgfGqb u0301BMptrOGGsIQ8fk61mM9P5lZXMYmuvTPc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=KgMJ445QUkWeV9rTWZjAq70tL4KgS3z+R9OGF0nv94jgFEOtEi1Daa9I12WamYaigj oI4izYrdmtKIV9FghjXFE1g33rDpVFwYpUlJsP6h4/bTrWjkP+zb3YRPxg7xS+LtiXF9 Q3JKUh1wFOX1EGok3v7VxjeNTFNDpOvTSXl6A=
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?
>
>
>
>