New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1405 - StrictlyLower/StrictlyUpper triangularView doesn't work properly with matrix product
StrictlyLower/StrictlyUpper triangularView doesn't work properly with matrix ...
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - expression templates
3.3 (current stable)
x86 - 64-bit Linux
: Normal Wrong Result
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-15 12:08 UTC by Lauri Berkovits
Modified: 2017-06-09 12:39 UTC (History)
3 users (show)



Attachments
example code (426 bytes, text/plain)
2017-03-15 12:08 UTC, Lauri Berkovits
no flags Details

Description Lauri Berkovits 2017-03-15 12:08:18 UTC
Created attachment 782 [details]
example code

This kind of code doesn't give what one expects:

C.triangularView<StrictlyLower>() = A*B;

(Without "strictly" it works perfectly.)

Example code:

   MatrixXi A, B, C, D;
   A = MatrixXi::Ones(5,5);
   B = MatrixXi::Ones(5,5);

   C = MatrixXi::Zero(5,5);
   D = MatrixXi::Zero(5,5);

   C.triangularView<StrictlyLower>() = A*B;
   D.triangularView<StrictlyUpper>() = A*B;
   
   cout << "\n C = \n " << C << endl;
   cout << "\n D = \n " << D << endl;

Output:

 C = 
 5 5 5 5 0
0 5 5 5 0
0 0 5 5 0
0 0 0 5 0
0 0 0 0 5

 D = 
 5 5 5 5 0
0 5 5 5 0
0 0 5 5 0
0 0 0 5 0
0 0 0 0 5
Comment 1 Gael Guennebaud 2017-06-09 12:05:25 UTC
This is not supposed to work, only Upper and Lower are expected when using triangularView as a writing mask. I'll add a proper static assertion.
Comment 2 Gael Guennebaud 2017-06-09 12:39:48 UTC
eventually, supporting Strictly* modes was rather easy, so here it is:

https://bitbucket.org/eigen/eigen/commits/e3b19f71b35d/ (devel)
https://bitbucket.org/eigen/eigen/commits/136a349517eb/ (3.3)

Note You need to log in before you can comment on or make changes to this bug.