32 #ifdef GRALECONFIG_SUPPORT_INTELIPP
34 #endif // GRALECONFIG_SUPPORT_INTELIPP
39 inline float asinh(
float x)
44 inline double asinh(
double x)
49 inline long double asinh(
long double x)
54 inline float acosh(
float x)
59 inline double acosh(
double x)
64 inline long double acosh(
long double x)
69 inline float atanh(
float x)
74 inline double atanh(
double x)
79 inline long double atanh(
long double x)
85 inline T min(T x, T y)
91 inline T max(T x, T y)
99 return (std::exp(x)-std::exp(-x))/(T)2;
105 return (std::exp(x)+std::exp(-x))/(T)2;
111 return (std::exp(x)-std::exp(-x))/(std::exp(x)+std::exp(-x));
115 #ifndef GRALECONFIG_SUPPORT_INTELIPP
118 inline T CalculateDotProduct(
const T *a,
const T *b,
int num)
121 for (
int i = 0 ; i < num ; i++)
127 inline void CalculateAddProductC(T *pDest,
const T *pSrc, T C,
int num, T *tmpbuf)
129 for (
int i = 0 ; i < num ; i++)
130 pDest[i] = pDest[i] + pSrc[i]*C;
134 inline void CopyVector(T *pDest,
const T *pSrc,
int num)
136 memcpy(pDest, pSrc, num*
sizeof(T));
140 inline void SquareVector(T *pVect,
int num)
142 for (
int i = 0 ; i < num ; i++)
143 pVect[i] *= pVect[i];
147 inline void SquareVector(T *pDest,
const T *pSrc,
int num)
149 for (
int i = 0 ; i < num ; i++)
150 pDest[i] = pSrc[i]*pSrc[i];
153 inline void MultiplyVector(T *pSrcDst,
const T *pSrc,
int num)
155 for (
int i = 0 ; i < num ; i++)
156 pSrcDst[i] *= pSrc[i];
160 inline void MultiplyVector(T *pDst,
const T *pSrc,
const T factor,
int num)
162 for (
int i = 0 ; i < num ; i++)
163 pDst[i] = pSrc[i]*factor;
167 inline void MultiplyVector(T *pSrcDst,
const T factor,
int num)
169 for (
int i = 0 ; i < num ; i++)
170 pSrcDst[i] *= factor;
174 inline void MultiplyVector(T *pDst,
const T *pSrc1,
const T *pSrc2,
int num)
176 for (
int i = 0 ; i < num ; i++)
177 pDst[i] = pSrc1[i]*pSrc2[i];
181 inline void AbsVector(T *pVect,
int num)
183 for (
int i = 0 ; i < num ; i++)
184 pVect[i] = std::abs(pVect[i]);
188 inline void AddVector(T *pSrcDst,
const T *pSrc,
int num)
190 for (
int i = 0 ; i < num ; i++)
191 pSrcDst[i] += pSrc[i];
195 inline void AddVector(T *pSrcDst, T value,
int num)
197 for (
int i = 0 ; i < num ; i++)
202 inline void AddVector(T *pDst,
const T *pSrc1,
const T *pSrc2,
int num)
204 for (
int i = 0 ; i < num ; i++)
205 pDst[i] = pSrc1[i] + pSrc2[i];
209 inline void SubVector(T *pSrcDst,
const T *pSrc,
int num)
211 for (
int i = 0 ; i < num ; i++)
212 pSrcDst[i] -= pSrc[i];
216 inline void SubVector(T *pDst,
const T *pSrc1,
const T *pSrc2,
int num)
218 for (
int i = 0 ; i < num ; i++)
219 pDst[i] = pSrc1[i] - pSrc2[i];
227 inline double CalculateDotProduct(
const double *a,
const double *b,
int num)
230 ippsDotProd_64f(a, b, num, &val);
234 inline void CalculateAddProductC(
double *pDest,
const double *pSrc,
double C,
int num,
double *tmpbuf)
236 ippsMulC_64f(pSrc, C, tmpbuf, num);
237 ippsAdd_64f_I(tmpbuf, pDest, num);
240 inline void CopyVector(
double *pDest,
const double *pSrc,
int num)
242 ippsCopy_64f(pSrc, pDest, num);
245 inline void SquareVector(
double *pVect,
int num)
247 ippsSqr_64f_I(pVect, num);
250 inline void MultiplyVector(
double *pSrcDst,
const double *pSrc,
int num)
252 ippsMul_64f_I(pSrc, pSrcDst, num);
255 inline void MultiplyVector(
double *pSrcDst,
double factor,
int num)
257 ippsMulC_64f_I(factor, pSrcDst, num);
260 inline void AbsVector(
double *pVect,
int num)
262 ippsAbs_64f_I(pVect, num);
265 inline void AddVector(
double *pSrcDst,
const double *pSrc,
int num)
267 ippsAdd_64f_I(pSrc, pSrcDst, num);
270 inline void SubVector(
double *pSrcDst,
const double *pSrc,
int num)
272 ippsSub_64f_I(pSrc, pSrcDst, num);
275 inline void SubVector(
double *pDst,
const double *pSrc1,
const double *pSrc2,
int num)
277 ippsSub_64f(pSrc2, pSrc1, pDst, num);
282 inline float CalculateDotProduct(
const float *a,
const float *b,
int num)
285 ippsDotProd_32f(a, b, num, &val);
289 inline void CalculateAddProductC(
float *pDest,
const float *pSrc,
float C,
int num,
float *tmpbuf)
291 ippsMulC_32f(pSrc, C, tmpbuf, num);
292 ippsAdd_32f_I(tmpbuf, pDest, num);
295 inline void CopyVector(
float *pDest,
const float *pSrc,
int num)
297 ippsCopy_32f(pSrc, pDest, num);
300 inline void SquareVector(
float *pVect,
int num)
302 ippsSqr_32f_I(pVect, num);
305 inline void SquareVector(
float *pDst,
const float *pSrc,
int num)
307 ippsSqr_32f(pSrc, pDst, num);
310 inline void MultiplyVector(
float *pSrcDst,
const float *pSrc,
int num)
312 ippsMul_32f_I(pSrc, pSrcDst, num);
315 inline void MultiplyVector(
float *pDst,
const float *pSrc,
float factor,
int num)
317 ippsMulC_32f(pSrc, factor, pDst, num);
320 inline void MultiplyVector(
float *pDst,
const float *pSrc1,
const float *pSrc2,
int num)
322 ippsMul_32f(pSrc1, pSrc2, pDst, num);
325 inline void AbsVector(
float *pVect,
int num)
327 ippsAbs_32f_I(pVect, num);
330 inline void AddVector(
float *pSrcDst,
const float *pSrc,
int num)
332 ippsAdd_32f_I(pSrc, pSrcDst, num);
335 inline void AddVector(
float *pDst,
const float *pSrc1,
const float *pSrc2,
int num)
337 ippsAdd_32f(pSrc1, pSrc2, pDst, num);
340 inline void AddVector(
float *pSrcDst,
float value,
int num)
342 ippsAddC_32f_I(value, pSrcDst, num);
345 inline void SubVector(
float *pSrcDst,
const float *pSrc,
int num)
347 ippsSub_32f_I(pSrc, pSrcDst, num);
350 inline void SubVector(
float *pDst,
const float *pSrc1,
const float *pSrc2,
int num)
352 ippsSub_32f(pSrc2, pSrc1, pDst, num);
355 inline void MultiplyVector(
float *pSrcDst,
float factor,
int num)
357 ippsMulC_32f_I(factor, pSrcDst, num);
360 #endif // !GRALECONFIG_SUPPORT_INTELIPP
365 #define ABS(x) std::abs(x)
366 #define SQRT(x) std::sqrt(x)
367 #define COS(x) std::cos(x)
368 #define SIN(x) std::sin(x)
369 #define TAN(x) std::tan(x)
370 #define ACOS(x) std::acos(x)
371 #define ASIN(x) std::asin(x)
372 #define ATAN(x) std::atan(x)
373 #define LN(x) std::log(x)
374 #define ASINH(x) grale::asinh(x)
375 #define ACOSH(x) grale::acosh(x)
376 #define ATANH(x) grale::atanh(x)
377 #define POW(x,y) std::pow(x,y)
378 #define EXP(x) std::exp(x)
379 #define SINH(x) std::sinh(x)
380 #define COSH(x) std::cosh(x)
381 #define TANH(x) std::tanh(x)
384 #define MIN(x,y) grale::min(x,y)
385 #define MAX(x,y) grale::max(x,y)
387 #define MIN(x,y) (((x)<(y))?(x):(y))
388 #define MAX(x,y) (((x)>(y))?(x):(y))