Re: [eigen] discrepancy in (triangular view + transpose) and self-adjointness |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] discrepancy in (triangular view + transpose) and self-adjointness
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 14 Jul 2010 19:14:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=lYlNYWj8h7YXSw4FRNcDIjZ4Xe83biS2Ba7L9OIx1Fs=; b=ZqkxDszeUwfL+a1O7m+HpHIbh7JgXKrpierFzG/uxo3CDS7nYdVVGdZsbJESc2k13H zkaLZ8rO19lNTsX3m06RgtM3MMKIKS9erPqzQSyUcVbIrBLRLi/oxp+vxLGVb/ph5KXj zvbwYUyAHtvConwYd5znxnqnWdeMmW3shh5U0=
- 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=CNFim6UurJpNP6Na0KWaSIMttScjHesosWUVjr1EiC+bQ2IiF367Ot91LlX/TBqC3j 8GzgsoGNpKe9Kkvi7d/1qnA/EmXBaNUCLbTJUuiyazATwumdQYOYa9NBdHbkdB10wal8 tJT8DQVS64gbenFfadIcO2xFF6Uk9B9ZWoCX8=
Hi,
It would help if you could make a compilable test program, so we can
quickly run stuff.
Benoit
2010/7/14 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
> Hi all,
>
> Could someone please help me figure out the source of the following
> discrepancy?
>
> Given:
> int const N = 5;
> MatrixXi A(N,N);
> A.setRandom();
>
> TriangularView<MatrixXi,Lower> const A_l(A);
> TriangularView<MatrixXi,Lower|ZeroDiag> const A_zl(A);
>
> the following must be true:
>
> A.selfadjointView<Lower>() == A_l + A_zl.transpose()
>
> Basically, I am adding the lower triangle of A to its own transpose, without
> adding the diagonal a second time. So the following is calculated correctly
> by Eigen:
>
> MatrixXi C1(N,N), C2(N,N);
> C1 = A.selfadjointView<Lower>();
> C2 = A_l.toDenseMatrix() + A_zl.transpose().toDenseMatrix();
> assert(C1 == C2);
>
> But, the following code produces a discrepancy:
>
> MatrixXi B(N,N);
> B.setRandom();
> C1 = A.selfadjointView<Lower>() * B;
> C2 = (A_l * B) + (A_zl.transpose() * B);
> assert(C1 == C2); // <-------- FALSE!
>
> After a long day my brain is unable to figure out if I am doing something
> extremely silly - it seems too trivial to be a bug. Can someone offer
> comments?
>
> thanks,
> Manoj
>
>
>