CLASS MANUAL
hyperspherical.h
1 
5 #ifndef __HYPERSPHERICAL__
6 #define __HYPERSPHERICAL__
7 
8 #include "common.h"
9 #define _HYPER_OVERFLOW_ 1e200
10 #define _ONE_OVER_HYPER_OVERFLOW_ 1e-200
11 #define _HYPER_SAFETY_ 1e-5
12 #define _TRIG_PRECISSION_ 1e-7
13 #define _HYPER_BLOCK_ 8
14 #define _HYPER_CHUNK_ 16
15 #define _TWO_OVER_THREE_ 0.666666666666666666666666666667e0
16 #define _HIS_BYTE_ALIGNMENT_ 16
17 
18 typedef struct HypersphericalInterpolationStructure{
19  int K; //Sign of the curvature, (0,-1,1)
20  double beta;
21  double delta_x; //x-spacing. (xvec is uniformly spaced)
22  int trig_order; //Order of the interpolation formula for SinK and CosK.
23  int l_size; //Number of l values
24  int *l; //Vector of l values stored
25  double * chi_at_phimin; // vector x_min[index-l] below which neglect Bessels
26  int x_size; //Number of x-values
27  double *x; //Pointer to x-values
28  double *sinK; //Vector of sin_K(xvec)
29  double *cotK; //Vector of cot_K(xvec)
30  double *phi; //array of size nl*nx. [y_{l1}(x1) t_{l1}(x2)...]
31  double *dphi; //Same as phivec, but containing derivatives.
32 } HyperInterpStruct;
33 
34 struct WKB_parameters{
35  int K;
36  int l;
37  double beta;
38  double phiminabs;
39 };
40 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47  int hyperspherical_HIS_create(int K,
48  double beta,
49  int nl,
50  int *lvec,
51  double xmin,
52  double xmax,
53  double sampling,
54  int l_WKB,
55  double phiminabs,
56  HyperInterpStruct *pHIS,
57  ErrorMsg error_message);
58 
59  int hyperspherical_HIS_free(HyperInterpStruct *pHIS, ErrorMsg error_message);
60  int hyperspherical_forwards_recurrence(int K,
61  int lmax,
62  double beta,
63  double x,
64  double sinK,
65  double cotK,
66  double *sqrtK,
67  double *one_over_sqrtK,
68  double *PhiL);
69 int hyperspherical_forwards_recurrence_chunk(int K,
70  int lmax,
71  double beta,
72  double * __restrict__ x,
73  double * __restrict__ sinK,
74  double * __restrict__ cotK,
75  int chunk,
76  double * __restrict__ sqrtK,
77  double * __restrict__ one_over_sqrtK,
78  double * __restrict__ PhiL);
79  int hyperspherical_backwards_recurrence(int K,
80  int lmax,
81  double beta,
82  double x,
83  double sinK,
84  double cotK,
85  double *sqrtK,
86  double *one_over_sqrtK,
87  double *PhiL);
88 
89  int hyperspherical_backwards_recurrence_chunk(int K,
90  int lmax,
91  double beta,
92  double * __restrict__ x,
93  double * __restrict__ sinK,
94  double * __restrict__ cotK,
95  int chunk,
96  double * __restrict__ sqrtK,
97  double * __restrict__ one_over_sqrtK,
98  double * __restrict__ PhiL);
99  int hyperspherical_get_xmin(HyperInterpStruct *pHIS,
100  double xtol,
101  double phiminabs,
102  double *xmin);
103 
104  int hyperspherical_WKB(int K,int l,double beta,double y, double *Phi);
105  int hyperspherical_WKB_vec(int l,
106  double beta,
107  double *sinK_vec,
108  int size_sinK_vec,
109  double *Phi);
110  int ClosedModY(int l, int beta, double *y, int * phisign, int * dphisign);
111  int get_CF1(int K,int l,double beta, double cotK, double *CF, int *isign);
112  int CF1_from_Gegenbauer(int l, int beta, double sinK, double cotK, double *CF);
113  double airy_cheb_approx(double z);
114  double coef1(double z);
115  double coef2(double z);
116  double coef3(double z);
117  double coef4(double z);
118  double cheb(double x, int n, const double A[]);
119  double get_value_at_small_phi(int K,int l,double beta,double Phi);
120 
121  double PhiWKB_minus_phiminabs(double x, void *param);
122 
123  int hyperspherical_get_xmin_from_Airy(int K,
124  int l,
125  double beta,
126  double xtol,
127  double phiminabs,
128  double *xmin,
129  int *fevals
130  );
131 
132  int fzero_ridder(double (*func)(double, void *),
133  double x1,
134  double x2,
135  double xtol,
136  void *param,
137  double *Fx1,
138  double *Fx2,
139  double *xzero,
140  int *fevals
141  );
142 
143  int HypersphericalExplicit(int K,int l, double beta,double x, double *Phi);
144 
145  int hyperspherical_get_xmin_from_approx(int K,
146  int l,
147  double nu,
148  double ignore1,
149  double phiminabs,
150  double *xmin,
151  int *ignore2);
152 
153  size_t hyperspherical_HIS_size(int nl, int nx);
154  int hyperspherical_update_pointers(HyperInterpStruct *pHIS_local,
155  void * HIS_storage_shared);
156 
157  int hyperspherical_Hermite_interpolation_vector(HyperInterpStruct *pHIS,
158  int nxi,
159  int lnum,
160  double *xinterp,
161  double *Phi,
162  double *dPhi,
163  double *d2Phi);
164 
165  int hyperspherical_Hermite3_interpolation_vector_Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi, ErrorMsg error_message);
166  int hyperspherical_Hermite3_interpolation_vector_dPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi, ErrorMsg error_message);
167  int hyperspherical_Hermite3_interpolation_vector_d2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *d2Phi, ErrorMsg error_message);
168  int hyperspherical_Hermite3_interpolation_vector_PhidPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi, ErrorMsg error_message);
169  int hyperspherical_Hermite3_interpolation_vector_Phid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *d2Phi, ErrorMsg error_message);
170  int hyperspherical_Hermite3_interpolation_vector_dPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi,double *d2Phi, ErrorMsg error_message);
171  int hyperspherical_Hermite3_interpolation_vector_PhidPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi,double *d2Phi, ErrorMsg error_message);
172  int hyperspherical_Hermite4_interpolation_vector_Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi, ErrorMsg error_message);
173  int hyperspherical_Hermite4_interpolation_vector_dPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi, ErrorMsg error_message);
174  int hyperspherical_Hermite4_interpolation_vector_d2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *d2Phi, ErrorMsg error_message);
175  int hyperspherical_Hermite4_interpolation_vector_PhidPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi, ErrorMsg error_message);
176  int hyperspherical_Hermite4_interpolation_vector_Phid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *d2Phi, ErrorMsg error_message);
177  int hyperspherical_Hermite4_interpolation_vector_dPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi,double *d2Phi, ErrorMsg error_message);
178  int hyperspherical_Hermite4_interpolation_vector_PhidPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi,double *d2Phi, ErrorMsg error_message);
179  int hyperspherical_Hermite6_interpolation_vector_Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi, ErrorMsg error_message);
180  int hyperspherical_Hermite6_interpolation_vector_dPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi, ErrorMsg error_message);
181  int hyperspherical_Hermite6_interpolation_vector_d2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *d2Phi, ErrorMsg error_message);
182  int hyperspherical_Hermite6_interpolation_vector_PhidPhi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi, ErrorMsg error_message);
183  int hyperspherical_Hermite6_interpolation_vector_Phid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *d2Phi, ErrorMsg error_message);
184  int hyperspherical_Hermite6_interpolation_vector_dPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *dPhi,double *d2Phi, ErrorMsg error_message);
185  int hyperspherical_Hermite6_interpolation_vector_PhidPhid2Phi(HyperInterpStruct *pHIS,int nxi,int lnum,double *xinterp,double *Phi,double *dPhi,double *d2Phi, ErrorMsg error_message);
186 
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif