00001
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <math.h>
00015 #include <stdlib.h>
00016
00017
00022
00024
00025 \ingroup CTBnum
00026 */
00027
00028 template <class T>
00029 inline T CTBmin(T v1, T v2)
00030 {
00031 return (v1 < v2) ? v1 : v2;
00032 }
00033
00034
00036
00040 template <class T>
00041 inline T CTBmax(T v1, T v2)
00042 {
00043 return (v2 < v1) ? v1 : v2;
00044 }
00045
00046
00048
00052 template <class T>
00053 inline T CTBabs(T x)
00054 {
00055 return (x >= 0) ? x : -x;
00056 }
00057
00058
00060
00064 inline int CTBabs(int x)
00065 {
00066 return abs(x);
00067 }
00068
00069
00071
00075 inline long CTBabs(long x)
00076 {
00077 return labs(x);
00078 }
00079
00080
00082
00086 inline float CTBabs(float x)
00087 {
00088 return fabs(x);
00089 }
00090
00091
00093
00097 inline double CTBabs(double x)
00098 {
00099 return fabs(x);
00100 }
00101
00102
00104
00108 template <class T>
00109 inline T CTBabsm(T x)
00110 {
00111 return CTBabs(x);
00112 }
00113
00114
00116
00120 template <class T>
00121 inline T CTBabs2(T x)
00122 {
00123 return x*x;
00124 }
00125
00126
00128
00132 template <class T1, class T2>
00133 inline T1 CTBsign(T1 x1, T2 x2)
00134 {
00135 return (x2 >= 0) ? CTBabs(x1) : -CTBabs(x1);
00136 }
00137
00138
00140
00144 template <class T>
00145 inline bool CTBbetween(T x, T a, T b)
00146 {
00147 return (b > a) ? (x >= a && x <= b) : (x >= b && x <= a);
00148 }
00149
00150
00152
00156 template <class T>
00157 inline bool CTBinside(T x, T a, T b)
00158 {
00159 return (b > a) ? (x > a && x < b) : (x > b && x < a);
00160 }
00161
00162
00164
00168 template <class T>
00169 inline T CTBarg(T)
00170 {
00171 return (T) 0;
00172 }
00173
00174
00176
00180 template <class T>
00181 inline T CTBreal(T x)
00182 {
00183 return x;
00184 }
00185
00186
00188
00192 template <class T>
00193 inline T CTBimag(T)
00194 {
00195 return (T) 0;
00196 }
00197
00198
00200
00201 \ingroup CTBnum
00202 */
00203
00204 template <class T>
00205 inline T CTBconj(T x)
00206 {
00207 return x;
00208 }
00209