This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1560 - Bug in diagonal product for 1x1 matrices
Summary: Bug in diagonal product for 1x1 matrices
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.4 (development)
Hardware: All All
: Normal Wrong Result
Assignee: Nobody
URL:
Whiteboard:
Keywords:
: 1561 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-06-25 08:29 UTC by Gael Guennebaud
Modified: 2019-12-04 17:43 UTC (History)
3 users (show)



Attachments

Description Gael Guennebaud 2018-06-25 08:29:22 UTC
Reported by Steve Wolter:

When taking the diagonal of a 1x1 matrix and multiplying it with a vector / row vector with an uneven number of cols / rows (e.g. 1x3 or 1x6 with floats), the last chunk's values are incorrect. I've got a minimal example that demonstrates the error with gcc Debian 6.3.0-18+deb9u1 (and older gcc's as well), and Eigen 3.3.4 & 3.3.1 & 3.3.2, but not with Eigen 3.2.9:

#include <iostream>
#include <Eigen/Core>

int main() {
    Eigen::Matrix<float, 1, 1> a;
    a.fill(1);
    Eigen::Matrix<float, 1, Eigen::Dynamic> b(1, 3); 
    b.fill(2);
    std::cerr << a * b << std::endl;              // Correct result: 2 2 2
    std::cerr << a.asDiagonal() * b << std::endl;  // Incorrect result: 2 2 ~0
}

I couldn't reproduce the error with any size of a except 1x1.
Comment 2 Gael Guennebaud 2018-06-26 06:25:29 UTC
*** Bug 1561 has been marked as a duplicate of this bug. ***
Comment 3 Nobody 2019-12-04 17:43:47 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/1560.

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