|
OpenMS
2.6.0
|
Go to the documentation of this file.
39 #include <boost/math/special_functions/gamma.hpp>
67 return (ceil(x / pow(10.0, decPow))) * pow(10.0, decPow);
83 return (floor(0.5 + x / pow(10.0, decPow))) * pow(10.0, decPow);
85 return -((floor(0.5 + fabs(x) / pow(10.0, decPow))) * pow(10.0, decPow));
95 return left2 + (x - left1) * (right2 - left2) / (right1 - left1);
119 return pow(10, x) - 1;
137 template <
typename T>
142 return T(floor(x + T(0.5)));
146 return T(ceil(x - T(0.5)));
157 return std::fabs(a - b) <= tol;
168 template <
typename T>
193 template <
typename T>
194 T
gcd(T a, T b, T & u1, T & u2)
232 template <
typename T>
235 return (mz_obs - mz_ref) / mz_ref * 1e6;
247 template <
typename T>
250 return std::fabs(
getPPM(mz_obs, mz_ref));
262 template <
typename T>
265 return (ppm / 1e6) * mz_ref;
277 template <
typename T>
280 return std::fabs(
ppmToMass(ppm, mz_ref));
296 inline static std::pair<double, double>
getTolWindow(
double val,
double tol,
bool ppm)
302 left = val - val * tol * 1e-6;
303 right = val / (1.0 - tol * 1e-6);
311 return std::make_pair(left, right);
324 return lgamma(
double(x+1));
static bool approximatelyEqual(double a, double b, double tol)
Returns if a is approximately equal b , allowing a tolerance of tol.
Definition: MathFunctions.h:155
bool isOdd(UInt x)
Returns true if the given integer is odd.
Definition: MathFunctions.h:127
static std::pair< double, double > getTolWindow(double val, double tol, bool ppm)
Return tolerance window around val given tolerance tol.
Definition: MathFunctions.h:296
T getPPMAbs(T mz_obs, T mz_ref)
Compute absolute parts-per-million of two m/z values.
Definition: MathFunctions.h:248
double log2linear(double x)
Transforms a number from log10 to to linear scale. Subtracts the 1 added by linear2log(double)
Definition: MathFunctions.h:117
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
T ppmToMassAbs(T ppm, T mz_ref)
Definition: MathFunctions.h:278
static double intervalTransformation(double x, double left1, double right1, double left2, double right2)
transforms point x of interval [left1,right1] into interval [left2,right2]
Definition: MathFunctions.h:93
T getPPM(T mz_obs, T mz_ref)
Compute parts-per-million of two m/z values.
Definition: MathFunctions.h:233
T round(T x)
Rounds the value.
Definition: MathFunctions.h:138
T gcd(T a, T b)
Returns the greatest common divisor (gcd) of two numbers by applying the Euclidean algorithm.
Definition: MathFunctions.h:169
static double ceilDecimal(double x, int decPow)
rounds x up to the next decimal power 10 ^ decPow
Definition: MathFunctions.h:65
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
double linear2log(double x)
Transforms a number from linear to log10 scale. Avoids negative logarithms by adding 1.
Definition: MathFunctions.h:105
T ppmToMass(T ppm, T mz_ref)
Compute the mass diff in [Th], given a ppm value and a reference point.
Definition: MathFunctions.h:263
static double roundDecimal(double x, int decPow)
rounds x to the next decimal power 10 ^ decPow
Definition: MathFunctions.h:80
double factLn(UInt x)
Return the ln(x!) of a value.
Definition: MathFunctions.h:322