Re: [eigen] Using Triangular Views
• To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
• Subject: Re: [eigen] Using Triangular Views
• From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
• Date: Tue, 30 Aug 2016 14:56:24 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=/RFY/YH8NeEfzGhb5tF7K6CqYd0J9BNN0a9D5KEd4PU=; b=MyzmNRs2wSmgD0XW1aAnaM78JLK5pmbCecnRxlaP+tnAx6vnP6w/SJ2qiZbwKEcao2 j8XG3douQPQjd5lxG1E76Ys7me9DJVaMZu/jPgU2cKvCgwxFxCQhSIcOCeG3tzygMLb1 MadZfr7G6Ibh4ZM1jAe3W+iY+zu1I5ssssx1fVQS4jbaacNf5HyJgr9lmyAXXFcQcOdF blHmaKQluyKuJ5bp8kOQYlgbjyLWOw380aSWbz8mvOOh1zcg4mSVa9rl+mmRIgJVOsLB YNtfd23HsdvFa9d2UOmes4ka3X6YDmNnHgEY7D+oT2374/Yb9sHjVrLvbGuskBqufEbH a6tA==

It's not possible yet to multiply two triangular views.. One of the operands has to be a general full matrix.

Gael.

On Tue, Aug 30, 2016 at 2:09 PM, Brad Bell wrote:
How does one multiply a lower triangular matrix times a lower triangular matrix and avoid multiplying the zeros in the lower triangular matrix ?

An attempt at this (see below) does not seem to compile when MULTIPLY_VIEW is non-zero: To be specific, I get the error message:

error: no match for ‘operator*’ (operand types are ‘const Eigen::TriangularView<Eigen::Matrix<double, 2, 2>, 1u>’ and ‘const Eigen::TriangularView<Eigen::Transpose<Eigen::Matrix<double, 2, 2> >, 2u>’)
matrix B = view_L * view_L.transpose();

when I try to compile the program:
# include <Eigen/Core>
# include <iostream>

// code does not compile if you select MULTIPLY_VIEW equal to 1
# define MULTIPLY_VIEW 0

int main()
{   typedef Eigen::Matrix<double, 2, 2> matrix;
using Eigen::Lower;
using Eigen::TriangularView;

matrix A;
A <<
1, 2,
3, 4;
//
const TriangularView<matrix, Lower> view_L = A.triangularView<Lower>();
matrix L = view_L;
//
# if MULTIPLY_VIEW
matrix B = view_L * view_L.transpose();
# else
matrix B = view_L * L.transpose();
# endif
//
std::cout << "B =\n" << B << "\n";

return 0;
}

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