33 #ifndef NUMBER_UTIL_H_
34 #define NUMBER_UTIL_H_
41 const double tooBigValue = 1e30;
42 if(d > tooBigValue || d < -tooBigValue || std::isfinite(d) ==
false)
50 if(d > -1e-100 && d < +1e-100)
62 template <std::
size_t N, std::
size_t M,
typename T>
71 template <std::
size_t N,
typename T>
74 for(
size_t r=0; r<m.
size(); r++)
81 template <
size_t TRank,
size_t N,
typename T>
84 for(
size_t i=0; i<t.
size(); i++)
91 template<
typename TData,
size_t N>
94 for(
size_t i=0; i<t.
size(); i++)
100 template<
typename TData>
103 for(
size_t i=0; i<t.size(); i++)
112 for(
size_t i=0; i<t.size(); i++)
123 size_t iFirst, iCount=0;
124 for(
size_t i=0; i<t.size(); i++)
127 if(iCount == 0) iFirst = i;
133 UG_LOG(
"WARNING in " << callerName <<
": " << iFirst <<
" nan or too big (" << t[iFirst] <<
"). ");
135 {
UG_LOG(iCount-1 <<
" more.");}
147 size_t iFirst, iCount=0;
148 for(
size_t i=0; i<t.size(); i++)
151 if(iCount == 0) iFirst = i;
157 UG_THROW(
"In " << callerName <<
": " << iFirst <<
" nan or too big (" << t[iFirst] <<
"). "
158 << iCount-1 <<
" more.");
A class for fixed size, dense matrices.
Definition: math_matrix.h:52
std::size_t num_cols() const
Definition: math_matrix.h:216
std::size_t num_rows() const
Definition: math_matrix.h:215
a mathematical Tensor of rank TRank and N entries.
Definition: math_tensor.h:56
size_t size() const
Definition: math_tensor.h:81
Definition: math_tensor.h:160
size_t size() const
Definition: math_tensor.h:185
a mathematical Vector with N entries.
Definition: math_vector.h:97
std::size_t size() const
Definition: math_vector.h:139
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
bool g_bNoNANCheck
Definition: number_util.cpp:36
bool WarnIfIsVectorNanOrTooBig(const T &t, const char *callerName)
Definition: number_util.h:120
bool CloseToZero(double d)
Definition: number_util.h:48
bool IsFiniteAndNotTooBig(double d)
Definition: number_util.h:39
bool ThrowIfIsVectorNanOrTooBig(const T &t, const char *callerName)
Definition: number_util.h:144
bool IsVectorFiniteAndNotTooBig(const T &t)
Definition: number_util.h:110