BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
TMath.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: Rene Brun, Anna Kreshuk, Eddy Offermann, Fons Rademakers 29/07/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TMath
13 #define ROOT_TMath
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TMath //
19 // //
20 // Encapsulate most frequently used Math functions. //
21 // NB. The basic functions Min, Max, Abs and Sign are defined //
22 // in TMathBase. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "Rtypes.h"
27 #include "TMathBase.h"
28 
29 #include "TError.h"
30 #include <algorithm>
31 #include <limits>
32 #include <cmath>
33 
34 namespace TMath {
35 
36  /* ************************* */
37  /* * Fundamental constants * */
38  /* ************************* */
39 
40 constexpr Double_t Pi()
41 {
42  return 3.14159265358979323846;
43 }
44 constexpr Double_t TwoPi()
45 {
46  return 2.0 * Pi();
47 }
48 constexpr Double_t PiOver2()
49 {
50  return Pi() / 2.0;
51 }
52 constexpr Double_t PiOver4()
53 {
54  return Pi() / 4.0;
55 }
56 constexpr Double_t InvPi()
57 {
58  return 1.0 / Pi();
59 }
60 constexpr Double_t RadToDeg()
61 {
62  return 180.0 / Pi();
63 }
64 constexpr Double_t DegToRad()
65 {
66  return Pi() / 180.0;
67 }
68 constexpr Double_t Sqrt2()
69 {
70  return 1.4142135623730950488016887242097;
71 }
72 
73 // e (base of natural log)
74 constexpr Double_t E()
75 {
76  return 2.71828182845904523536;
77 }
78 
79 // natural log of 10 (to convert log to ln)
80 constexpr Double_t Ln10()
81 {
82  return 2.30258509299404568402;
83 }
84 
85 // base-10 log of e (to convert ln to log)
86 constexpr Double_t LogE()
87 {
88  return 0.43429448190325182765;
89 }
90 
91 // velocity of light
92 constexpr Double_t C()
93 {
94  return 2.99792458e8;
95 } // m s^-1
96 constexpr Double_t Ccgs()
97 {
98  return 100.0 * C();
99 } // cm s^-1
101 {
102  return 0.0;
103 } // exact
104 
105 // gravitational constant
106 constexpr Double_t G()
107 {
108  return 6.673e-11;
109 } // m^3 kg^-1 s^-2
110 constexpr Double_t Gcgs()
111 {
112  return G() / 1000.0;
113 } // cm^3 g^-1 s^-2
115 {
116  return 0.010e-11;
117 }
118 
119 // G over h-bar C
120 constexpr Double_t GhbarC()
121 {
122  return 6.707e-39;
123 } // (GeV/c^2)^-2
125 {
126  return 0.010e-39;
127 }
128 
129 // standard acceleration of gravity
130 constexpr Double_t Gn()
131 {
132  return 9.80665;
133 } // m s^-2
135 {
136  return 0.0;
137 } // exact
138 
139 // Planck's constant
140 constexpr Double_t H()
141 {
142  return 6.62606876e-34;
143 } // J s
144 constexpr Double_t Hcgs()
145 {
146  return 1.0e7 * H();
147 } // erg s
149 {
150  return 0.00000052e-34;
151 }
152 
153 // h-bar (h over 2 pi)
154 constexpr Double_t Hbar()
155 {
156  return 1.054571596e-34;
157 } // J s
158 constexpr Double_t Hbarcgs()
159 {
160  return 1.0e7 * Hbar();
161 } // erg s
163 {
164  return 0.000000082e-34;
165 }
166 
167 // hc (h * c)
168 constexpr Double_t HC()
169 {
170  return H() * C();
171 } // J m
172 constexpr Double_t HCcgs()
173 {
174  return Hcgs() * Ccgs();
175 } // erg cm
176 
177 // Boltzmann's constant
178 constexpr Double_t K()
179 {
180  return 1.3806503e-23;
181 } // J K^-1
182 constexpr Double_t Kcgs()
183 {
184  return 1.0e7 * K();
185 } // erg K^-1
187 {
188  return 0.0000024e-23;
189 }
190 
191 // Stefan-Boltzmann constant
192 constexpr Double_t Sigma()
193 {
194  return 5.6704e-8;
195 } // W m^-2 K^-4
197 {
198  return 0.000040e-8;
199 }
200 
201 // Avogadro constant (Avogadro's Number)
202 constexpr Double_t Na()
203 {
204  return 6.02214199e+23;
205 } // mol^-1
207 {
208  return 0.00000047e+23;
209 }
210 
211 // universal gas constant (Na * K)
212 // http://scienceworld.wolfram.com/physics/UniversalGasConstant.html
213 constexpr Double_t R()
214 {
215  return K() * Na();
216 } // J K^-1 mol^-1
218 {
219  return R() * ((KUncertainty() / K()) + (NaUncertainty() / Na()));
220 }
221 
222 // Molecular weight of dry air
223 // 1976 US Standard Atmosphere,
224 // also see http://atmos.nmsu.edu/jsdap/encyclopediawork.html
225 constexpr Double_t MWair()
226 {
227  return 28.9644;
228 } // kg kmol^-1 (or gm mol^-1)
229 
230 // Dry Air Gas Constant (R / MWair)
231 // http://atmos.nmsu.edu/education_and_outreach/encyclopedia/gas_constant.htm
232 constexpr Double_t Rgair()
233 {
234  return (1000.0 * R()) / MWair();
235 } // J kg^-1 K^-1
236 
237 // Euler-Mascheroni Constant
238 constexpr Double_t EulerGamma()
239 {
240  return 0.577215664901532860606512090082402431042;
241 }
242 
243 // Elementary charge
244 constexpr Double_t Qe()
245 {
246  return 1.602176462e-19;
247 } // C
249 {
250  return 0.000000063e-19;
251 }
252 
253 /* ************************** */
254 /* * Mathematical Functions * */
255 /* ************************** */
256 
257 /* ***************************** */
258 /* * Trigonometrical Functions * */
259 /* ***************************** */
260 inline Double_t Sin(Double_t);
261 inline Double_t Cos(Double_t);
262 inline Double_t Tan(Double_t);
263 inline Double_t SinH(Double_t);
264 inline Double_t CosH(Double_t);
265 inline Double_t TanH(Double_t);
266 inline Double_t ASin(Double_t);
267 inline Double_t ACos(Double_t);
268 inline Double_t ATan(Double_t);
274 
275 /* ************************ */
276 /* * Elementary Functions * */
277 /* ************************ */
278 inline Double_t Ceil(Double_t x);
279 inline Int_t CeilNint(Double_t x);
280 inline Double_t Floor(Double_t x);
281 inline Int_t FloorNint(Double_t x);
282 template <typename T>
283 inline Int_t Nint(T x);
284 
285 inline Double_t Sq(Double_t x);
286 inline Double_t Sqrt(Double_t x);
287 inline Double_t Exp(Double_t x);
288 inline Double_t Ldexp(Double_t x, Int_t exp);
292 inline LongDouble_t Power(Long64_t x, Long64_t y);
293 inline Double_t Power(Double_t x, Double_t y);
294 inline Double_t Power(Double_t x, Int_t y);
295 inline Double_t Log(Double_t x);
297 inline Double_t Log10(Double_t x);
299 inline Int_t Finite(Float_t x);
300 inline Bool_t IsNaN(Double_t x);
301 inline Bool_t IsNaN(Float_t x);
302 
303 inline Double_t QuietNaN();
304 inline Double_t SignalingNaN();
305 inline Double_t Infinity();
306 
307 template <typename T>
308 struct Limits {
309  inline static T Min();
310  inline static T Max();
311  inline static T Epsilon();
312  };
313 
314  // Some integer math
315  Long_t Hypot(Long_t x, Long_t y); // sqrt(px*px + py*py)
316 
317  // Comparing floating points
318  inline Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon) {
319  //return kTRUE if absolute difference between af and bf is less than epsilon
320  return TMath::Abs(af-bf) < epsilon;
321  }
322  inline Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec) {
323  //return kTRUE if relative difference between af and bf is less than relPrec
324  return TMath::Abs(af - bf) <= 0.5 * relPrec * (TMath::Abs(af) + TMath::Abs(bf)) ||
325  TMath::Abs(af - bf) < Limits<Double_t>::Min(); // handle denormals
326  }
327 
328  /* ******************** */
329  /* * Array Algorithms * */
330  /* ******************** */
331 
332  // Min, Max of an array
333  template <typename T> T MinElement(Long64_t n, const T *a);
334  template <typename T> T MaxElement(Long64_t n, const T *a);
335 
336  // Locate Min, Max element number in an array
337  template <typename T> Long64_t LocMin(Long64_t n, const T *a);
338  template <typename Iterator> Iterator LocMin(Iterator first, Iterator last);
339  template <typename T> Long64_t LocMax(Long64_t n, const T *a);
340  template <typename Iterator> Iterator LocMax(Iterator first, Iterator last);
341 
342  // Binary search
343  template <typename T> Long64_t BinarySearch(Long64_t n, const T *array, T value);
344  template <typename T> Long64_t BinarySearch(Long64_t n, const T **array, T value);
345  template <typename Iterator, typename Element> Iterator BinarySearch(Iterator first, Iterator last, Element value);
346 
347  // Hashing
348 // ULong_t Hash(const void *txt, Int_t ntxt);
349 // ULong_t Hash(const char *str);
350 
351  // Sorting
352  template <typename Element, typename Index>
353  void Sort(Index n, const Element* a, Index* index, Bool_t down=kTRUE);
354  template <typename Iterator, typename IndexIterator>
355  void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE);
356 
357  void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2);
358  void BubbleLow (Int_t Narr, Double_t *arr1, Int_t *arr2);
359 
360  Bool_t Permute(Int_t n, Int_t *a); // Find permutations
361 
362  /* ************************* */
363  /* * Geometrical Functions * */
364  /* ************************* */
365 
366  //Sample quantiles
367  void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob,
368  Bool_t isSorted=kTRUE, Int_t *index = 0, Int_t type=7);
369 
370  // IsInside
371  template <typename T> Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y);
372 
373  // Calculate the Cross Product of two vectors
374  template <typename T> T *Cross(const T v1[3],const T v2[3], T out[3]);
375 
376  Float_t Normalize(Float_t v[3]); // Normalize a vector
377  Double_t Normalize(Double_t v[3]); // Normalize a vector
378 
379  //Calculate the Normalized Cross Product of two vectors
380  template <typename T> inline T NormCross(const T v1[3],const T v2[3],T out[3]);
381 
382  // Calculate a normal vector of a plane
383  template <typename T> T *Normal2Plane(const T v1[3],const T v2[3],const T v3[3], T normal[3]);
384 
385  /* ************************ */
386  /* * Polynomial Functions * */
387  /* ************************ */
388 
389  Bool_t RootsCubic(const Double_t coef[4],Double_t &a, Double_t &b, Double_t &c);
390 
391  /* *********************** */
392  /* * Statistic Functions * */
393  /* *********************** */
394 
395  Double_t Binomial(Int_t n,Int_t k); // Calculate the binomial coefficient n over k
402  Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE);
404 // Double_t KolmogorovTest(Int_t na, const Double_t *a, Int_t nb, const Double_t *b, Option_t *option);
420 
421  /* ************************** */
422  /* * Statistics over arrays * */
423  /* ************************** */
424 
425  //Mean, Geometric Mean, Median, RMS(sigma)
426 
427  template <typename T> Double_t Mean(Long64_t n, const T *a, const Double_t *w=0);
428  template <typename Iterator> Double_t Mean(Iterator first, Iterator last);
429  template <typename Iterator, typename WeightIterator> Double_t Mean(Iterator first, Iterator last, WeightIterator wfirst);
430 
431  template <typename T> Double_t GeomMean(Long64_t n, const T *a);
432  template <typename Iterator> Double_t GeomMean(Iterator first, Iterator last);
433 
434  template <typename T> Double_t RMS(Long64_t n, const T *a, const Double_t *w=0);
435  template <typename Iterator> Double_t RMS(Iterator first, Iterator last);
436  template <typename Iterator, typename WeightIterator> Double_t RMS(Iterator first, Iterator last, WeightIterator wfirst);
437 
438  template <typename T> Double_t StdDev(Long64_t n, const T *a, const Double_t * w = 0) { return RMS<T>(n,a,w); }
439  template <typename Iterator> Double_t StdDev(Iterator first, Iterator last) { return RMS<Iterator>(first,last); }
440  template <typename Iterator, typename WeightIterator> Double_t StdDev(Iterator first, Iterator last, WeightIterator wfirst) { return RMS<Iterator,WeightIterator>(first,last,wfirst); }
441 
442  template <typename T> Double_t Median(Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0);
443 
444  //k-th order statistic
445  template <class Element, typename Size> Element KOrdStat(Size n, const Element *a, Size k, Size *work = 0);
446 
447  /* ******************* */
448  /* * Special Functions */
449  /* ******************* */
450 
456 
457  // Bessel functions
458  Double_t BesselI(Int_t n,Double_t x); // integer order modified Bessel function I_n(x)
459  Double_t BesselK(Int_t n,Double_t x); // integer order modified Bessel function K_n(x)
460  Double_t BesselI0(Double_t x); // modified Bessel function I_0(x)
461  Double_t BesselK0(Double_t x); // modified Bessel function K_0(x)
462  Double_t BesselI1(Double_t x); // modified Bessel function I_1(x)
463  Double_t BesselK1(Double_t x); // modified Bessel function K_1(x)
464  Double_t BesselJ0(Double_t x); // Bessel function J0(x) for any real x
465  Double_t BesselJ1(Double_t x); // Bessel function J1(x) for any real x
466  Double_t BesselY0(Double_t x); // Bessel function Y0(x) for positive x
467  Double_t BesselY1(Double_t x); // Bessel function Y1(x) for positive x
468  Double_t StruveH0(Double_t x); // Struve functions of order 0
469  Double_t StruveH1(Double_t x); // Struve functions of order 1
470  Double_t StruveL0(Double_t x); // Modified Struve functions of order 0
471  Double_t StruveL1(Double_t x); // Modified Struve functions of order 1
472 
483 }
484 
486  { return std::sin(x); }
487 
489  { return std::cos(x); }
490 
492  { return std::tan(x); }
493 
495  { return std::sinh(x); }
496 
498  { return std::cosh(x); }
499 
501  { return std::tanh(x); }
502 
504  { if (x < -1.) return -TMath::Pi()/2;
505  if (x > 1.) return TMath::Pi()/2;
506  return std::asin(x);
507  }
508 
510  { if (x < -1.) return TMath::Pi();
511  if (x > 1.) return 0;
512  return std::acos(x);
513  }
514 
516  { return std::atan(x); }
517 
519  { if (x != 0) return std::atan2(y, x);
520  if (y == 0) return 0;
521  if (y > 0) return Pi()/2;
522  else return -Pi()/2;
523  }
524 
526  { return x*x; }
527 
529  { return std::sqrt(x); }
530 
532  { return std::ceil(x); }
533 
535  { return TMath::Nint(ceil(x)); }
536 
538  { return std::floor(x); }
539 
541  { return TMath::Nint(floor(x)); }
542 
543 template<typename T>
544 inline Int_t TMath::Nint(T x)
545 {
546  // Round to nearest integer. Rounds half integers to the nearest
547  // even integer.
548  int i;
549  if (x >= 0) {
550  i = int(x + 0.5);
551  if ( i & 1 && x + 0.5 == T(i) ) i--;
552  } else {
553  i = int(x - 0.5);
554  if ( i & 1 && x - 0.5 == T(i) ) i++;
555  }
556  return i;
557 }
558 
560  { return std::exp(x); }
561 
563  { return ldexp(x, exp); }
564 
566  { return std::pow(x,y); }
567 
569  { return std::pow(x,(LongDouble_t)y); }
570 
572  { return std::pow(x,y); }
573 
575  { return std::pow(x, y); }
576 
578 #ifdef R__ANSISTREAM
579  return std::pow(x, y);
580 #else
581  return std::pow(x, (Double_t) y);
582 #endif
583 }
584 
585 
587  { return log(x); }
588 
590  { return log10(x); }
591 
592 inline Bool_t TMath::IsNaN(Double_t x) { return std::isnan(x); }
593 inline Bool_t TMath::IsNaN(Float_t x) { return std::isnan(x); }
594 
595 //--------wrapper to numeric_limits
596 //____________________________________________________________________________
598  // returns a quiet NaN as defined by IEEE 754
599  // see http://en.wikipedia.org/wiki/NaN#Quiet_NaN
600  return std::numeric_limits<Double_t>::quiet_NaN();
601 }
602 
603 //____________________________________________________________________________
605  // returns a signaling NaN as defined by IEEE 754
606  // see http://en.wikipedia.org/wiki/NaN#Signaling_NaN
607  return std::numeric_limits<Double_t>::signaling_NaN();
608 }
609 
611  // returns an infinity as defined by the IEEE standard
612  return std::numeric_limits<Double_t>::infinity();
613 }
614 
615 template<typename T>
617  // returns maximum representation for type T
618  return (std::numeric_limits<T>::min)(); //N.B. use this signature to avoid class with macro min() on Windows
619 }
620 
621 template<typename T>
623  // returns minimum double representation
624  return (std::numeric_limits<T>::max)(); //N.B. use this signature to avoid class with macro max() on Windows
625 }
626 
627 template<typename T>
629  // returns minimum double representation
630  return std::numeric_limits<T>::epsilon();
631 }
632 
633 
634 //-------- Advanced -------------
635 
636 template <typename T> inline T TMath::NormCross(const T v1[3],const T v2[3],T out[3])
637 {
638  // Calculate the Normalized Cross Product of two vectors
639  return Normalize(Cross(v1,v2,out));
640 }
641 
642 template <typename T>
643 T TMath::MinElement(Long64_t n, const T *a) {
644  // Return minimum of array a of length n.
645 
646  return *std::min_element(a,a+n);
647 }
648 
649 template <typename T>
650 T TMath::MaxElement(Long64_t n, const T *a) {
651  // Return maximum of array a of length n.
652 
653  return *std::max_element(a,a+n);
654 }
655 
656 template <typename T>
658  // Return index of array with the minimum element.
659  // If more than one element is minimum returns first found.
660 
661  // Implement here since this one is found to be faster (mainly on 64 bit machines)
662  // than stl generic implementation.
663  // When performing the comparison, the STL implementation needs to de-reference both the array iterator
664  // and the iterator pointing to the resulting minimum location
665 
666  if (n <= 0 || !a) return -1;
667  T xmin = a[0];
668  Long64_t loc = 0;
669  for (Long64_t i = 1; i < n; i++) {
670  if (xmin > a[i]) {
671  xmin = a[i];
672  loc = i;
673  }
674  }
675  return loc;
676 }
677 
678 template <typename Iterator>
679 Iterator TMath::LocMin(Iterator first, Iterator last) {
680  // Return index of array with the minimum element.
681  // If more than one element is minimum returns first found.
682  return std::min_element(first, last);
683 }
684 
685 template <typename T>
687  // Return index of array with the maximum element.
688  // If more than one element is maximum returns first found.
689 
690  // Implement here since it is faster (see comment in LocMin function)
691 
692  if (n <= 0 || !a) return -1;
693  T xmax = a[0];
694  Long64_t loc = 0;
695  for (Long64_t i = 1; i < n; i++) {
696  if (xmax < a[i]) {
697  xmax = a[i];
698  loc = i;
699  }
700  }
701  return loc;
702 }
703 
704 template <typename Iterator>
705 Iterator TMath::LocMax(Iterator first, Iterator last)
706 {
707  // Return index of array with the maximum element.
708  // If more than one element is maximum returns first found.
709 
710  return std::max_element(first, last);
711 }
712 
713 template<typename T>
714 struct CompareDesc {
715 
716  CompareDesc(T d) : fData(d) {}
717 
718  template<typename Index>
719  bool operator()(Index i1, Index i2) {
720  return *(fData + i1) > *(fData + i2);
721  }
722 
723  T fData;
724 };
725 
726 template<typename T>
727 struct CompareAsc {
728 
729  CompareAsc(T d) : fData(d) {}
730 
731  template<typename Index>
732  bool operator()(Index i1, Index i2) {
733  return *(fData + i1) < *(fData + i2);
734  }
735 
736  T fData;
737 };
738 
739 template <typename Iterator>
740 Double_t TMath::Mean(Iterator first, Iterator last)
741 {
742  // Return the weighted mean of an array defined by the iterators.
743 
744  Double_t sum = 0;
745  Double_t sumw = 0;
746  while ( first != last )
747  {
748  sum += *first;
749  sumw += 1;
750  first++;
751  }
752 
753  return sum/sumw;
754 }
755 
756 template <typename Iterator, typename WeightIterator>
757 Double_t TMath::Mean(Iterator first, Iterator last, WeightIterator w)
758 {
759  // Return the weighted mean of an array defined by the first and
760  // last iterators. The w iterator should point to the first element
761  // of a vector of weights of the same size as the main array.
762 
763  Double_t sum = 0;
764  Double_t sumw = 0;
765  int i = 0;
766  while ( first != last ) {
767  if ( *w < 0) {
768  ::Error("TMath::Mean","w[%d] = %.4e < 0 ?!",i,*w);
769  return 0;
770  }
771  sum += (*w) * (*first);
772  sumw += (*w) ;
773  ++w;
774  ++first;
775  ++i;
776  }
777  if (sumw <= 0) {
778  ::Error("TMath::Mean","sum of weights == 0 ?!");
779  return 0;
780  }
781 
782  return sum/sumw;
783 }
784 
785 template <typename T>
786 Double_t TMath::Mean(Long64_t n, const T *a, const Double_t *w)
787 {
788  // Return the weighted mean of an array a with length n.
789 
790  if (w) {
791  return TMath::Mean(a, a+n, w);
792  } else {
793  return TMath::Mean(a, a+n);
794  }
795 }
796 
797 template <typename Iterator>
798 Double_t TMath::GeomMean(Iterator first, Iterator last)
799 {
800  // Return the geometric mean of an array defined by the iterators.
801  // geometric_mean = (Prod_i=0,n-1 |a[i]|)^1/n
802 
803  Double_t logsum = 0.;
804  Long64_t n = 0;
805  while ( first != last ) {
806  if (*first == 0) return 0.;
807  Double_t absa = (Double_t) TMath::Abs(*first);
808  logsum += TMath::Log(absa);
809  ++first;
810  ++n;
811  }
812 
813  return TMath::Exp(logsum/n);
814 }
815 
816 template <typename T>
818 {
819  // Return the geometric mean of an array a of size n.
820  // geometric_mean = (Prod_i=0,n-1 |a[i]|)^1/n
821 
822  return TMath::GeomMean(a, a+n);
823 }
824 
825 template <typename Iterator>
826 Double_t TMath::RMS(Iterator first, Iterator last)
827 {
828  // Return the Standard Deviation of an array defined by the iterators.
829  // Note that this function returns the sigma(standard deviation) and
830  // not the root mean square of the array.
831 
832  // Use the two pass algorithm, which is slower (! a factor of 2) but much more
833  // precise. Since we have a vector the 2 pass algorithm is still faster than the
834  // Welford algorithm. (See also ROOT-5545)
835 
836  Double_t n = 0;
837 
838  Double_t tot = 0;
839  Double_t mean = TMath::Mean(first,last);
840  while ( first != last ) {
841  Double_t x = Double_t(*first);
842  tot += (x - mean)*(x - mean);
843  ++first;
844  ++n;
845  }
846  Double_t rms = (n > 1) ? TMath::Sqrt(tot/(n-1)) : 0.0;
847  return rms;
848 }
849 
850 template <typename Iterator, typename WeightIterator>
851 Double_t TMath::RMS(Iterator first, Iterator last, WeightIterator w)
852 {
853  // Return the weighted Standard Deviation of an array defined by the iterators.
854  // Note that this function returns the sigma(standard deviation) and
855  // not the root mean square of the array.
856 
857  // As in the unweighted case use the two pass algorithm
858 
859  Double_t tot = 0;
860  Double_t sumw = 0;
861  Double_t sumw2 = 0;
862  Double_t mean = TMath::Mean(first,last,w);
863  while ( first != last ) {
864  Double_t x = Double_t(*first);
865  sumw += *w;
866  sumw2 += (*w) * (*w);
867  tot += (*w) * (x - mean)*(x - mean);
868  ++first;
869  ++w;
870  }
871  // use the correction neff/(neff -1) for the unbiased formula
872  Double_t rms = TMath::Sqrt(tot * sumw/ (sumw*sumw - sumw2) );
873  return rms;
874 }
875 
876 
877 template <typename T>
878 Double_t TMath::RMS(Long64_t n, const T *a, const Double_t * w)
879 {
880  // Return the Standard Deviation of an array a with length n.
881  // Note that this function returns the sigma(standard deviation) and
882  // not the root mean square of the array.
883 
884  return (w) ? TMath::RMS(a, a+n, w) : TMath::RMS(a, a+n);
885 }
886 
887 template <typename Iterator, typename Element>
888 Iterator TMath::BinarySearch(Iterator first, Iterator last, Element value)
889 {
890  // Binary search in an array defined by its iterators.
891  //
892  // The values in the iterators range are supposed to be sorted
893  // prior to this call. If match is found, function returns
894  // position of element. If no match found, function gives nearest
895  // element smaller than value.
896 
897  Iterator pind;
898  pind = std::lower_bound(first, last, value);
899  if ( (pind != last) && (*pind == value) )
900  return pind;
901  else
902  return ( pind - 1);
903 }
904 
905 
906 template <typename T> Long64_t TMath::BinarySearch(Long64_t n, const T *array, T value)
907 {
908  // Binary search in an array of n values to locate value.
909  //
910  // Array is supposed to be sorted prior to this call.
911  // If match is found, function returns position of element.
912  // If no match found, function gives nearest element smaller than value.
913 
914  const T* pind;
915  pind = std::lower_bound(array, array + n, value);
916  if ( (pind != array + n) && (*pind == value) )
917  return (pind - array);
918  else
919  return ( pind - array - 1);
920 }
921 
922 template <typename T> Long64_t TMath::BinarySearch(Long64_t n, const T **array, T value)
923 {
924  // Binary search in an array of n values to locate value.
925  //
926  // Array is supposed to be sorted prior to this call.
927  // If match is found, function returns position of element.
928  // If no match found, function gives nearest element smaller than value.
929 
930  const T* pind;
931  pind = std::lower_bound(*array, *array + n, value);
932  if ( (pind != *array + n) && (*pind == value) )
933  return (pind - *array);
934  else
935  return ( pind - *array - 1);
936 }
937 
938 template <typename Iterator, typename IndexIterator>
939 void TMath::SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down)
940 {
941  // Sort the n1 elements of the Short_t array defined by its
942  // iterators. In output the array index contains the indices of
943  // the sorted array. If down is false sort in increasing order
944  // (default is decreasing order).
945 
946  // NOTE that the array index must be created with a length bigger
947  // or equal than the main array before calling this function.
948 
949  int i = 0;
950 
951  IndexIterator cindex = index;
952  for ( Iterator cfirst = first; cfirst != last; ++cfirst )
953  {
954  *cindex = i++;
955  ++cindex;
956  }
957 
958  if ( down )
959  std::sort(index, cindex, CompareDesc<Iterator>(first) );
960  else
961  std::sort(index, cindex, CompareAsc<Iterator>(first) );
962 }
963 
964 template <typename Element, typename Index> void TMath::Sort(Index n, const Element* a, Index* index, Bool_t down)
965 {
966  // Sort the n elements of the array a of generic templated type Element.
967  // In output the array index of type Index contains the indices of the sorted array.
968  // If down is false sort in increasing order (default is decreasing order).
969 
970  // NOTE that the array index must be created with a length >= n
971  // before calling this function.
972  // NOTE also that the size type for n must be the same type used for the index array
973  // (templated type Index)
974 
975  for(Index i = 0; i < n; i++) { index[i] = i; }
976  if ( down )
977  std::sort(index, index + n, CompareDesc<const Element*>(a) );
978  else
979  std::sort(index, index + n, CompareAsc<const Element*>(a) );
980 }
981 
982 template <typename T> T *TMath::Cross(const T v1[3],const T v2[3], T out[3])
983 {
984  // Calculate the Cross Product of two vectors:
985  // out = [v1 x v2]
986 
987  out[0] = v1[1] * v2[2] - v1[2] * v2[1];
988  out[1] = v1[2] * v2[0] - v1[0] * v2[2];
989  out[2] = v1[0] * v2[1] - v1[1] * v2[0];
990 
991  return out;
992 }
993 
994 template <typename T> T * TMath::Normal2Plane(const T p1[3],const T p2[3],const T p3[3], T normal[3])
995 {
996  // Calculate a normal vector of a plane.
997  //
998  // Input:
999  // Float_t *p1,*p2,*p3 - 3 3D points belonged the plane to define it.
1000  //
1001  // Return:
1002  // Pointer to 3D normal vector (normalized)
1003 
1004  T v1[3], v2[3];
1005 
1006  v1[0] = p2[0] - p1[0];
1007  v1[1] = p2[1] - p1[1];
1008  v1[2] = p2[2] - p1[2];
1009 
1010  v2[0] = p3[0] - p1[0];
1011  v2[1] = p3[1] - p1[1];
1012  v2[2] = p3[2] - p1[2];
1013 
1014  NormCross(v1,v2,normal);
1015  return normal;
1016 }
1017 
1018 template <typename T> Bool_t TMath::IsInside(T xp, T yp, Int_t np, T *x, T *y)
1019 {
1020  // Function which returns kTRUE if point xp,yp lies inside the
1021  // polygon defined by the np points in arrays x and y, kFALSE otherwise.
1022  // Note that the polygon may be open or closed.
1023 
1024  Int_t i, j = np-1 ;
1025  Bool_t oddNodes = kFALSE;
1026 
1027  for (i=0; i<np; i++) {
1028  if ((y[i]<yp && y[j]>=yp) || (y[j]<yp && y[i]>=yp)) {
1029  if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
1030  oddNodes = !oddNodes;
1031  }
1032  }
1033  j=i;
1034  }
1035 
1036  return oddNodes;
1037 }
1038 
1039 template <typename T> Double_t TMath::Median(Long64_t n, const T *a, const Double_t *w, Long64_t *work)
1040 {
1041  // Return the median of the array a where each entry i has weight w[i] .
1042  // Both arrays have a length of at least n . The median is a number obtained
1043  // from the sorted array a through
1044  //
1045  // median = (a[jl]+a[jh])/2. where (using also the sorted index on the array w)
1046  //
1047  // sum_i=0,jl w[i] <= sumTot/2
1048  // sum_i=0,jh w[i] >= sumTot/2
1049  // sumTot = sum_i=0,n w[i]
1050  //
1051  // If w=0, the algorithm defaults to the median definition where it is
1052  // a number that divides the sorted sequence into 2 halves.
1053  // When n is odd or n > 1000, the median is kth element k = (n + 1) / 2.
1054  // when n is even and n < 1000the median is a mean of the elements k = n/2 and k = n/2 + 1.
1055  //
1056  // If the weights are supplied (w not 0) all weights must be >= 0
1057  //
1058  // If work is supplied, it is used to store the sorting index and assumed to be
1059  // >= n . If work=0, local storage is used, either on the stack if n < kWorkMax
1060  // or on the heap for n >= kWorkMax .
1061 
1062  const Int_t kWorkMax = 100;
1063 
1064  if (n <= 0 || !a) return 0;
1065  Bool_t isAllocated = kFALSE;
1066  Double_t median;
1067  Long64_t *ind;
1068  Long64_t workLocal[kWorkMax];
1069 
1070  if (work) {
1071  ind = work;
1072  } else {
1073  ind = workLocal;
1074  if (n > kWorkMax) {
1075  isAllocated = kTRUE;
1076  ind = new Long64_t[n];
1077  }
1078  }
1079 
1080  if (w) {
1081  Double_t sumTot2 = 0;
1082  for (Int_t j = 0; j < n; j++) {
1083  if (w[j] < 0) {
1084  ::Error("TMath::Median","w[%d] = %.4e < 0 ?!",j,w[j]);
1085  if (isAllocated) delete [] ind;
1086  return 0;
1087  }
1088  sumTot2 += w[j];
1089  }
1090 
1091  sumTot2 /= 2.;
1092 
1093  Sort(n, a, ind, kFALSE);
1094 
1095  Double_t sum = 0.;
1096  Int_t jl;
1097  for (jl = 0; jl < n; jl++) {
1098  sum += w[ind[jl]];
1099  if (sum >= sumTot2) break;
1100  }
1101 
1102  Int_t jh;
1103  sum = 2.*sumTot2;
1104  for (jh = n-1; jh >= 0; jh--) {
1105  sum -= w[ind[jh]];
1106  if (sum <= sumTot2) break;
1107  }
1108 
1109  median = 0.5*(a[ind[jl]]+a[ind[jh]]);
1110 
1111  } else {
1112 
1113  if (n%2 == 1)
1114  median = KOrdStat(n, a,n/2, ind);
1115  else {
1116  median = 0.5*(KOrdStat(n, a, n/2 -1, ind)+KOrdStat(n, a, n/2, ind));
1117  }
1118  }
1119 
1120  if (isAllocated)
1121  delete [] ind;
1122  return median;
1123 }
1124 
1125 
1126 
1127 
1128 template <class Element, typename Size>
1129 Element TMath::KOrdStat(Size n, const Element *a, Size k, Size *work)
1130 {
1131  // Returns k_th order statistic of the array a of size n
1132  // (k_th smallest element out of n elements).
1133  //
1134  // C-convention is used for array indexing, so if you want
1135  // the second smallest element, call KOrdStat(n, a, 1).
1136  //
1137  // If work is supplied, it is used to store the sorting index and
1138  // assumed to be >= n. If work=0, local storage is used, either on
1139  // the stack if n < kWorkMax or on the heap for n >= kWorkMax.
1140  // Note that the work index array will not contain the sorted indices but
1141  // all indeces of the smaller element in arbitrary order in work[0,...,k-1] and
1142  // all indeces of the larger element in arbitrary order in work[k+1,..,n-1]
1143  // work[k] will contain instead the index of the returned element.
1144  //
1145  // Taken from "Numerical Recipes in C++" without the index array
1146  // implemented by Anna Khreshuk.
1147  //
1148  // See also the declarations at the top of this file
1149 
1150  const Int_t kWorkMax = 100;
1151 
1152  typedef Size Index;
1153 
1154  Bool_t isAllocated = kFALSE;
1155  Size i, ir, j, l, mid;
1156  Index arr;
1157  Index *ind;
1158  Index workLocal[kWorkMax];
1159  Index temp;
1160 
1161  if (work) {
1162  ind = work;
1163  } else {
1164  ind = workLocal;
1165  if (n > kWorkMax) {
1166  isAllocated = kTRUE;
1167  ind = new Index[n];
1168  }
1169  }
1170 
1171  for (Size ii=0; ii<n; ii++) {
1172  ind[ii]=ii;
1173  }
1174  Size rk = k;
1175  l=0;
1176  ir = n-1;
1177  for(;;) {
1178  if (ir<=l+1) { //active partition contains 1 or 2 elements
1179  if (ir == l+1 && a[ind[ir]]<a[ind[l]])
1180  {temp = ind[l]; ind[l]=ind[ir]; ind[ir]=temp;}
1181  Element tmp = a[ind[rk]];
1182  if (isAllocated)
1183  delete [] ind;
1184  return tmp;
1185  } else {
1186  mid = (l+ir) >> 1; //choose median of left, center and right
1187  {temp = ind[mid]; ind[mid]=ind[l+1]; ind[l+1]=temp;}//elements as partitioning element arr.
1188  if (a[ind[l]]>a[ind[ir]]) //also rearrange so that a[l]<=a[l+1]
1189  {temp = ind[l]; ind[l]=ind[ir]; ind[ir]=temp;}
1190 
1191  if (a[ind[l+1]]>a[ind[ir]])
1192  {temp=ind[l+1]; ind[l+1]=ind[ir]; ind[ir]=temp;}
1193 
1194  if (a[ind[l]]>a[ind[l+1]])
1195  {temp = ind[l]; ind[l]=ind[l+1]; ind[l+1]=temp;}
1196 
1197  i=l+1; //initialize pointers for partitioning
1198  j=ir;
1199  arr = ind[l+1];
1200  for (;;){
1201  do i++; while (a[ind[i]]<a[arr]);
1202  do j--; while (a[ind[j]]>a[arr]);
1203  if (j<i) break; //pointers crossed, partitioning complete
1204  {temp=ind[i]; ind[i]=ind[j]; ind[j]=temp;}
1205  }
1206  ind[l+1]=ind[j];
1207  ind[j]=arr;
1208  if (j>=rk) ir = j-1; //keep active the partition that
1209  if (j<=rk) l=i; //contains the k_th element
1210  }
1211  }
1212 }
1213 
1214 #endif
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
long double LongDouble_t
Definition: RtypesCore.h:57
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
void Error(Ts &&... args)
Definition: TError.h:46
#define N
Definition: mixmax.h:31
double beta(double z, double w)
double gamma(double x)
Double_t FDistI(Double_t F, Double_t N, Double_t M)
Double_t GeomMean(Long64_t n, const T *a)
Definition: TMath.h:817
Double_t LogNormal(Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
constexpr Double_t G()
Definition: TMath.h:106
Double_t CosH(Double_t)
Definition: TMath.h:497
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Definition: TMath.h:994
Double_t DiLog(Double_t x)
Double_t BetaDist(Double_t x, Double_t p, Double_t q)
Double_t ACos(Double_t)
Definition: TMath.h:509
Double_t BesselI(Int_t n, Double_t x)
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Definition: TMath.h:1129
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Bool_t IsNaN(Double_t x)
Definition: TMath.h:592
constexpr Double_t GUncertainty()
Definition: TMath.h:114
constexpr Double_t C()
Definition: TMath.h:92
Double_t Factorial(Int_t i)
constexpr Double_t GhbarCUncertainty()
Definition: TMath.h:124
Long64_t LocMin(Long64_t n, const T *a)
Definition: TMath.h:657
constexpr Double_t Ccgs()
Definition: TMath.h:96
constexpr Double_t SigmaUncertainty()
Definition: TMath.h:196
Int_t Nint(T x)
Definition: TMath.h:544
Double_t BinomialI(Double_t p, Int_t n, Int_t k)
Double_t Vavilov(Double_t x, Double_t kappa, Double_t beta2)
Double_t Binomial(Int_t n, Int_t k)
Float_t Normalize(Float_t v[3])
constexpr Double_t NaUncertainty()
Definition: TMath.h:206
Double_t Prob(Double_t chi2, Int_t ndf)
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Definition: TMath.h:1018
Double_t ASin(Double_t)
Definition: TMath.h:503
Double_t Log2(Double_t x)
Double_t BesselK1(Double_t x)
void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2)
Double_t Exp(Double_t x)
Definition: TMath.h:559
Double_t BesselI1(Double_t x)
Double_t Erf(Double_t x)
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
Definition: TMath.h:939
Bool_t Permute(Int_t n, Int_t *a)
Double_t QuietNaN()
Definition: TMath.h:597
Double_t Floor(Double_t x)
Definition: TMath.h:537
Double_t PoissonI(Double_t x, Double_t par)
Double_t CauchyDist(Double_t x, Double_t t=0, Double_t s=1)
Double_t ATan(Double_t)
Definition: TMath.h:515
Double_t StruveL1(Double_t x)
constexpr Double_t Gn()
Definition: TMath.h:130
Double_t ASinH(Double_t)
Double_t LaplaceDistI(Double_t x, Double_t alpha=0, Double_t beta=1)
Double_t Normalize(Double_t v[3])
constexpr Double_t QeUncertainty()
Definition: TMath.h:248
constexpr Double_t K()
Definition: TMath.h:178
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
constexpr Double_t Sqrt2()
Definition: TMath.h:68
constexpr Double_t KUncertainty()
Definition: TMath.h:186
constexpr Double_t Hbarcgs()
Definition: TMath.h:158
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
Double_t Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
Double_t Student(Double_t T, Double_t ndf)
constexpr Double_t CUncertainty()
Definition: TMath.h:100
constexpr Double_t Qe()
Definition: TMath.h:244
Double_t Ceil(Double_t x)
Definition: TMath.h:531
constexpr Double_t PiOver2()
Definition: TMath.h:48
constexpr Double_t HCcgs()
Definition: TMath.h:172
T MinElement(Long64_t n, const T *a)
Definition: TMath.h:643
Double_t BetaDistI(Double_t x, Double_t p, Double_t q)
T NormCross(const T v1[3], const T v2[3], T out[3])
Definition: TMath.h:636
Int_t Finite(Double_t x)
Double_t TanH(Double_t)
Definition: TMath.h:500
Int_t FloorNint(Double_t x)
Definition: TMath.h:540
Double_t ACosH(Double_t)
Double_t BesselK0(Double_t x)
Double_t BesselY0(Double_t x)
constexpr Double_t RUncertainty()
Definition: TMath.h:217
Double_t BetaCf(Double_t x, Double_t a, Double_t b)
Long64_t LocMax(Long64_t n, const T *a)
Definition: TMath.h:686
Double_t ErfInverse(Double_t x)
Double_t LaplaceDist(Double_t x, Double_t alpha=0, Double_t beta=1)
constexpr Double_t E()
Definition: TMath.h:74
constexpr Double_t GnUncertainty()
Definition: TMath.h:134
constexpr Double_t Hcgs()
Definition: TMath.h:144
Double_t ATan2(Double_t, Double_t)
Definition: TMath.h:518
constexpr Double_t HUncertainty()
Definition: TMath.h:148
Double_t Log(Double_t x)
Definition: TMath.h:586
constexpr Double_t DegToRad()
Definition: TMath.h:64
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:786
Double_t Erfc(Double_t x)
Double_t VavilovI(Double_t x, Double_t kappa, Double_t beta2)
constexpr Double_t Sigma()
Definition: TMath.h:192
Double_t Beta(Double_t p, Double_t q)
constexpr Double_t Kcgs()
Definition: TMath.h:182
Double_t Sq(Double_t x)
Definition: TMath.h:525
Double_t Poisson(Double_t x, Double_t par)
constexpr Double_t H()
Definition: TMath.h:140
Double_t Sqrt(Double_t x)
Definition: TMath.h:528
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:565
Int_t CeilNint(Double_t x)
Definition: TMath.h:534
Double_t Ldexp(Double_t x, Int_t exp)
Definition: TMath.h:562
Double_t BesselJ0(Double_t x)
constexpr Double_t LogE()
Definition: TMath.h:86
Double_t Gamma(Double_t z)
constexpr Double_t MWair()
Definition: TMath.h:225
constexpr Double_t Gcgs()
Definition: TMath.h:110
Double_t StruveL0(Double_t x)
Double_t NormQuantile(Double_t p)
constexpr Double_t Ln10()
Definition: TMath.h:80
Double_t Hypot(Double_t x, Double_t y)
constexpr Double_t EulerGamma()
Definition: TMath.h:238
constexpr Double_t PiOver4()
Definition: TMath.h:52
Double_t Cos(Double_t)
Definition: TMath.h:488
constexpr Double_t Pi()
Definition: TMath.h:40
Double_t StruveH0(Double_t x)
constexpr Double_t R()
Definition: TMath.h:213
Double_t LnGamma(Double_t z)
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Definition: TMath.h:322
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
Definition: TMath.h:318
Double_t KolmogorovProb(Double_t z)
constexpr Double_t InvPi()
Definition: TMath.h:56
Bool_t RootsCubic(const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
Double_t ChisquareQuantile(Double_t p, Double_t ndf)
Double_t Sin(Double_t)
Definition: TMath.h:485
Double_t FDist(Double_t F, Double_t N, Double_t M)
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:878
Double_t SignalingNaN()
Definition: TMath.h:604
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Definition: TMath.h:964
T * Cross(const T v1[3], const T v2[3], T out[3])
Definition: TMath.h:982
void BubbleLow(Int_t Narr, Double_t *arr1, Int_t *arr2)
Double_t BesselK(Int_t n, Double_t x)
constexpr Double_t Na()
Definition: TMath.h:202
Double_t Median(Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0)
Definition: TMath.h:1039
T MaxElement(Long64_t n, const T *a)
Definition: TMath.h:650
Double_t BesselJ1(Double_t x)
Double_t BetaIncomplete(Double_t x, Double_t a, Double_t b)
constexpr Double_t Rgair()
Definition: TMath.h:232
constexpr Double_t Hbar()
Definition: TMath.h:154
Double_t StruveH1(Double_t x)
Double_t Freq(Double_t x)
Double_t Tan(Double_t)
Definition: TMath.h:491
Double_t LandauI(Double_t x)
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Definition: TMath.h:906
Double_t ATanH(Double_t)
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
constexpr Double_t RadToDeg()
Definition: TMath.h:60
Double_t BesselI0(Double_t x)
Double_t Log10(Double_t x)
Definition: TMath.h:589
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 BesselY1(Double_t x)
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:438
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
constexpr Double_t GhbarC()
Definition: TMath.h:120
constexpr Double_t HC()
Definition: TMath.h:168
constexpr Double_t TwoPi()
Definition: TMath.h:44
constexpr Double_t HbarUncertainty()
Definition: TMath.h:162
Double_t Infinity()
Definition: TMath.h:610
Double_t ErfcInverse(Double_t x)
Double_t SinH(Double_t)
Definition: TMath.h:494
T fData
Definition: TMath.h:736
bool operator()(Index i1, Index i2)
Definition: TMath.h:732
CompareAsc(T d)
Definition: TMath.h:729
bool operator()(Index i1, Index i2)
Definition: TMath.h:719
CompareDesc(T d)
Definition: TMath.h:716
static T Min()
Definition: TMath.h:616
static T Epsilon()
Definition: TMath.h:628
static T Max()
Definition: TMath.h:622