26 DK(KSQRTPII,0.56418958354775628694807945156077258584405062932900);
28 static inline R alpha_al(
const int k,
const int n)
33 return IF(k%2,K(1.0),K(-1.0));
35 return SQRT(((R)(2*k+1))/((R)(k-n+1)))*SQRT((((R)(2*k+1))/((R)(k+n+1))));
42 return IF(n%2,K(0.0),K(-1.0));
47 static inline R beta_al(
const int k,
const int n)
55 static inline R gamma_al(
const int k,
const int n)
58 return SQRT(KSQRTPII*nfft_lambda((R)(n),K(0.5)));
62 return -SQRT(((R)(k-n))/((R)(k-n+1))*((R)(k+n))/((R)(k+n+1)));
65 void alpha_al_row(R *alpha,
const int N,
const int n)
69 for (j = -1; j <= N; j++)
73 void beta_al_row(R *beta,
const int N,
const int n)
77 for (j = -1; j <= N; j++)
81 void gamma_al_row(R *gamma,
const int N,
const int n)
85 for (j = -1; j <= N; j++)
93 for (i = 0; i <= N; i++)
94 for (j = -1; j <= N; j++)
102 for (i = 0; i <= N; i++)
103 for (j = -1; j <= N; j++)
111 for (i = 0; i <= N; i++)
112 for (j = -1; j <= N; j++)
113 *p++ = gamma_al(j,i);
116 void eval_al(R *x, R *y,
const int size,
const int k, R *alpha,
123 R a,b,x_val_act,a_old;
125 R *alpha_act, *beta_act, *gamma_act;
130 for (i = 0; i < size; i++)
142 alpha_act = &(alpha[k]);
143 beta_act = &(beta[k]);
144 gamma_act = &(gamma[k]);
145 for (j = k; j > 1; j--)
148 a = b + a_old*((*alpha_act)*x_val_act+(*beta_act));
149 b = a_old*(*gamma_act);
154 *y_act = (a*((*alpha_act)*x_val_act+(*beta_act))+b);
162 R *beta, R *gamma, R threshold)
168 R a,b,x_val_act,a_old;
170 R *alpha_act, *beta_act, *gamma_act;
175 for (i = 0; i < size; i++)
187 alpha_act = &(alpha[k]);
188 beta_act = &(beta[k]);
189 gamma_act = &(gamma[k]);
190 for (j = k; j > 1; j--)
193 a = b + a_old*((*alpha_act)*x_val_act+(*beta_act));
194 b = a_old*(*gamma_act);
199 *y_act = (a*((*alpha_act)*x_val_act+(*beta_act))+b);
200 if (fabs(*y_act) > threshold)
void alpha_al_all(R *alpha, const int N)
Compute three-term-recurrence coefficients of associated Legendre functions for .
int eval_al_thresh(R *x, R *y, const int size, const int k, R *alpha, R *beta, R *gamma, R threshold)
Evaluates an associated Legendre polynomials using the Clenshaw-algorithm if it no exceeds a given t...
void beta_al_all(R *alpha, const int N)
Compute three-term-recurrence coefficients of associated Legendre functions for .
void gamma_al_all(R *alpha, const int N)
Compute three-term-recurrence coefficients of associated Legendre functions for .
void eval_al(R *x, R *y, const int size, const int k, R *alpha, R *beta, R *gamma)
Evaluates an associated Legendre polynomials using the Clenshaw-algorithm.