mirror of https://github.com/CGAL/cgal
Eigen::NumTraits<CGAL::Mpzf>
This commit is contained in:
parent
a6adfebc54
commit
9935a6889a
|
|
@ -883,6 +883,7 @@ struct Mpzf {
|
|||
Mpzf& operator+=(Mpzf const&x){ *this=*this+x; return *this; }
|
||||
Mpzf& operator-=(Mpzf const&x){ *this=*this-x; return *this; }
|
||||
Mpzf& operator*=(Mpzf const&x){ *this=*this*x; return *this; }
|
||||
Mpzf& operator/=(Mpzf const&x){ *this=*this/x; return *this; }
|
||||
|
||||
bool is_canonical () const {
|
||||
if (size == 0) return true;
|
||||
|
|
@ -1147,6 +1148,35 @@ CGAL_DEFINE_COERCION_TRAITS_FROM_TO(mpz_class,Mpzf)
|
|||
|
||||
}
|
||||
|
||||
/* There isn't much Eigen can do with such a type,
|
||||
* mostly this is here for IsInteger to protect people.
|
||||
*/
|
||||
namespace Eigen {
|
||||
template<class> struct NumTraits;
|
||||
template<> struct NumTraits<CGAL::Mpzf>
|
||||
{
|
||||
typedef CGAL::Mpzf Real;
|
||||
/* Should this be Quotient<Mpzf>? Gmpq? */
|
||||
typedef CGAL::Mpzf NonInteger;
|
||||
typedef CGAL::Mpzf Nested;
|
||||
|
||||
static inline Real epsilon() { return 0; }
|
||||
static inline Real dummy_precision() { return 0; }
|
||||
|
||||
enum {
|
||||
/* Only exact divisions are supported, close enough to an integer.
|
||||
* This way we get compilation failures instead of runtime. */
|
||||
IsInteger = 1,
|
||||
IsSigned = 1,
|
||||
IsComplex = 0,
|
||||
RequireInitialization = 1,
|
||||
ReadCost = 6,
|
||||
AddCost = 30,
|
||||
MulCost = 50
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue