35inline doublereal
dot4(
const V& x,
const V& y)
37 return x[0]*y[0] + x[1]*y[1] + x[2]*y[2] + x[3]*y[3];
50inline doublereal
dot5(
const V& x,
const V& y)
52 return x[0]*y[0] + x[1]*y[1] + x[2]*y[2] + x[3]*y[3] +
76template<
class InputIter,
class InputIter2>
77inline doublereal
dot(InputIter x_begin, InputIter x_end,
80 return std::inner_product(x_begin, x_end, y_begin, 0.0);
99template<
class InputIter,
class OutputIter,
class S>
100inline void scale(InputIter begin, InputIter end,
101 OutputIter out, S scale_factor)
103 std::transform(begin, end, out,
104 [scale_factor](
double x) {
return x * scale_factor; });
112template<
class D,
class R>
115 return ((((((c[6]*x + c[5])*x + c[4])*x + c[3])*x +
116 c[2])*x + c[1])*x + c[0]);
124template<
class D,
class R>
127 return ((((((((c[8]*x + c[7])*x + c[6])*x + c[5])*x + c[4])*x + c[3])*x +
128 c[2])*x + c[1])*x + c[0]);
136template<
class D,
class R>
139 return (((((c[5]*x + c[4])*x + c[3])*x +
140 c[2])*x + c[1])*x + c[0]);
148template<
class D,
class R>
151 return ((((c[4]*x + c[3])*x +
152 c[2])*x + c[1])*x + c[0]);
160template<
class D,
class R>
163 return (((c[3]*x + c[2])*x + c[1])*x + c[0]);
176void checkFinite(
const std::string& name,
double* values,
size_t N);
183template <
class T,
class U>
184const U&
getValue(
const std::map<T, U>& m,
const T& key,
const U& default_val) {
185 typename std::map<T,U>::const_iterator iter = m.find(key);
186 return (iter == m.end()) ? default_val : iter->second;
193#define CT_DEFINE_HAS_MEMBER(detector_name, func_name) \
194 template <typename T> \
195 struct detector_name { \
196 typedef char (& yes)[1], (& no)[2]; \
197 template <typename C> static yes check(decltype(&C::func_name)); \
198 template <typename> static no check(...); \
199 static bool const value = sizeof(check<T>(0)) == sizeof(yes); \
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
void checkFinite(const double tmp)
Check to see that a number is finite (not NaN, +Inf or -Inf)
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
doublereal dot4(const V &x, const V &y)
Templated Inner product of two vectors of length 4.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
R poly5(D x, R *c)
Templated evaluation of a polynomial of order 5.
doublereal dot5(const V &x, const V &y)
Templated Inner product of two vectors of length 5.
R poly8(D x, R *c)
Templated evaluation of a polynomial of order 8.
R poly3(D x, R *c)
Templated evaluation of a polynomial of order 3.
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
R poly6(D x, R *c)
Templated evaluation of a polynomial of order 6.
const U & getValue(const std::map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a std::map.