10 #ifndef EIGEN_NUMTRAITS_H
11 #define EIGEN_NUMTRAITS_H
22 bool use_numeric_limits = std::numeric_limits<T>::is_specialized,
24 struct default_digits10_impl
27 static int run() {
return std::numeric_limits<T>::digits10; }
31 struct default_digits10_impl<
T,false,false>
38 return int(
ceil(-
log10(NumTraits<Real>::epsilon())));
43 struct default_digits10_impl<
T,false,true>
46 static int run() {
return 0; }
53 bool use_numeric_limits = std::numeric_limits<T>::is_specialized,
55 struct default_digits_impl
58 static int run() {
return std::numeric_limits<T>::digits; }
62 struct default_digits_impl<
T,false,false>
69 return int(
ceil(-
log2(NumTraits<Real>::epsilon())));
74 struct default_digits_impl<
T,false,true>
77 static int run() {
return 0; }
86 template <
typename Tgt,
typename Src>
90 EIGEN_STATIC_ASSERT(std::is_trivially_copyable<Tgt>::value && std::is_default_constructible<Tgt>::value,
91 THIS_TYPE_IS_NOT_SUPPORTED);
96 const Src staged = src;
98 memcpy(
static_cast<void*
>(&tgt),
static_cast<const void*
>(&staged),
sizeof(Tgt));
167 typedef std::conditional_t<
IsInteger, std::conditional_t<
sizeof(
T)<=2,
float,
double>,
T> NonInteger;
172 static inline Real epsilon()
174 return numext::numeric_limits<T>::epsilon();
178 static inline int digits10()
180 return internal::default_digits10_impl<T>::run();
184 static inline int digits()
186 return internal::default_digits_impl<T>::run();
190 static inline int min_exponent()
192 return numext::numeric_limits<T>::min_exponent;
196 static inline int max_exponent()
198 return numext::numeric_limits<T>::max_exponent;
202 static inline Real dummy_precision()
209 static inline T highest() {
214 static inline T lowest() {
216 : static_cast<
T>(-(numext::numeric_limits<
T>::
max)());
220 static inline T infinity() {
221 return numext::numeric_limits<T>::infinity();
225 static inline T quiet_NaN() {
226 return numext::numeric_limits<T>::quiet_NaN();
247 #ifndef EIGEN_GPU_COMPILE_PHASE
252 static inline long double dummy_precision() {
return static_cast<long double>(1e-15l); }
254 #if defined(EIGEN_ARCH_PPC) && (__LDBL_MANT_DIG__ == 106)
257 static inline long double epsilon()
260 return static_cast<long double>(2.4651903288156618919116517665087e-32l);
287 template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
const CeilReturnType ceil() const
const Log2ReturnType log2() const
const Log10ReturnType log10() const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define EIGEN_USING_STD(FUNC)
#define EIGEN_DEVICE_FUNC
#define EIGEN_STATIC_ASSERT(X, MSG)
Eigen::Triplet< double > T
General-purpose arrays with easy API for coefficient-wise operations.
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Tgt bit_cast(const Src &src)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_log10_op< typename Derived::Scalar >, const Derived > log10(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_ceil_op< typename Derived::Scalar >, const Derived > ceil(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_log2_op< typename Derived::Scalar >, const Derived > log2(const Eigen::ArrayBase< Derived > &x)
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Literal Literal
static EIGEN_CONSTEXPR RealScalar dummy_precision()
NumTraits< Scalar >::NonInteger NonIntegerScalar
Array< RealScalar, Rows, Cols, Options, MaxRows, MaxCols > Real
Array< Scalar, Rows, Cols, Options, MaxRows, MaxCols > ArrayType
static EIGEN_CONSTEXPR int digits10()
static EIGEN_CONSTEXPR RealScalar epsilon()
Array< NonIntegerScalar, Rows, Cols, Options, MaxRows, MaxCols > NonInteger
static EIGEN_CONSTEXPR double dummy_precision()
static EIGEN_CONSTEXPR float dummy_precision()
static EIGEN_CONSTEXPR long double dummy_precision()
static EIGEN_CONSTEXPR Real epsilon()
static EIGEN_CONSTEXPR Real dummy_precision()
NumTraits< Real_ >::Literal Literal
static EIGEN_CONSTEXPR int digits10()
static std::string infinity()
static std::string quiet_NaN()
static EIGEN_CONSTEXPR int digits10()
static std::string dummy_precision()
static std::string epsilon()
static std::string highest()
static std::string lowest()
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.