Kindfield
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
boysfunctionintermediate.h
Go to the documentation of this file.
1 #ifndef BOYSFUNCTIONINTERMEDIATE_H
2 #define BOYSFUNCTIONINTERMEDIATE_H
3 
4 #include <armadillo>
5 
6 using namespace arma;
7 
9 {
10 public:
11  BoysFunctionIntermediate(int levelMax = 20, int nValues = 1000, double limitMin = 0.0, double limitMax = 50.0, int nIntegralValues=1e7);
12 
13  double result(double arg, int n) const;
14  void updateResults();
15 
16  // TODO: Ensure we are using the correct levelMax
18  static BoysFunctionIntermediate instance;
19  return instance;
20  }
21 
22 protected:
23  const int m_taylorExpansionOrder = 6;
24  double m_dx;
25  double m_dxInverse;
26 
27  uint m_nValues;
30  double m_limitMin;
31  double m_limitMax;
33 
34  mat m_results;
35  vec m_args;
36  double integrand(double x, double t, double n) const;
37  double directIntegral(double x, double n) const;
38  double fastPow(double x, int a) const;
39 
40 private:
41  // Added to protect from copying
43  void operator=(const BoysFunctionIntermediate&);
44 
45  double factorialInverseTable[40];
46 };
47 
48 #endif // BOYSFUNCTIONINTERMEDIATE_H