Registered Member
|
Hi,
I have a user defined function abs( MatrixBase< D > const& m ) which calculates the column-wise absolute value of the matrix:
Is there a way to overload this function for matrixes and expressions consisting of std::complex<>? In case of a matrix of complex this method should return an expression with complex values not doubles. |
Moderator
|
Not tested, but that should do the job:
If D::Scalar is real, then the cast operation is a no-op. |
Registered Member
|
Hmm, no this is not working. I don't even see CastXpr in eigen. Which Eigen are you referring to. My own is 3.2.2. Maybe this one is to old? |
Moderator
|
right, it is only defined in the devel branch. in the meantime the returned type of cast is:
template<typename NewType> typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, const Derived> >::type |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]