[eigen] Eigen 3.0-beta1 operator+= problem |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Dear Eigen list,
I decided to evaluate Eigen and (wanting to dive in at the deep end) downloaded Eigen 3.0 beta. However, I immediately ran into the problem exemplified by the code below, in which using operator+= seems to give a different answer than using operators + and = separately when the rhs is the result of ColPivHouseholderQR::solve(). (The problem did not occur with a plain MatrixXd on the right.) Is this behaviour a bug, or am I doing something wrong?
Many thanks,
Gavin Band.
// ==== begin code ====
#include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::VectorXd pt( 1 ), v1( 1 ), v2( 1 ) ;
pt << 1 ;
v1 << 1 ;
v2 << 1 ;
Eigen::MatrixXd M( 1, 1 ) ;
M << 1.0 ;
Eigen::ColPivHouseholderQR< Eigen::MatrixXd > decomposer( M ) ;
v1 += decomposer.solve( pt ) ; // value is 1 ???
v2 = v2 + decomposer.solve( pt ) ; // value is 2, ok.
std::cerr << "QR = " << decomposer.matrixQR() << ", v1 = " << v1 << ", v2 = " << v2 << ".\n" ;
}