1 #ifndef FILE_NGSTD_TEMPLATES 2 #define FILE_NGSTD_TEMPLATES 17 return (a < b) ? a : b;
24 return (a > b) ? a : b;
29 INLINE T
min3 (T a, T b, T c)
31 return (a < b) ? (a < c) ? a : c
37 INLINE T
max3 (T a, T b, T c)
40 return (a > b) ? ((a > c) ? a : c)
49 return (a > 0) ? 1 : ( ( a < 0) ? -1 : 0 );
54 INLINE T
sqr (
const T a)
68 void SaveBin (ostream & ost,
const T & val)
70 const char * cp = reinterpret_cast<const char*> (&val);
71 for (
unsigned j = 0; j <
sizeof(T); j++)
77 void LoadBin (istream & ist, T & val)
79 char * cp = reinterpret_cast<char*> (&val);
80 for (
unsigned j = 0; j <
sizeof(T); j++)
94 template <
typename FUNC>
95 static INLINE
void Do (FUNC f)
106 template <
typename FUNC>
107 static INLINE
void Do (FUNC f) { }
114 template <
typename FUNC>
115 static INLINE
void Do (FUNC f) { f(IC<0>()); }
118 template <
int NUM,
typename FUNC>
119 INLINE
void Iterate (FUNC f)
133 template <
typename FUNC>
134 static INLINE
void Do (
size_t nr, FUNC f)
147 template <
typename FUNC>
148 static INLINE
void Do (
size_t nr, FUNC f) { }
155 template <
typename FUNC>
156 static INLINE
void Do (
size_t nr, FUNC f)
163 template <
int NUM,
typename FUNC>
164 INLINE
void Switch (
size_t nr, FUNC f)
INLINE T min3(T a, T b, T c)
min of 3 values
Definition: templates.hpp:29
INLINE T max2(T a, T b)
max of 2 values
Definition: templates.hpp:22
Definition: templates.hpp:130
INLINE T max3(T a, T b, T c)
max of 3 values
Definition: templates.hpp:37
INLINE int sgn(T a)
sign of value (+1, 0, -1)
Definition: templates.hpp:47
INLINE T min2(T a, T b)
min of 2 values
Definition: templates.hpp:15
INLINE AutoDiffVec< D, SCAL > sqr(const AutoDiffVec< D, SCAL > &x)
AutoDiffVec times AutoDiffVec.
Definition: autodiff.hpp:250
Definition: templates.hpp:91
namespace for standard data types and algorithms.
Definition: ngstd.hpp:81
INLINE T pow3(const T a)
element to the third power
Definition: templates.hpp:61