[eigen] discrepancy in (triangular view + transpose) and self-adjointness

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

Hi all,

   Could someone please help me figure out the source of the following 

	int const N = 5;
	MatrixXi A(N,N);
        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);
    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 


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