This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1405 - StrictlyLower/StrictlyUpper triangularView doesn't work properly with matrix product
Summary: StrictlyLower/StrictlyUpper triangularView doesn't work properly with matrix ...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - expression templates (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 64-bit Linux
: Normal Wrong Result
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-15 12:08 UTC by Lauri Berkovits
Modified: 2019-12-04 16:53 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)
Comment 3 Nobody 2019-12-04 16:53:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1405.

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