This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
View | Details | Raw Unified | Return to bug 34
Collapse All | Expand All

(-)a/Eigen/src/Core/IO.h (-8 / +21 lines)
Lines 120-159 template<typename Derived> Link Here
120
inline const WithFormat<Derived>
120
inline const WithFormat<Derived>
121
DenseBase<Derived>::format(const IOFormat& fmt) const
121
DenseBase<Derived>::format(const IOFormat& fmt) const
122
{
122
{
123
  return WithFormat<Derived>(derived(), fmt);
123
  return WithFormat<Derived>(derived(), fmt);
124
}
124
}
125
125
126
namespace internal {
126
namespace internal {
127
127
128
template<typename Scalar, bool IsInteger>
128
template< typename Scalar,
129
struct significant_decimals_default_impl
129
          typename NestedScalar = typename nested_value_type<Scalar>::type,
130
          bool IsInteger = NumTraits<Scalar>::IsInteger>
131
struct significant_decimals_default_impl;
132
133
template<typename Scalar>
134
struct significant_decimals_default_impl<Scalar,Scalar,false>
130
{
135
{
131
  typedef typename NumTraits<Scalar>::Real RealScalar;
132
  static inline int run()
136
  static inline int run()
133
  {
137
  {
134
    using std::ceil;
138
    const int digits10 = std::numeric_limits<typename NumTraits<Scalar>::Real>::digits10;
135
    using std::log;
139
    return digits10==0 ? 0 : digits10+1;
136
    return cast<RealScalar,int>(ceil(-log(NumTraits<RealScalar>::epsilon())/log(RealScalar(10))));
137
  }
140
  }
138
};
141
};
139
142
140
template<typename Scalar>
143
template<typename Scalar>
141
struct significant_decimals_default_impl<Scalar, true>
144
struct significant_decimals_default_impl<Scalar, Scalar, true>
142
{
145
{
143
  static inline int run()
146
  static inline int run()
144
  {
147
  {
145
    return 0;
148
    return 0;
146
  }
149
  }
147
};
150
};
148
151
152
template<typename Scalar, typename NestedScalar, bool IsInteger>
153
struct significant_decimals_default_impl
154
{
155
  static inline int run()
156
  {
157
    return significant_decimals_default_impl<NestedScalar>::run();
158
  }
159
};
160
161
149
template<typename Scalar>
162
template<typename Scalar>
150
struct significant_decimals_impl
163
struct significant_decimals_impl
151
  : significant_decimals_default_impl<Scalar, NumTraits<Scalar>::IsInteger>
164
  : significant_decimals_default_impl<Scalar>
152
{};
165
{};
153
166
154
/** \internal
167
/** \internal
155
  * print the matrix \a _m to the output stream \a s using the output format \a fmt */
168
  * print the matrix \a _m to the output stream \a s using the output format \a fmt */
156
template<typename Derived>
169
template<typename Derived>
157
std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt)
170
std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt)
158
{
171
{
159
  if(_m.size() == 0)
172
  if(_m.size() == 0)
(-)a/Eigen/src/Core/util/Meta.h (+8 lines)
Lines 111-126 struct is_convertible Link Here
111
/** \internal Allows to enable/disable an overload
111
/** \internal Allows to enable/disable an overload
112
  * according to a compile time condition.
112
  * according to a compile time condition.
113
  */
113
  */
114
template<bool Condition, typename T> struct enable_if;
114
template<bool Condition, typename T> struct enable_if;
115
115
116
template<typename T> struct enable_if<true,T>
116
template<typename T> struct enable_if<true,T>
117
{ typedef T type; };
117
{ typedef T type; };
118
118
119
/** \internal Allows to enable/disable an overload
120
  * according to the existance of type T.
121
  *
122
  * See nested_value_type_impl for an example.
123
  */
124
template<typename T>
125
struct enable_if_type { typedef void type; };
126
119
#if defined(__CUDA_ARCH__)
127
#if defined(__CUDA_ARCH__)
120
#if !defined(__FLT_EPSILON__)
128
#if !defined(__FLT_EPSILON__)
121
#define __FLT_EPSILON__ FLT_EPSILON
129
#define __FLT_EPSILON__ FLT_EPSILON
122
#define __DBL_EPSILON__ DBL_EPSILON
130
#define __DBL_EPSILON__ DBL_EPSILON
123
#endif
131
#endif
124
132
125
namespace device {
133
namespace device {
126
134
(-)a/Eigen/src/Core/util/XprHelper.h (+19 lines)
Lines 656-671 bool is_same_dense(const T1 &, const T2 Link Here
656
  return false;
656
  return false;
657
}
657
}
658
658
659
template<typename T, typename U> struct is_same_or_void { enum { value = is_same<T,U>::value }; };
659
template<typename T, typename U> struct is_same_or_void { enum { value = is_same<T,U>::value }; };
660
template<typename T> struct is_same_or_void<void,T>     { enum { value = 1 }; };
660
template<typename T> struct is_same_or_void<void,T>     { enum { value = 1 }; };
661
template<typename T> struct is_same_or_void<T,void>     { enum { value = 1 }; };
661
template<typename T> struct is_same_or_void<T,void>     { enum { value = 1 }; };
662
template<>           struct is_same_or_void<void,void>  { enum { value = 1 }; };
662
template<>           struct is_same_or_void<void,void>  { enum { value = 1 }; };
663
663
664
template<typename T, typename R=void>
665
struct nested_value_type_impl {
666
  typedef T type;
667
};
668
669
template<typename T>
670
struct nested_value_type_impl<T,typename enable_if_type<typename T::value_type>::type> {
671
  typedef typename T::value_type type;
672
};
673
674
/** \internal nested_value_type returns the value/scalar type of a container/array/matrix/complex/etc.
675
  *           if the type T exposes the value_type typedef, or itself otherwise.
676
  *
677
  * This helper permits to recursively found the most primitive value type of a complex type.
678
  */
679
template<typename T> struct nested_value_type {
680
  typedef typename nested_value_type_impl<T>::type type;
681
};
682
664
} // end namespace internal
683
} // end namespace internal
665
684
666
// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor
685
// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor
667
// that would take two operands of different types. If there were such an example, then this check should be
686
// that would take two operands of different types. If there were such an example, then this check should be
668
// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as
687
// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as
669
// currently they take only one typename Scalar template parameter.
688
// currently they take only one typename Scalar template parameter.
670
// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths.
689
// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths.
671
// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to
690
// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to
(-)a/unsupported/Eigen/MPRealSupport (+9 lines)
Lines 91-106 int main() Link Here
91
    {
91
    {
92
      mpfr_prec_t weak_prec = ((mpfr::mpreal::get_default_prec()-1) * 90) / 100;
92
      mpfr_prec_t weak_prec = ((mpfr::mpreal::get_default_prec()-1) * 90) / 100;
93
      return mpfr::machine_epsilon(weak_prec);
93
      return mpfr::machine_epsilon(weak_prec);
94
    }
94
    }
95
  };
95
  };
96
96
97
  namespace internal {
97
  namespace internal {
98
98
99
  template<>
100
  struct significant_decimals_impl<mpfr::mpreal>
101
  {
102
    static inline int run()
103
    {
104
      return mpfr::bits2digits( mpfr::mpreal::get_default_prec() ) + 1;
105
    }
106
  };
107
99
  template<> inline mpfr::mpreal random<mpfr::mpreal>()
108
  template<> inline mpfr::mpreal random<mpfr::mpreal>()
100
  {
109
  {
101
    return mpfr::random();
110
    return mpfr::random();
102
  }
111
  }
103
112
104
  template<> inline mpfr::mpreal random<mpfr::mpreal>(const mpfr::mpreal& a, const mpfr::mpreal& b)
113
  template<> inline mpfr::mpreal random<mpfr::mpreal>(const mpfr::mpreal& a, const mpfr::mpreal& b)
105
  {
114
  {
106
    return a + (b-a) * random<mpfr::mpreal>();
115
    return a + (b-a) * random<mpfr::mpreal>();

Return to bug 34