3 #ifndef CH_MATRIX_CLASSES_MYMATH_HXX 4 #define CH_MATRIX_CLASSES_MYMATH_HXX 25 inline double abs(
double d)
37 inline long abs(
long d)
43 inline double max(
double a,
double b)
49 inline double min(
double a,
double b)
55 inline int max(
int a,
int b)
61 inline int min(
int a,
int b)
67 inline long max(
long a,
long b)
73 inline long min(
long a,
long b)
79 inline void swap(
double& a,
double& b)
85 inline void swap(
long& a,
long& b)
91 inline void swap(
int& a,
int& b)
97 inline void swap(
bool& a,
bool& b)
115 inline double sqr(
double a)
151 return (a>=0)?1.:-1.;
155 inline double sign(
double a,
double tol)
157 if (a>tol)
return 1.;
158 if (a<-tol)
return -1.;
167 return (((b>=0)&&(a>=0))||((b<0)&&(a<0)))?a:-a;
double sqrt(long a)
return sqrt for long a
Definition: mymath.hxx:127
void swap(double &a, double &b)
swaps two double variables
Definition: mymath.hxx:79
long abs(long d)
absolute value of a long
Definition: mymath.hxx:37
int sign(int a)
return the signum of an int a (1 for a>0,-1 for a<0,0 for a==0)
Definition: mymath.hxx:133
Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick intro...
Definition: PSCOracle.hxx:20
int sqr(int a)
return a*a for int a
Definition: mymath.hxx:103
double max(double a, double b)
maximum value of two double variables
Definition: mymath.hxx:43
double min(double a, double b)
minimum value of two double variables
Definition: mymath.hxx:49
double abs(double d)
absolute value of a double
Definition: mymath.hxx:25
double d_sign(double a, double b)
return a if a and b have the same sign, return -a otherwise
Definition: mymath.hxx:165
double sqrt(int a)
return sqrt for int a
Definition: mymath.hxx:121