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

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


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/