New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 839 - Wrong 1x1 triangular matrix-vector product
Wrong 1x1 triangular matrix-vector product
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - matrix products
unspecified
All All
: Normal Wrong Result
Assigned To: Nobody
:
Depends on:
Blocks: 840
  Show dependency treegraph
 
Reported: 2014-07-07 14:28 UTC by Chen-Pang He
Modified: 2014-07-23 18:06 UTC (History)
2 users (show)



Attachments
Demo reproducing the bug (955 bytes, text/x-csrc)
2014-07-07 14:28 UTC, Chen-Pang He
no flags Details

Description Chen-Pang He 2014-07-07 14:28:02 UTC
Created attachment 473 [details]
Demo reproducing the bug

Our internal::triangular_matrix_vector_product is specialized for triangular matrix-vector product.  When 1x1 times 1xn, it ends prematurely by computing only one entry.

The below is the output from the program compiled with the attachment.

Matrix:
 0.144509
0.0973679
-0.228021
 0.190039
-0.105256
-0.131808
0.0489002
 0.160188

Triangular:
0.144509
       0
       0
       0
       0
       0
       0
       0

?TRMV:
0.144509
       0
       0
       0
       0
       0
       0
       0

?TRMM:
 0.144509
0.0973679
-0.228021
 0.190039
-0.105256
-0.131808
0.0489002
 0.160188
Comment 1 Chen-Pang He 2014-07-08 08:13:34 UTC
I see where the problem is.

When TriangularProduct invokes internal::trmv_selector, side information is lost.  We assumed that if the non-triangular is column-vector then the triangular is on the left.  However, it is possible that the triangular is row-vector on the right.

I am working on a patch to internal::trmv_selector.
Comment 2 Chen-Pang He 2014-07-08 21:38:55 UTC
I found that no refactorization is needed.  I have made a pull request.
https://bitbucket.org/eigen/eigen/pull-request/72/fix-bug-839

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