5 #ifndef BPP_NUMERIC_NUMTOOLS_H 6 #define BPP_NUMERIC_NUMTOOLS_H 14 template<
class Scalar>
class RowMatrix;
31 template<
class T>
static T
abs(T a) {
return a < 0 ? -a : a; }
42 template<
class T>
static T
sign(T a) {
return a < 0 ? -1 : (a == 0 ? 0 : 1); }
53 template<
class T>
static T
max(T a, T b) {
return a > b ? a : b; }
64 template<
class T>
static T
min(T a, T b) {
return a < b ? a : b; }
73 template<
class T>
static T
sign(T a, T b) {
return abs<T>(a) * sign<T>(b); }
81 template<
class T>
static T
sqr(T a) {
return a * a; }
96 template<
class T>
static T
logsum(T lnx, T lny)
99 lnx + std::log(1. + exp(lny - lnx)) :
100 lny + std::log(1. + exp(lnx - lny));
105 template<
class T>
static void swap(T& a, T& b)
112 template<
class T>
static void shift(T& a, T& b, T c)
117 template<
class T>
static void shift(T& a, T& b, T& c, T d)
124 template<
class T>
static T
fact(T n) {
return (n == 0) ? 1 : n*
fact(n - 1); }
128 template<
class T>
static T
logFact(T n) {
return (n == 0) ? 0 : (std::log(n) +
logFact(n - 1)); }
168 #endif // BPP_NUMERIC_NUMTOOLS_H
This is the function abstract class.
The parameter list object.
This is the abstract class for second order derivable functions.