8 #if defined __cplusplus
29 if( Legendre == NULL )
return( NULL );
34 for( l = 0; l <= Legendre->
maxOrder; l++ ) Legendre->
Cls[l] = Cls[l];
43 if( maxOrder < 0 ) maxOrder = -1;
46 if( initialSize < ( maxOrder + 1 ) ) initialSize = maxOrder + 1;
85 Legendre->
Cls = (
double *)
nfu_realloc( size *
sizeof(
double ), Legendre->
Cls ); }
88 if( ( Legendre->
allocated > 2 * size ) || forceSmallerResize ) {
89 Legendre->
Cls = (
double *)
nfu_realloc( size *
sizeof(
double ), Legendre->
Cls ); }
94 if( Legendre->
Cls == NULL ) {
122 if( ( l < 0 ) || ( l > Legendre->
maxOrder ) ) {
126 return( Legendre->
Cls[l] );
140 Legendre->
Cls[l] = Cl;
153 for( l = 0; l <= Legendre->
maxOrder; l++ ) Legendre->
Cls[l] /= norm;
166 if( ( mu >= -1. ) && ( mu <= 1. ) ) {
178 double Pl_minus1, Pl, Pl_plus1;
209 for( l_ = 0, twoL_plus1 = 1; l_ < l; l_++, twoL_plus1 += 2 ) {
212 Pl_plus1 = ( twoL_plus1 * mu * Pl - l_ * Pl_minus1 ) / ( l_ + 1 );
223 void *argList = (
void *) Legendre;
229 if( n > 249 ) n = 249;
232 for( i = 1; i <
n; i++ ) xs[i] = xs[i-1] + dx;
254 double mu1, mu2,
f1,
f2, Cl, Cls[1] = { 0 }, integral;
271 if( ( Legendre =
nf_Legendre_new( maxOrder + 1, -1, Cls, status ) ) == NULL )
return( NULL );
274 for( l = 0; l <= maxOrder; l++ ) {
277 for( i = 1, Cl = 0; i <
n; i++ ) {
304 *f = ( args->
f1 * ( args->
mu2 - mu ) + args->
f2 * ( mu - args->
mu1 ) ) / ( args->
mu2 - args->
mu1 );
309 #if defined __cplusplus