TMath. More...
Classes | |
| struct | Limits |
Functions | |
| Double_t | Abs (Double_t d) |
| Returns the absolute value of parameter Double_t d. | |
| Float_t | Abs (Float_t d) |
| Returns the absolute value of parameter Float_t d. | |
| Int_t | Abs (Int_t d) |
| Returns the absolute value of parameter Int_t d. | |
| Long64_t | Abs (Long64_t d) |
| Returns the absolute value of parameter Long64_t d. | |
| Long_t | Abs (Long_t d) |
| Returns the absolute value of parameter Long_t d. | |
| LongDouble_t | Abs (LongDouble_t d) |
| Returns the absolute value of parameter LongDouble_t d. | |
| Short_t | Abs (Short_t d) |
| Returns the absolute value of parameter Short_t d. | |
| Double_t | ACos (Double_t) |
| Returns the principal value of the arc cosine of x, expressed in radians. | |
| Double_t | ACosH (Double_t) |
| Returns the nonnegative area hyperbolic cosine of x. | |
| Bool_t | AreEqualAbs (Double_t af, Double_t bf, Double_t epsilon) |
| Comparing floating points. | |
| Bool_t | AreEqualRel (Double_t af, Double_t bf, Double_t relPrec) |
| Comparing floating points. | |
| Double_t | ASin (Double_t) |
| Returns the principal value of the arc sine of x, expressed in radians. | |
| Double_t | ASinH (Double_t) |
| Returns the area hyperbolic sine of x. | |
| Double_t | ATan (Double_t) |
| Returns the principal value of the arc tangent of x, expressed in radians. | |
| Double_t | ATan2 (Double_t y, Double_t x) |
| Returns the principal value of the arc tangent of y/x, expressed in radians. | |
| Double_t | ATanH (Double_t) |
| Returns the area hyperbolic tangent of x. | |
| Double_t | BesselI (Int_t n, Double_t x) |
| Double_t | BesselI0 (Double_t x) |
| Integer order modified Bessel function K_n(x). | |
| Double_t | BesselI1 (Double_t x) |
| Modified Bessel function K_0(x). | |
| Double_t | BesselJ0 (Double_t x) |
| Modified Bessel function K_1(x). | |
| Double_t | BesselJ1 (Double_t x) |
| Bessel function J0(x) for any real x. | |
| Double_t | BesselK (Int_t n, Double_t x) |
| Integer order modified Bessel function I_n(x). | |
| Double_t | BesselK0 (Double_t x) |
| Modified Bessel function I_0(x). | |
| Double_t | BesselK1 (Double_t x) |
| Modified Bessel function I_1(x). | |
| Double_t | BesselY0 (Double_t x) |
| Bessel function J1(x) for any real x. | |
| Double_t | BesselY1 (Double_t x) |
| Bessel function Y0(x) for positive x. | |
| Double_t | Beta (Double_t p, Double_t q) |
| Double_t | BetaCf (Double_t x, Double_t a, Double_t b) |
| Double_t | BetaDist (Double_t x, Double_t p, Double_t q) |
| Double_t | BetaDistI (Double_t x, Double_t p, Double_t q) |
| Double_t | BetaIncomplete (Double_t x, Double_t a, Double_t b) |
| template<typename T> | |
| Long64_t | BinarySearch (Long64_t n, const T **array, T value) |
| Binary search in an array of n values to locate value. | |
| template<typename T> | |
| Long64_t | BinarySearch (Long64_t n, const T *array, T value) |
| Binary search in an array of n values to locate value. | |
| Double_t | Binomial (Int_t n, Int_t k) |
| Double_t | BinomialI (Double_t p, Int_t n, Int_t k) |
| Double_t | BreitWigner (Double_t x, Double_t mean=0, Double_t gamma=1) |
| Calculates a Breit Wigner function with mean and gamma. | |
| Double_t | BreitWignerRelativistic (Double_t x, Double_t median=0, Double_t gamma=1) |
| Calculates a Relativistic Breit Wigner function with median and gamma. | |
| void | BubbleHigh (Int_t Narr, Double_t *arr1, Int_t *arr2) |
| void | BubbleLow (Int_t Narr, Double_t *arr1, Int_t *arr2) |
| constexpr Double_t | C () |
| Velocity of light in \( m s^{-1} \). | |
| Double_t | CauchyDist (Double_t x, Double_t t=0, Double_t s=1) |
| constexpr Double_t | Ccgs () |
| \( cm s^{-1} \) | |
| Double_t | Ceil (Double_t x) |
| Rounds x upward, returning the smallest integral value that is not less than x. | |
| Int_t | CeilNint (Double_t x) |
| Returns the nearest integer of TMath::Ceil(x). | |
| Double_t | ChisquareQuantile (Double_t p, Double_t ndf) |
| Double_t | Cos (Double_t) |
| Returns the cosine of an angle of x radians. | |
| Double_t | CosH (Double_t) |
| Returns the hyperbolic cosine of x. | |
| template<typename T> | |
| T * | Cross (const T v1[3], const T v2[3], T out[3]) |
| Calculates the Cross Product of two vectors: out = [v1 x v2]. | |
| constexpr Double_t | CUncertainty () |
| Speed of light uncertainty. | |
| constexpr Double_t | DegToRad () |
| Conversion from degree to radian: \( \frac{\pi}{180} \). | |
| Double_t | DiLog (Double_t x) |
| Modified Struve functions of order 1. | |
| constexpr Double_t | E () |
| Base of natural log: \( e \). | |
| Double_t | Erf (Double_t x) |
| Computation of the error function erf(x). | |
| Double_t | Erfc (Double_t x) |
| Computes the complementary error function erfc(x). | |
| Double_t | ErfcInverse (Double_t x) |
| Returns the inverse of the complementary error function. | |
| Double_t | ErfInverse (Double_t x) |
| Returns the inverse error function. | |
| constexpr Double_t | EulerGamma () |
| Euler-Mascheroni Constant. | |
| Bool_t | Even (Long_t a) |
| Returns true if a is even. | |
| Double_t | Exp (Double_t x) |
| Returns the base-e exponential function of x, which is e raised to the power x. | |
| Double_t | Factorial (Int_t i) |
| Computes factorial(n). | |
| Double_t | FDist (Double_t F, Double_t N, Double_t M) |
| Double_t | FDistI (Double_t F, Double_t N, Double_t M) |
| Int_t | Finite (Double_t x) |
| Check if it is finite with a mask in order to be consistent in presence of fast math. | |
| Int_t | Finite (Float_t x) |
| Check if it is finite with a mask in order to be consistent in presence of fast math. | |
| Double_t | Floor (Double_t x) |
| Rounds x downward, returning the largest integral value that is not greater than x. | |
| Int_t | FloorNint (Double_t x) |
| Returns the nearest integer of TMath::Floor(x). | |
| Double_t | Freq (Double_t x) |
| Computation of the normal frequency function freq(x). | |
| constexpr Double_t | G () |
| Gravitational constant in: \( m^{3} kg^{-1} s^{-2} \). | |
| Double_t | GamCf (Double_t a, Double_t x) |
| Computation of the incomplete gamma function P(a,x) via its continued fraction representation. | |
| Double_t | Gamma (Double_t a, Double_t x) |
| Computation of the normalized lower incomplete gamma function P(a,x) as defined in the Handbook of Mathematical Functions by Abramowitz and Stegun, formula 6.5.1 on page 260 . | |
| Double_t | Gamma (Double_t z) |
| Computation of gamma(z) for all z. | |
| Double_t | GammaDist (Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1) |
| Double_t | GamSer (Double_t a, Double_t x) |
| Computation of the incomplete gamma function P(a,x) via its series representation. | |
| Double_t | Gaus (Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE) |
| Calculates a gaussian function with mean and sigma. | |
| constexpr Double_t | Gcgs () |
| \( cm^{3} g^{-1} s^{-2} \) | |
| template<typename Iterator> | |
| Double_t | GeomMean (Iterator first, Iterator last) |
| Returns the geometric mean of an array defined by the iterators. | |
| template<typename T> | |
| Double_t | GeomMean (Long64_t n, const T *a) |
| Returns the geometric mean of an array a of size n. | |
| constexpr Double_t | GhbarC () |
| \( \frac{G}{\hbar C} \) in \( (GeV/c^{2})^{-2} \) | |
| constexpr Double_t | GhbarCUncertainty () |
| \( \frac{G}{\hbar C} \) uncertainty. | |
| constexpr Double_t | Gn () |
| Standard acceleration of gravity in \( m s^{-2} \). | |
| constexpr Double_t | GnUncertainty () |
| Standard acceleration of gravity uncertainty. | |
| template<typename T> | |
| T * | Gradient (Long64_t n, T *f, double h=1) |
| Calculate the one-dimensional gradient of an array with length n. | |
| constexpr Double_t | GUncertainty () |
| Gravitational constant uncertainty. | |
| constexpr Double_t | H () |
| Planck's constant in \( J s \): \( h \). | |
| ULong_t | Hash (const char *str) |
| ULong_t | Hash (const void *txt, Int_t ntxt) |
| constexpr Double_t | Hbar () |
| \( \hbar \) in \( J s \): \( \hbar = \frac{h}{2\pi} \) | |
| constexpr Double_t | Hbarcgs () |
| \( erg s \) | |
| constexpr Double_t | HbarUncertainty () |
| \( \hbar \) uncertainty. | |
| constexpr Double_t | HC () |
| \( hc \) in \( J m \) | |
| constexpr Double_t | HCcgs () |
| \( erg cm \) | |
| constexpr Double_t | Hcgs () |
| \( erg s \) | |
| constexpr Double_t | HUncertainty () |
| Planck's constant uncertainty. | |
| Double_t | Hypot (Double_t x, Double_t y) |
| Returns sqrt(x*x + y*y). | |
| Long_t | Hypot (Long_t x, Long_t y) |
| Returns sqrt(x*x + y*y). | |
| Double_t | Infinity () |
| Returns an infinity as defined by the IEEE standard. | |
| constexpr Double_t | InvPi () |
| \( \frac{1.}{\pi}\) | |
| template<typename T> | |
| Bool_t | IsInside (T xp, T yp, Int_t np, T *x, T *y) |
| Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in arrays x and y, kFALSE otherwise. | |
| Bool_t | IsNaN (Double_t x) |
| Bool_t | IsNaN (Float_t x) |
| constexpr Double_t | K () |
| Boltzmann's constant in \( J K^{-1} \): \( k \). | |
| constexpr Double_t | Kcgs () |
| \( erg K^{-1} \) | |
| void | KNNDensity (std::span< const double > observations, std::span< const double > queries, std::span< double > result, int k, double dmin=0.0) |
| Double_t | KolmogorovProb (Double_t z) |
| Double_t | KolmogorovTest (Int_t na, const Double_t *a, Int_t nb, const Double_t *b, Option_t *option) |
| template<class Element, typename Size> | |
| Element | KOrdStat (Size n, const Element *a, Size k, Size *work=0) |
| Returns k_th order statistic of the array a of size n (k_th smallest element out of n elements). | |
| constexpr Double_t | KUncertainty () |
| Boltzmann's constant uncertainty. | |
| Double_t | Landau (Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE) |
| The LANDAU function. | |
| Double_t | LandauI (Double_t x) |
| Double_t | LaplaceDist (Double_t x, Double_t alpha=0, Double_t beta=1) |
| Double_t | LaplaceDistI (Double_t x, Double_t alpha=0, Double_t beta=1) |
| template<typename T> | |
| T * | Laplacian (Long64_t n, T *f, double h=1) |
| Calculate the Laplacian of an array with length n. | |
| Double_t | Ldexp (Double_t x, Int_t exp) |
| Returns the result of multiplying x (the significant) by 2 raised to the power of exp (the exponent). | |
| constexpr Double_t | Ln10 () |
| Natural log of 10 (to convert log to ln). | |
| Double_t | LnGamma (Double_t z) |
| Computation of ln[gamma(z)] for all z. | |
| template<typename Iterator> | |
| Iterator | LocMax (Iterator first, Iterator last) |
| Returns index of array with the maximum element. | |
| template<typename T> | |
| Long64_t | LocMax (Long64_t n, const T *a) |
| Returns index of array with the maximum element. | |
| template<typename Iterator> | |
| Iterator | LocMin (Iterator first, Iterator last) |
| Returns index of array with the minimum element. | |
| template<typename T> | |
| Long64_t | LocMin (Long64_t n, const T *a) |
| Returns index of array with the minimum element. | |
| Double_t | Log (Double_t x) |
| Returns the natural logarithm of x. | |
| Double_t | Log10 (Double_t x) |
| Returns the common (base-10) logarithm of x. | |
| Double_t | Log2 (Double_t x) |
| Returns the binary (base-2) logarithm of x. | |
| constexpr Double_t | LogE () |
| Base-10 log of e (to convert ln to log). | |
| Double_t | LogNormal (Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1) |
| Double_t | Max (Double_t a, Double_t b) |
| Returns the largest of a and b. | |
| Float_t | Max (Float_t a, Float_t b) |
| Returns the largest of a and b. | |
| Int_t | Max (Int_t a, Int_t b) |
| Returns the largest of a and b. | |
| Long64_t | Max (Long64_t a, Long64_t b) |
| Returns the largest of a and b. | |
| Long_t | Max (Long_t a, Long_t b) |
| Returns the largest of a and b. | |
| Short_t | Max (Short_t a, Short_t b) |
| Returns the largest of a and b. | |
| UInt_t | Max (UInt_t a, UInt_t b) |
| Returns the largest of a and b. | |
| ULong64_t | Max (ULong64_t a, ULong64_t b) |
| Returns the largest of a and b. | |
| ULong_t | Max (ULong_t a, ULong_t b) |
| Returns the largest of a and b. | |
| UShort_t | Max (UShort_t a, UShort_t b) |
| Returns the largest of a and b. | |
| template<typename T> | |
| T | MaxElement (Long64_t n, const T *a) |
| Returns maximum of array a of length n. | |
| template<typename Iterator> | |
| Double_t | Mean (Iterator first, Iterator last) |
| Returns the weighted mean of an array defined by the iterators. | |
| template<typename Iterator, typename WeightIterator> | |
| Double_t | Mean (Iterator first, Iterator last, WeightIterator wfirst) |
| Returns the weighted mean of an array defined by the first and last iterators. | |
| template<typename T> | |
| Double_t | Mean (Long64_t n, const T *a, const Double_t *w=nullptr) |
| Returns the weighted mean of an array a with length n. | |
| template<typename T> | |
| Double_t | Median (Long64_t n, const T *a, const Double_t *w=nullptr, Long64_t *work=nullptr) |
| Same as RMS. | |
| Double_t | Min (Double_t a, Double_t b) |
| Returns the smallest of a and b. | |
| Float_t | Min (Float_t a, Float_t b) |
| Returns the smallest of a and b. | |
| Int_t | Min (Int_t a, Int_t b) |
| Returns the smallest of a and b. | |
| Long64_t | Min (Long64_t a, Long64_t b) |
| Returns the smallest of a and b. | |
| Long_t | Min (Long_t a, Long_t b) |
| Returns the smallest of a and b. | |
| Short_t | Min (Short_t a, Short_t b) |
| Returns the smallest of a and b. | |
| UInt_t | Min (UInt_t a, UInt_t b) |
| Returns the smallest of a and b. | |
| ULong64_t | Min (ULong64_t a, ULong64_t b) |
| Returns the smallest of a and b. | |
| ULong_t | Min (ULong_t a, ULong_t b) |
| Returns the smallest of a and b. | |
| UShort_t | Min (UShort_t a, UShort_t b) |
| Returns the smallest of a and b. | |
| template<typename T> | |
| T | MinElement (Long64_t n, const T *a) |
| Returns minimum of array a of length n. | |
| template<typename T> | |
| Double_t | ModeHalfSample (Long64_t n, const T *a, const Double_t *w=nullptr) |
| Returns the half-sample mode of the array a where each entry i has weight w[i]. | |
| constexpr Double_t | MWair () |
| Molecular weight of dry air 1976 US Standard Atmosphere in \( kg kmol^{-1} \) or \( gm mol^{-1} \) | |
| constexpr Double_t | Na () |
| Avogadro constant (Avogadro's Number) in \( mol^{-1} \). | |
| constexpr Double_t | NaUncertainty () |
| Avogadro constant (Avogadro's Number) uncertainty. | |
| Long_t | NextPrime (Long_t x) |
| TMath Base functions. | |
| template<typename T> | |
| Int_t | Nint (T x) |
| Round to nearest integer. Rounds half integers to the nearest even integer. | |
| template<typename T> | |
| T * | Normal2Plane (const T v1[3], const T v2[3], const T v3[3], T normal[3]) |
| Calculates a normal vector of a plane. | |
| Double_t | Normalize (Double_t v[3]) |
| Normalize a vector v in place. | |
| Float_t | Normalize (Float_t v[3]) |
| Normalize a vector v in place. | |
| template<typename T> | |
| T | NormCross (const T v1[3], const T v2[3], T out[3]) |
| Calculates the Normalized Cross Product of two vectors. | |
| Double_t | NormQuantile (Double_t p) |
| Bool_t | Odd (Long_t a) |
| Returns true if a is odd. | |
| Bool_t | Permute (Int_t n, Int_t *a) |
| constexpr Double_t | Pi () |
| \( \pi\) | |
| constexpr Double_t | PiOver2 () |
| \( \frac{\pi}{2} \) | |
| constexpr Double_t | PiOver4 () |
| \( \frac{\pi}{4} \) | |
| Double_t | Poisson (Double_t x, Double_t par) |
| Double_t | PoissonI (Double_t x, Double_t par) |
| Double_t | Power (Double_t x, Double_t y) |
| Returns x raised to the power y. | |
| Double_t | Power (Double_t x, Int_t y) |
| Returns x raised to the power y. | |
| LongDouble_t | Power (Long64_t x, Long64_t y) |
| Returns x raised to the power y. | |
| LongDouble_t | Power (LongDouble_t x, Long64_t y) |
| Returns x raised to the power y. | |
| LongDouble_t | Power (LongDouble_t x, LongDouble_t y) |
| Returns x raised to the power y. | |
| Double_t | Prob (Double_t chi2, Int_t ndf) |
| constexpr Double_t | Qe () |
| Elementary charge in \( C \) . | |
| constexpr Double_t | QeUncertainty () |
| Elementary charge uncertainty. | |
| void | Quantiles (Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=nullptr, Int_t type=7) |
| Double_t | QuietNaN () |
| Returns a quiet NaN as defined by IEEE 754. | |
| constexpr Double_t | R () |
| Universal gas constant ( \( Na K \)) in \( J K^{-1} mol^{-1} \) | |
| constexpr Double_t | RadToDeg () |
| Conversion from radian to degree: \( \frac{180}{\pi} \). | |
| Double_t | Range (Double_t lb, Double_t ub, Double_t x) |
| Returns x if lb < x < up, lb if x < lb and ub if x > ub. | |
| Int_t | Range (Int_t lb, Int_t ub, Int_t x) |
| Returns x if lb < x < up, lb if x < lb and ub if x > ub. | |
| Long_t | Range (Long_t lb, Long_t ub, Long_t x) |
| Returns x if lb < x < up, lb if x < lb and ub if x > ub. | |
| Short_t | Range (Short_t lb, Short_t ub, Short_t x) |
| Returns x if lb < x < up, lb if x < lb and ub if x > ub. | |
| ULong_t | Range (ULong_t lb, ULong_t ub, ULong_t x) |
| Returns x if lb < x < up, lb if x < lb and ub if x > ub. | |
| constexpr Double_t | Rgair () |
| Dry Air Gas Constant (R / MWair) in \( J kg^{-1} K^{-1} \) | |
| template<typename Iterator> | |
| Double_t | RMS (Iterator first, Iterator last) |
| Returns the Standard Deviation of an array defined by the iterators. | |
| template<typename Iterator, typename WeightIterator> | |
| Double_t | RMS (Iterator first, Iterator last, WeightIterator wfirst) |
| Returns the weighted Standard Deviation of an array defined by the iterators. | |
| template<typename T> | |
| Double_t | RMS (Long64_t n, const T *a, const Double_t *w=nullptr) |
| Returns the Standard Deviation of an array a with length n. | |
| Bool_t | RootsCubic (const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c) |
| constexpr Double_t | RUncertainty () |
| Universal gas constant uncertainty. | |
| constexpr Double_t | Sigma () |
| Stefan-Boltzmann constant in \( W m^{-2} K^{-4}\): \( \sigma \). | |
| constexpr Double_t | SigmaUncertainty () |
| Stefan-Boltzmann constant uncertainty. | |
| Double_t | Sign (Double_t a, Double_t b) |
| Returns a value with the magnitude of a and the sign of b. | |
| Float_t | Sign (Float_t a, Float_t b) |
| Returns a value with the magnitude of a and the sign of b. | |
| LongDouble_t | Sign (LongDouble_t a, LongDouble_t b) |
| Returns a value with the magnitude of a and the sign of b. | |
| template<typename T1, typename T2> | |
| T1 | Sign (T1 a, T2 b) |
| Returns a value with the magnitude of a and the sign of b. | |
| Double_t | SignalingNaN () |
| Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN). | |
| Bool_t | SignBit (Double_t a) |
| Returns whether the sign of Double_t a is negative. | |
| Bool_t | SignBit (Float_t a) |
| Returns whether the sign of Float_t a is negative. | |
| template<typename Integer> | |
| Bool_t | SignBit (Integer a) |
| Returns whether the sign of Integer a is negative. | |
| Bool_t | SignBit (LongDouble_t a) |
| Returns whether the sign of LongDouble_t a is negative. | |
| Double_t | Sin (Double_t) |
| Returns the sine of an angle of x radians. | |
| Double_t | SinH (Double_t) |
| Returns the hyperbolic sine of `x. | |
| template<typename Element, typename Index> | |
| void | Sort (Index n, const Element *a, Index *index, Bool_t down=kTRUE) |
| Sort the n elements of the array a of generic templated type Element. | |
| template<typename Iterator, typename IndexIterator> | |
| void | SortItr (Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE) |
| Sort the n1 elements of the Short_t array defined by its iterators. | |
| Double_t | Sq (Double_t x) |
| Returns x*x. | |
| Double_t | Sqrt (Double_t x) |
| Returns the square root of x. | |
| constexpr Double_t | Sqrt2 () |
| \( \sqrt{2} \) | |
| template<typename Iterator> | |
| Double_t | StdDev (Iterator first, Iterator last) |
| Same as RMS. | |
| template<typename Iterator, typename WeightIterator> | |
| Double_t | StdDev (Iterator first, Iterator last, WeightIterator wfirst) |
| Same as RMS. | |
| template<typename T> | |
| Double_t | StdDev (Long64_t n, const T *a, const Double_t *w=nullptr) |
| Double_t | StruveH0 (Double_t x) |
| Bessel function Y1(x) for positive x. | |
| Double_t | StruveH1 (Double_t x) |
| Struve functions of order 0. | |
| Double_t | StruveL0 (Double_t x) |
| Struve functions of order 1. | |
| Double_t | StruveL1 (Double_t x) |
| Modified Struve functions of order 0. | |
| Double_t | Student (Double_t T, Double_t ndf) |
| Double_t | StudentI (Double_t T, Double_t ndf) |
| Double_t | StudentQuantile (Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE) |
| Double_t | Tan (Double_t) |
| Returns the tangent of an angle of x radians. | |
| Double_t | TanH (Double_t) |
| Returns the hyperbolic tangent of x. | |
| constexpr Double_t | TwoPi () |
| \( 2\pi\) | |
| Double_t | Vavilov (Double_t x, Double_t kappa, Double_t beta2) |
| Double_t | VavilovDenEval (Double_t rlam, Double_t *AC, Double_t *HC, Int_t itype) |
| Double_t | VavilovI (Double_t x, Double_t kappa, Double_t beta2) |
| void | VavilovSet (Double_t rkappa, Double_t beta2, Bool_t mode, Double_t *WCM, Double_t *AC, Double_t *HC, Int_t &itype, Int_t &npt) |
| Double_t | Voigt (Double_t x, Double_t sigma, Double_t lg, Int_t r=4) |
TMath.
Encapsulate most frequently used Math functions. NB. The basic functions Min, Max, Abs and Sign are defined in TMathBase.
Returns the absolute value of parameter Double_t d.
Definition at line 142 of file TMathBase.h.
Returns the absolute value of parameter Float_t d.
Definition at line 138 of file TMathBase.h.
Returns the absolute value of parameter Int_t d.
Definition at line 126 of file TMathBase.h.
Returns the absolute value of parameter Long64_t d.
Definition at line 134 of file TMathBase.h.
Returns the absolute value of parameter Long_t d.
Definition at line 130 of file TMathBase.h.
|
inline |
Returns the absolute value of parameter LongDouble_t d.
Definition at line 146 of file TMathBase.h.
Returns the absolute value of parameter Short_t d.
Definition at line 122 of file TMathBase.h.
Binary search in an array of n values to locate value.
Array is supposed to be sorted prior to this call. If match is found, function returns position of element. If no match found, function gives nearest element smaller than value.
Definition at line 344 of file TMathBase.h.
Binary search in an array of n values to locate value.
Array is supposed to be sorted prior to this call. If match is found, function returns position of element. If no match found, function gives nearest element smaller than value.
Definition at line 329 of file TMathBase.h.
|
constexpr |
| T * TMath::Cross | ( | const T | v1[3], |
| const T | v2[3], | ||
| T | out[3] ) |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Returns true if a is even.
Definition at line 112 of file TMathBase.h.
|
constexpr |
Computation of the normalized lower incomplete gamma function P(a,x) as defined in the Handbook of Mathematical Functions by Abramowitz and Stegun, formula 6.5.1 on page 260 .
Its normalization is such that TMath::Gamma(a,+infinity) = 1 .
\[ P(a, x) = \frac{1}{\Gamma(a)} \int_{0}^{x} t^{a-1} e^{-t} dt \]
|
constexpr |
| Double_t TMath::GeomMean | ( | Iterator | first, |
| Iterator | last ) |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Calculate the one-dimensional gradient of an array with length n.
The first value in the returned array is a forward difference, the next n-2 values are central differences, and the last is a backward difference.
| n | the number of points in the array |
| f | the array of points. |
| h | the step size. The default step size is 1. |
|
constexpr |
|
constexpr |
| ULong_t TMath::Hash | ( | const char * | str | ) |
|
constexpr |
|
constexpr |
|
constexpr |
|
inline |
|
constexpr |
| void TMath::KNNDensity | ( | std::span< const double > | observations, |
| std::span< const double > | queries, | ||
| std::span< double > | result, | ||
| int | k, | ||
| double | dmin = 0.0 ) |
| Double_t TMath::KolmogorovTest | ( | Int_t | na, |
| const Double_t * | a, | ||
| Int_t | nb, | ||
| const Double_t * | b, | ||
| Option_t * | option ) |
| Element TMath::KOrdStat | ( | Size | n, |
| const Element * | a, | ||
| Size | k, | ||
| Size * | work = 0 ) |
Returns k_th order statistic of the array a of size n (k_th smallest element out of n elements).
C-convention is used for array indexing, so if you want the second smallest element, call KOrdStat(n, a, 1).
If work is supplied, it is used to store the sorting index and assumed to be >= n. If work=0, local storage is used, either on the stack if n < kWorkMax or on the heap for n >= kWorkMax. Note that the work index array will not contain the sorted indices but all indices of the smaller element in arbitrary order in work[0,...,k-1] and all indices of the larger element in arbitrary order in work[k+1,..,n-1] work[k] will contain instead the index of the returned element.
Taken from "Numerical Recipes in C++" without the index array implemented by Anna Khreshuk.
See also the declarations at the top of this file
|
constexpr |
The LANDAU function.
mu is a location parameter and correspond approximately to the most probable value and sigma is a scale parameter (not the sigma of the full distribution which is not defined) Note that for mu=0 and sigma=1 (default values) the exact location of the maximum of the distribution (most proper value) is at x = -0.22278 This function has been adapted from the CERNLIB routine G110 denlan. If norm=kTRUE (default is kFALSE) the result is divided by sigma
Calculate the Laplacian of an array with length n.
The first value in the returned array is a forward difference, the next n-2 values are central differences, and the last is a backward difference.
| n | the number of points in the array |
| f | the array of points. |
| h | the step size. The default step size is 1. |
|
constexpr |
| Iterator TMath::LocMax | ( | Iterator | first, |
| Iterator | last ) |
| Iterator TMath::LocMin | ( | Iterator | first, |
| Iterator | last ) |
Returns index of array with the minimum element.
If more than one element is minimum returns first found.
Implement here since this one is found to be faster (mainly on 64 bit machines) than stl generic implementation. When performing the comparison, the STL implementation needs to de-reference both the array iterator and the iterator pointing to the resulting minimum location
|
constexpr |
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Double_t.
Definition at line 294 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Float_t.
Definition at line 289 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Int_t.
Definition at line 259 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Long64_t.
Definition at line 279 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Long_t.
Definition at line 269 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are Short_t.
Definition at line 249 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are UInt_t.
Definition at line 264 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are ULong64_t.
Definition at line 284 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are ULong_t.
Definition at line 274 of file TMathBase.h.
Returns the largest of a and b.
If both are equivalent, a is returned. aand b are UShort_t.
Definition at line 254 of file TMathBase.h.
| T TMath::MaxElement | ( | Long64_t | n, |
| const T * | a ) |
| Double_t TMath::Mean | ( | Iterator | first, |
| Iterator | last ) |
| Double_t TMath::Mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | w ) |
| Double_t TMath::Median | ( | Long64_t | n, |
| const T * | a, | ||
| const Double_t * | w = nullptr, | ||
| Long64_t * | work = nullptr ) |
Same as RMS.
Returns the median of the array a where each entry i has weight w[i] .
Both arrays have a length of at least n . The median is a number obtained from the sorted array a through
median = (a[jl]+a[jh])/2. where (using also the sorted index on the array w)
sum_i=0,jl w[i] <= sumTot/2 sum_i=0,jh w[i] >= sumTot/2 sumTot = sum_i=0,n w[i]
If w=0, the algorithm defaults to the median definition where it is a number that divides the sorted sequence into 2 halves. When n is odd or n > 1000, the median is kth element k = (n + 1) / 2. when n is even and n < 1000the median is a mean of the elements k = n/2 and k = n/2 + 1.
If the weights are supplied (w not 0) all weights must be >= 0
If work is supplied, it is used to store the sorting index and assumed to be >= n . If work=0, local storage is used, either on the stack if n < kWorkMax or on the heap for n >= kWorkMax .
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Double_t.
Definition at line 242 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Float_t.
Definition at line 237 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Int_t.
Definition at line 207 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Long64_t.
Definition at line 227 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Long_t.
Definition at line 217 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Short_t.
Definition at line 197 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are Short_t.
Definition at line 212 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are ULong64_t.
Definition at line 232 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are ULong_t.
Definition at line 222 of file TMathBase.h.
Returns the smallest of a and b.
If both are equivalent, a is returned. aand b are UShort_t.
Definition at line 202 of file TMathBase.h.
| T TMath::MinElement | ( | Long64_t | n, |
| const T * | a ) |
| Double_t TMath::ModeHalfSample | ( | Long64_t | n, |
| const T * | a, | ||
| const Double_t * | w = nullptr ) |
Returns the half-sample mode of the array a where each entry i has weight w[i].
Both arrays must have a length of n. The mode is a number obtained according to the paper http://arxiv.org/ftp/math/papers/0505/0505419.pdf (page 19). The algorithm searches for the smallest range of sorted a values that contains ~n/2 values. Then it re-applies the same algorithm to that range until the range has <= 3 elements in it.
{c}ois Caron, 2014 on JIRA-6849| T | data type of the values array a |
| n | Number of elements in array a |
| a | Pointer to array of values (owned by user, preallocated), must have length of n, and none of them should be NaN. The array must not be necessarily sorted nor contain unique values. |
| w | Pointer to array of weights (owned by user, preallocated), must have length of n. If the weights are supplied (w not nullptr) all weights must be >= 0 to properly work. |
|
constexpr |
Molecular weight of dry air 1976 US Standard Atmosphere in \( kg kmol^{-1} \) or \( gm mol^{-1} \)
|
constexpr |
|
constexpr |
|
inline |
| T * TMath::Normal2Plane | ( | const T | p1[3], |
| const T | p2[3], | ||
| const T | p3[3], | ||
| T | normal[3] ) |
Normalize a vector v in place.
Returns the norm of the original vector. This implementation (thanks Kevin Lynch krlyn.nosp@m.ch@b.nosp@m.u.edu) is protected against possible overflows.
|
inline |
Returns true if a is odd.
Definition at line 116 of file TMathBase.h.
|
inline |
|
inline |
|
inline |
|
constexpr |
|
constexpr |
| void TMath::Quantiles | ( | Int_t | n, |
| Int_t | nprob, | ||
| Double_t * | x, | ||
| Double_t * | quantiles, | ||
| Double_t * | prob, | ||
| Bool_t | isSorted = kTRUE, | ||
| Int_t * | index = nullptr, | ||
| Int_t | type = 7 ) |
|
inline |
Returns a quiet NaN as defined by IEEE 754.
|
constexpr |
Universal gas constant ( \( Na K \)) in \( J K^{-1} mol^{-1} \)
|
constexpr |
|
constexpr |
Dry Air Gas Constant (R / MWair) in \( J kg^{-1} K^{-1} \)
| Double_t TMath::RMS | ( | Iterator | first, |
| Iterator | last ) |
Returns the Standard Deviation of an array defined by the iterators.
Note that this function returns the sigma(standard deviation) and not the root mean square of the array.
Use the two pass algorithm, which is slower (! a factor of 2) but much more precise. Since we have a vector the 2 pass algorithm is still faster than the Welford algorithm. (See also ROOT-5545)
| Double_t TMath::RMS | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | w ) |
|
constexpr |
|
constexpr |
|
constexpr |
Returns a value with the magnitude of a and the sign of b.
aand b are Double_t.
Definition at line 184 of file TMathBase.h.
Returns a value with the magnitude of a and the sign of b.
aand b are Short_t.
Definition at line 179 of file TMathBase.h.
|
inline |
Returns a value with the magnitude of a and the sign of b.
aand b are LongDouble_t.
Definition at line 189 of file TMathBase.h.
Returns a value with the magnitude of a and the sign of b.
Definition at line 174 of file TMathBase.h.
|
inline |
Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN).
Returns whether the sign of Double_t a is negative.
Definition at line 162 of file TMathBase.h.
Returns whether the sign of Float_t a is negative.
Definition at line 158 of file TMathBase.h.
|
inline |
Returns whether the sign of Integer a is negative.
Definition at line 154 of file TMathBase.h.
|
inline |
Returns whether the sign of LongDouble_t a is negative.
Definition at line 166 of file TMathBase.h.
| void TMath::Sort | ( | Index | n, |
| const Element * | a, | ||
| Index * | index, | ||
| Bool_t | down = kTRUE ) |
Sort the n elements of the array a of generic templated type Element.
In output the array index of type Index contains the indices of the sorted array. If down is false sort in increasing order (default is decreasing order).
NOTE that the array index must be created with a length >= n before calling this function. NOTE also that the size type for n must be the same type used for the index array (templated type Index)
Definition at line 413 of file TMathBase.h.
| void TMath::SortItr | ( | Iterator | first, |
| Iterator | last, | ||
| IndexIterator | index, | ||
| Bool_t | down = kTRUE ) |
Sort the n1 elements of the Short_t array defined by its iterators.
In output the array index contains the indices of the sorted array. If down is false sort in increasing order (default is decreasing order).
NOTE that the array index must be created with a length bigger or equal than the main array before calling this function.
Definition at line 388 of file TMathBase.h.
| Double_t TMath::StdDev | ( | Iterator | first, |
| Iterator | last ) |
| Double_t TMath::StdDev | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | wfirst ) |
| void TMath::VavilovSet | ( | Double_t | rkappa, |
| Double_t | beta2, | ||
| Bool_t | mode, | ||
| Double_t * | WCM, | ||
| Double_t * | AC, | ||
| Double_t * | HC, | ||
| Int_t & | itype, | ||
| Int_t & | npt ) |