|
GGEMS
1.1
GPU GEant4-based Monte Carlo Simulations
|
Go to the documentation of this file. 1 #ifndef GUARD_GGEMS_MATHS_GGEMSMATHALGORITHMS_HH
2 #define GUARD_GGEMS_MATHS_GGEMSMATHALGORITHMS_HH
46 #ifdef __OPENCL_C_VERSION__
52 GGint max = size - 1, mid = 0;
53 GGint min_check = min;
57 mid = (min + max) >> 1;
58 if (key == array[mid + offset]) {
61 else if (key > array[mid + offset]) {
70 if (min > min_check) min--;
91 if (xa > xb)
return yb;
92 if (xa >= x)
return ya;
93 if (xb <= x)
return yb;
95 return ya + (x - xa)*(yb - ya)/(xb - xa);
110 if (x < x0)
return y0;
111 if (x > x1)
return y1;
115 #ifdef __OPENCL_C_VERSION__
116 return pow(10.0f, log10(y0) + log10(y1/y0) * (log10(x*x0) / log10(x1*x0)));
118 return std::pow(10.0f, std::log10(y0) + std::log10(y1/y0) * (std::log10(x*x0) / std::log10(x1*x0)));
122 #endif // GUARD_GGEMS_MATHS_GGEMSMATHALGORITHMS_HH
GGfloat LinearInterpolation(GGfloat const xa, GGfloat const ya, GGfloat const xb, GGfloat const yb, GGfloat const x)
interpolate the x value between point A and B
GGint BinarySearchLeft(GGfloat const key, GGfloat const *array, GGint const size, GGint const offset, GGint min)
Find the index of the key value in the p_array buffer.
GGfloat LogLogInterpolation(GGfloat x, GGfloat x0, GGfloat y0, GGfloat x1, GGfloat y1)
log log interpolation of the x value between point (x0,y0) and (x1,y1)
Namespace storing all the usefull physical units.