Re: [eigen] Eigen 3.0-beta1 operator+= problem

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Many thanks for this, I will try again with the development branch.
Gavin.

On 6 Sep 2010, at 11:36, Gael Guennebaud wrote:

> thank you for the self-contained test case. problem solved with
> respective unit tests.
> 
> gael
> 
> On Mon, Sep 6, 2010 at 12:42 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> Problem confirmed with current development branch.
>> 
>> gdb tells me it's picking up the operator+= defined at
>> Eigen/src/Core/CwiseBinaryOp.h:232:
>> 
>> template<typename Derived>
>> template<typename OtherDerived>
>> EIGEN_STRONG_INLINE Derived &
>> MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
>> {
>>  SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>
>> tmp(derived());
>>  tmp = other.derived();
>>  return derived();
>> }
>> 
>> So this is likely a bug in SelfCwiseBinaryOp. That's all I can do for today...
>> 
>> Benoit
>> 
>> 2010/9/5 Gavin Band <gavin.band@xxxxxxxxxxxxx>:
>>> 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" ;
>>> }
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/