Re: [eigen] Performing colwise norm() and squaredNorm()

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


This should compile. I confirm it errors out. This is a bug. Can you
please file a bug so we don't forget about it.

Indeed, squaredNorm() should return an expression with the RealScalar type.

meanwhile you can work around this bug by adding .real()

Benoit

2010/5/22 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
> Hi,
>
>   In the following program, I try to compute the squaredNorm of each column
> of a complex-double matrix. The result should be a vector of doubles which
> should be assignable to a vector of doubles. It seems Eigen sets the type of
> the temporary to be complex-double and indicates that I am illegally mixing
> different types. Is this by design?
>
>
>
> int main(void)
> {
>        int const N = 5;
>        MatrixXcd M(N,N);
>        M.setRandom();
>        VectorXd v(N);
>        v.setZero();
>        v += M.colwise().squaredNorm(); // <-- ERROR: mixing types
>        // also with norm()
>        return 0;
> }
>
>
> Thanks,
> Manoj
>
>
>



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