Error mixing types with Eigen matrices

So the way to fix this which took me an annoyingly long time to find is to use the derived cast method described here. Now the definition is this:

internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typenameinternal::traits<Derived>::Scalar, NewType>, const Derived> >::type cast() const

Which Ill admit, phased me a little. But turns out it is pretty easy (and the only explanation I could find was in the Eigen 2.0 doc which was frustrating). All you need to do is this:

m2 = m1.cast<float>();

Problem solved.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)