This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 834 - (v^T*m)^T != m^T*v
Summary: (v^T*m)^T != m^T*v
Status: RESOLVED DUPLICATE of bug 505
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.2
Hardware: x86 - 64-bit Linux
: Normal Wrong Result
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-26 16:16 UTC by Martin Rueckl
Modified: 2019-12-04 13:27 UTC (History)
2 users (show)



Attachments
test code reproducing the bug (1.33 KB, text/x-c++src)
2014-06-26 16:16 UTC, Martin Rueckl
no flags Details

Description Martin Rueckl 2014-06-26 16:16:41 UTC
Created attachment 471 [details]
test code reproducing the bug

Running the attached code leads to following output, which is wrong (if i'm not completely mistaken)

vector v:2x1:
1
1
matrix m:2x1:
2
2
Using ^T as "transposed"
out1 = (v^T*m)^T : shape: 1x1
out2 = m^T*v     : shape: 1x1
out1(0,0) = 0                       << should also be 4?!?!
out2(0,0) = 4 
out1 == out2: true                  << NO!
Comment 1 Christoph Hertzberg 2014-06-26 16:23:24 UTC
(v.transpose()*m) is evaluated into a temporary, which gets out of scope when the surrounding ().transpose() is later accessed.

Avoid using auto with Eigen-expressions!

*** This bug has been marked as a duplicate of bug 505 ***
Comment 2 Nobody 2019-12-04 13:27:55 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/834.

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