mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-22 09:39:34 +08:00
Update doc.
This commit is contained in:
parent
8fffc81606
commit
e1c7c5968a
@ -75,7 +75,8 @@ struct default_digits10_impl<T,false,true> // Integer
|
||||
* \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned.
|
||||
* \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must
|
||||
* be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise.
|
||||
* \li An epsilon() function which, unlike std::numeric_limits::epsilon(), returns a \a Real instead of a \a T.
|
||||
* \li An epsilon() function which, unlike <a href="http://en.cppreference.com/w/cpp/types/numeric_limits/epsilon">std::numeric_limits::epsilon()</a>,
|
||||
* it returns a \a Real instead of a \a T.
|
||||
* \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default
|
||||
* value by the fuzzy comparison operators.
|
||||
* \li highest() and lowest() functions returning the highest and lowest possible values respectively.
|
||||
|
@ -165,8 +165,7 @@ This other example adds support for the \c mpq_class type from <a href="https://
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
namespace Eigen {
|
||||
template<class> struct NumTraits;
|
||||
template<> struct NumTraits<mpq_class>
|
||||
template<> struct NumTraits<mpq_class> : GenericNumTraits<mpq_class>
|
||||
{
|
||||
typedef mpq_class Real;
|
||||
typedef mpq_class NonInteger;
|
||||
@ -174,6 +173,7 @@ namespace Eigen {
|
||||
|
||||
static inline Real epsilon() { return 0; }
|
||||
static inline Real dummy_precision() { return 0; }
|
||||
static inline Real digits10() { return 0; }
|
||||
|
||||
enum {
|
||||
IsInteger = 0,
|
||||
@ -187,31 +187,25 @@ namespace Eigen {
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
template<>
|
||||
struct significant_decimals_impl<mpq_class>
|
||||
{
|
||||
// Infinite precision when printing
|
||||
static inline int run() { return 0; }
|
||||
};
|
||||
|
||||
template<> struct scalar_score_coeff_op<mpq_class> {
|
||||
struct result_type : boost::totally_ordered1<result_type> {
|
||||
std::size_t len;
|
||||
result_type(int i = 0) : len(i) {} // Eigen uses Score(0) and Score()
|
||||
result_type(mpq_class const& q) :
|
||||
len(mpz_size(q.get_num_mpz_t())+
|
||||
mpz_size(q.get_den_mpz_t())-1) {}
|
||||
friend bool operator<(result_type x, result_type y) {
|
||||
// 0 is the worst possible pivot
|
||||
if (x.len == 0) return y.len > 0;
|
||||
if (y.len == 0) return false;
|
||||
// Prefer a pivot with a small representation
|
||||
return x.len > y.len;
|
||||
}
|
||||
friend bool operator==(result_type x, result_type y) {
|
||||
// Only used to test if the score is 0
|
||||
return x.len == y.len;
|
||||
}
|
||||
std::size_t len;
|
||||
result_type(int i = 0) : len(i) {} // Eigen uses Score(0) and Score()
|
||||
result_type(mpq_class const& q) :
|
||||
len(mpz_size(q.get_num_mpz_t())+
|
||||
mpz_size(q.get_den_mpz_t())-1) {}
|
||||
friend bool operator<(result_type x, result_type y) {
|
||||
// 0 is the worst possible pivot
|
||||
if (x.len == 0) return y.len > 0;
|
||||
if (y.len == 0) return false;
|
||||
// Prefer a pivot with a small representation
|
||||
return x.len > y.len;
|
||||
}
|
||||
friend bool operator==(result_type x, result_type y) {
|
||||
// Only used to test if the score is 0
|
||||
return x.len == y.len;
|
||||
}
|
||||
};
|
||||
result_type operator()(mpq_class const& x) const { return x; }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user