OpenMS  2.8.0
Classes | Namespaces | Functions
MathFunctions.h File Reference
#include <OpenMS/CONCEPT/Types.h>
#include <OpenMS/CONCEPT/Exception.h>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
#include <cmath>
#include <utility>
Include dependency graph for MathFunctions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RandomShuffler
 

Namespaces

 OpenMS
 Main OpenMS namespace.
 
 OpenMS::Math
 Math namespace.
 

Functions

template<typename T >
bool extendRange (T &min, T &max, const T &value)
 Given an interval/range and a new value, extend the range to include the new value if needed. More...
 
static double ceilDecimal (double x, int decPow)
 rounds x up to the next decimal power 10 ^ decPow More...
 
static double roundDecimal (double x, int decPow)
 rounds x to the next decimal power 10 ^ decPow More...
 
static double intervalTransformation (double x, double left1, double right1, double left2, double right2)
 transforms point x of interval [left1,right1] into interval [left2,right2] More...
 
double linear2log (double x)
 Transforms a number from linear to log10 scale. Avoids negative logarithms by adding 1. More...
 
double log2linear (double x)
 Transforms a number from log10 to to linear scale. Subtracts the 1 added by linear2log(double) More...
 
bool isOdd (UInt x)
 Returns true if the given integer is odd. More...
 
template<typename T >
round (T x)
 Rounds the value. More...
 
static bool approximatelyEqual (double a, double b, double tol)
 Returns if a is approximately equal b , allowing a tolerance of tol. More...
 
template<typename T >
gcd (T a, T b)
 Returns the greatest common divisor (gcd) of two numbers by applying the Euclidean algorithm. More...
 
template<typename T >
gcd (T a, T b, T &u1, T &u2)
 Returns the greatest common divisor by applying the extended Euclidean algorithm (Knuth TAoCP vol. 2, p342). Calculates u1, u2 and u3 (which is returned) so that a * u1 + b * u2 = u3 = gcd(a, b, u1, u2) More...
 
template<typename T >
getPPM (T mz_obs, T mz_ref)
 Compute parts-per-million of two m/z values. More...
 
template<typename T >
getPPMAbs (T mz_obs, T mz_ref)
 Compute absolute parts-per-million of two m/z values. More...
 
template<typename T >
ppmToMass (T ppm, T mz_ref)
 Compute the mass diff in [Th], given a ppm value and a reference point. More...
 
template<typename T >
ppmToMassAbs (T ppm, T mz_ref)
 
static std::pair< double, double > getTolWindow (double val, double tol, bool ppm)
 Return tolerance window around val given tolerance tol. More...
 
template<typename T1 >
T1::value_type quantile (const T1 &x, double q)
 Returns the value of the q th quantile (0-1) in a sorted non-empty vector x. More...