Debian Codegraph @

src/ITGSend/newran/utility.h

raw symbols SCIP
1 /// \ingroup newran
2 ///@{
3
4 /// \file utility.h
5 /// Some miscellanous functions I need.
6 ///
7 /// The small ones (square and cube) are compiled inline so I give their
8 /// full details here.
9 ///
10 /// The large one(s) (invchi95) are compiled separately so I give just the
11 /// definition and the actual code is in utility.cpp.
12 ///
13 /// Also define the time lapse class.
14
15
16 // C and C++ don't provide the exponentiation operator (** in Fortran)
17 // so I provide a function for taking squares and cubes of numbers.
18
19 #ifndef UTILITY_H
20 #define UTILITY_H
21
22 #ifdef use_namespace
23 using namespace RBD_COMMON;
24 #endif
25
26
27 inline double square(double x) { return x*x; } ///< return x squared.
28
29 inline double cube(double x) { return x*x*x; } ///< return x cubed.
30
31 inline long iround(double x) { return (long)floor(x + 0.5); }
32 ///< rounded version of x.
33
34
35 /// Calculate 95% point of chi-squared distribution.
36 double invchi95(int N);
37
38
39 /// Calculate 99% point of chi-squared distribution.
40 double invchi99(int N);
41
42
43 /// Calculate 99.9% point of chi-squared distribution.
44 double invchi999(int N);
45
46
47 /// Inverse of chisquared distribution.
48 Real invchi(Real p, int df, bool upper = false);
49
50
51 /// Cdf of normal distribution function.
52 double cdfnml(double x);
53
54 /// Inverse cdf of normal distribution function.
55 double invcdfnml(double p);
56
57
58 /// Chi-squared distribution function.
59 double cdf_chisq(double x, int df, bool upper=false);
60
61
62 /// Upper tail probabilities for 2 sided Kolmogorov-Smirnov test.
63 double KS_probabilities(double z);
64
65
66
67 /// Print time between construction and destruction.
68 class time_lapse
69 {
70 double start_time;
71 public:
72 time_lapse();
73 ~time_lapse();
74 };
75
76
77
78
79
80 #endif
81
82
83 // body file: utility.cpp
84
85 ///@}
86