Go to the source code of this file.
|
nf_Legendre * | nf_Legendre_new (int initialSize, int maxOrder, double *Cls, nfu_status *status) |
|
nfu_status | nf_Legendre_setup (nf_Legendre *Legendre, int initialSize, int maxOrder) |
|
nfu_status | nf_Legendre_release (nf_Legendre *Legendre) |
|
nf_Legendre * | nf_Legendre_free (nf_Legendre *Legendre) |
|
nf_Legendre * | nf_Legendre_clone (nf_Legendre *nfL, nfu_status *status) |
|
nfu_status | nf_Legendre_reallocateCls (nf_Legendre *Legendre, int size, int forceSmallerResize) |
|
int | nf_Legendre_maxOrder (nf_Legendre *Legendre) |
|
int | nf_Legendre_allocated (nf_Legendre *Legendre) |
|
double | nf_Legendre_getCl (nf_Legendre *Legendre, int l, nfu_status *status) |
|
nfu_status | nf_Legendre_setCl (nf_Legendre *Legendre, int l, double Cl) |
|
nfu_status | nf_Legendre_normalize (nf_Legendre *Legendre) |
|
double | nf_Legendre_evauluateAtMu (nf_Legendre *Legendre, double mu, nfu_status *status) |
|
double | nf_Legendre_PofL_atMu (int l, double mu) |
|
ptwXYPoints * | nf_Legendre_to_ptwXY (nf_Legendre *Legendre, double accuracy, int biSectionMax, int checkForRoots, nfu_status *status) |
|
nf_Legendre * | nf_Legendre_from_ptwXY (ptwXYPoints *ptwXY, int maxOrder, nfu_status *status) |
|
◆ nf_Legendre_allocated()
◆ nf_Legendre_clone()
Definition at line 70 of file nf_Legendre.cc.
70 {
71
73}
nf_Legendre * nf_Legendre_new(int initialSize, int maxOrder, double *Cls, nfu_status *status)
◆ nf_Legendre_evauluateAtMu()
Definition at line 160 of file nf_Legendre.cc.
160 {
161
162 int l;
163 double P = 0.;
164
166 if( ( mu >= -1. ) && ( mu <= 1. ) ) {
169 }
170 return( P );
171}
double nf_Legendre_PofL_atMu(int l, double mu)
◆ nf_Legendre_free()
◆ nf_Legendre_from_ptwXY()
Definition at line 250 of file nf_Legendre.cc.
250 {
251
254 double mu1, mu2, f1, f2, Cl, Cls[1] = { 0 }, integral;
256
258
262 return( NULL );
263 }
264
268 return( NULL );
269 }
270
271 if( ( Legendre =
nf_Legendre_new( maxOrder + 1, -1, Cls, status ) ) == NULL )
return( NULL );
272
274 for(
l = 0;
l <= maxOrder;
l++ ) {
277 for( i = 1, Cl = 0; i <
n; i++ ) {
284 goto err;
285 Cl += integral;
288 }
290 }
291 return( Legendre );
292
293err:
295 return( NULL );
296}
nf_Legendre * nf_Legendre_free(nf_Legendre *Legendre)
nfu_status nf_Legendre_setCl(nf_Legendre *Legendre, int l, double Cl)
#define nf_Legendre_maxMaxOrder
nfu_status nf_Legendre_GaussianQuadrature(int degree, double x1, double x2, nf_Legendre_GaussianQuadrature_callback func, void *argList, double *integral)
int64_t ptwXY_length(ptwXYPoints *ptwXY)
nfu_status ptwXY_getStatus(ptwXYPoints *ptwXY)
nfu_status ptwXY_getXYPairAtIndex(ptwXYPoints *ptwXY, int64_t index, double *x, double *y)
◆ nf_Legendre_getCl()
Definition at line 119 of file nf_Legendre.cc.
119 {
120
122 if( ( l < 0 ) || ( l > Legendre->
maxOrder ) ) {
124 return( 0. );
125 }
126 return( Legendre->
Cls[l] );
127}
◆ nf_Legendre_maxOrder()
◆ nf_Legendre_new()
Definition at line 23 of file nf_Legendre.cc.
23 {
24
25 int l;
27
29 if( Legendre == NULL ) return( NULL );
32 return( NULL );
33 }
34 for( l = 0; l <= Legendre->
maxOrder; l++ ) Legendre->
Cls[l] = Cls[l];
35 return( Legendre );
36}
nfu_status nf_Legendre_setup(nf_Legendre *Legendre, int initialSize, int maxOrder)
void * nfu_malloc(size_t size)
Referenced by nf_Legendre_clone(), and nf_Legendre_from_ptwXY().
◆ nf_Legendre_normalize()
Definition at line 146 of file nf_Legendre.cc.
146 {
147
148 int l;
149 double norm;
150
153 for( l = 0; l <= Legendre->
maxOrder; l++ ) Legendre->
Cls[l] /= norm;
154 }
156}
◆ nf_Legendre_PofL_atMu()
double nf_Legendre_PofL_atMu |
( |
int |
l, |
|
|
double |
mu |
|
) |
| |
Definition at line 175 of file nf_Legendre.cc.
175 {
176
177 int l_, twoL_plus1;
178 double Pl_minus1, Pl, Pl_plus1;
179
180 if( l == 0 ) {
181 return( 1. ); }
182 else if( l == 1 ) {
183 return( mu ); }
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207 Pl = 0.;
208 Pl_plus1 = 1.;
209 for( l_ = 0, twoL_plus1 = 1; l_ < l; l_++, twoL_plus1 += 2 ) {
210 Pl_minus1 = Pl;
211 Pl = Pl_plus1;
212 Pl_plus1 = ( twoL_plus1 * mu * Pl - l_ * Pl_minus1 ) / ( l_ + 1 );
213 }
214 return( Pl_plus1 );
215}
Referenced by nf_Legendre_evauluateAtMu().
◆ nf_Legendre_reallocateCls()
Definition at line 77 of file nf_Legendre.cc.
77 {
78
80
85 Legendre->
Cls = (
double *)
nfu_realloc( size *
sizeof(
double ), Legendre->
Cls ); }
86 else {
88 if( ( Legendre->
allocated > 2 * size ) || forceSmallerResize ) {
89 Legendre->
Cls = (
double *)
nfu_realloc( size *
sizeof(
double ), Legendre->
Cls ); }
90 else {
92 }
93 }
94 if( Legendre->
Cls == NULL ) {
95 size = 0;
97 }
99 }
100 return( status );
101}
#define nf_Legendre_minMaxOrder
enum nfu_status_e nfu_status
void * nfu_realloc(size_t size, void *old)
Referenced by nf_Legendre_setCl(), and nf_Legendre_setup().
◆ nf_Legendre_release()
◆ nf_Legendre_setCl()
Definition at line 131 of file nf_Legendre.cc.
131 {
132
134
138 }
140 Legendre->
Cls[l] = Cl;
142}
nfu_status nf_Legendre_reallocateCls(nf_Legendre *Legendre, int size, int forceSmallerResize)
#define nf_Legendre_sizeIncrement
Referenced by nf_Legendre_from_ptwXY().
◆ nf_Legendre_setup()
Definition at line 40 of file nf_Legendre.cc.
40 {
41
43 if( maxOrder < 0 ) maxOrder = -1;
46 if( initialSize < ( maxOrder + 1 ) ) initialSize = maxOrder + 1;
48}
Referenced by nf_Legendre_new().
◆ nf_Legendre_to_ptwXY()
Definition at line 219 of file nf_Legendre.cc.
219 {
220
222 double dx, xs[1000];
223 void *argList = (void *) Legendre;
224
226 xs[0] = -1;
229 if( n > 249 )
n = 249;
232 for( i = 1; i <
n; i++ ) xs[i] = xs[i-1] + dx;
233 }
235 return(
ptwXY_createFromFunction( n + 1, xs, nf_Legendre_to_ptwXY2, (
void *) argList, accuracy, checkForRoots, biSectionMax, status ) );
236}
ptwXYPoints * ptwXY_createFromFunction(int n, double *xs, ptwXY_createFromFunction_callback func, void *argList, double accuracy, int checkForRoots, int biSectionMax, nfu_status *status)