This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 784 - assigning products to traingularView does not warn for size mismatch
Summary: assigning products to traingularView does not warn for size mismatch
Status: CONFIRMED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.2
Hardware: All All
: Low Unit Test Required
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-04 17:34 UTC by Jitse Niesen
Modified: 2019-12-04 13:11 UTC (History)
1 user (show)



Attachments

Description Jitse Niesen 2014-04-04 17:34:52 UTC
Test code:
----
  MatrixXd m1, m2;
  m1.setRandom(5,5);
  m2.resize(6,6);
  m2.triangularView<Lower>() = m1*m1;
----

This should warn that the size of m2 is different from the size of m1*m1 (unless compiled with -DNDEBUG) but it does not. Instead it produces invalid reads when run under valgrind.

Note that the product is necessary, "m2.triangularView<Lower>() = m1" without the product does produce a warning.
Comment 1 Christoph Hertzberg 2014-04-04 17:51:11 UTC
I added an assertion
https://bitbucket.org/eigen/eigen/commits/4544bc9

That fixes the immediate problem, we should add a regression-test and transplant to 3.2 (therefore I leave this bug open for now)
Comment 2 Christoph Hertzberg 2014-06-15 19:41:46 UTC
I'm actually not sure anymore, whether my patch might be too strict. E.g., shall the following work?

  MatrixXd m1(4,3), m2(3,3);
  m1.triangularView<Upper>() = m2*m2;

There is always the workaround of inserting a .topRows(3) after m1.
Comment 3 Nobody 2019-12-04 13:11:40 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/784.

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