Re: [eigen] new types / NumTraits

[ Thread Index | Date Index | More Archives ]

We should probably add this to the documentation (and perhaps consider not putting it into the internal namespace).

Shouldn't that be part of NumTrait? There already  epsilon().

sorry I replied to Christoph before getting email synced. I think the same, but I've just realised that this might break compilation even if stream output is never called.
However, there are likely other functions which fail if you can't convert your type to int.

If you want to implement a cast from your type to int, but can't add an operator to your class, you can specialize this struct (in Eigen::internal):

   template<typename OldType, typename NewType>  struct cast_impl;

See the last line of your error to locate the default implementation.

Hmm, I find this a little bit scary as I'm not sure how to map types to int in general,
so might implement it differently as expected by Eigen.
I'll have to check what Eigen does with complex numbers, I just couldn't nail it down in a
first fast search. Is there some documentation where these casts to int are needed?

this is the only place where casting to int is required. For complex<Real>, epsilon returns a Real, so no big deal.


Mail converted by MHonArc 2.6.19+