aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-07-25 11:18:04 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-07-25 11:18:04 +0200
commite1c7c5968a2605eb30b864001e759a8c36beeb8e (patch)
tree1c3cf626754df89fa703577507de770be3e37a51 /doc
parent8fffc81606b2ab1ec1be8a8fd8335a15f79ee4ec (diff)
Update doc.
Diffstat (limited to 'doc')
-rw-r--r--doc/CustomizingEigen.dox42
1 files changed, 18 insertions, 24 deletions
diff --git a/doc/CustomizingEigen.dox b/doc/CustomizingEigen.dox
index 607f86658..1b15c69a4 100644
--- a/doc/CustomizingEigen.dox
+++ b/doc/CustomizingEigen.dox
@@ -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; }
};