16 int mapsize = L*(2*L-1);
46 long totalsize = N*flmsize;
47 *flmn = (complex
double*)calloc(totalsize,
sizeof(complex
double));
56 long totalsize = (N) * frsize;
57 *f = (complex
double*)calloc(totalsize,
sizeof(complex
double));
66 long totalsize = (N) * frsize;
67 *f = (
double*)calloc(totalsize,
sizeof(
double));
72 const complex
double *f,
73 int L,
double tau,
int N,
int spin)
82 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
83 int offset_lm, offset_r;
88 for (n = 0; n < N; n++){
90 offset_lm = n * flmsize;
91 offset_r = n * frsize;
92 ssht_core_mw_forward_sov_conv_sym(flmr + offset_lm, f + offset_r, L, spin, dl_method, verbosity);
95 double *nodes = (
double*)calloc(N,
sizeof(
double));
96 double *weights = (
double*)calloc(N,
sizeof(
double));
97 assert(nodes != NULL);
98 assert(weights != NULL);
111 const complex
double *flmn,
112 const double *nodes,
int Nnodes,
113 int L,
double tau,
int N,
int spin)
117 assert(nodes != NULL);
120 int n, offset_lm, offset_r;
123 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
125 complex
double *flmr;
131 for (n = 0; n < Nnodes; n++){
133 offset_lm = n * flmsize;
134 offset_r = n * frsize;
135 ssht_core_mw_inverse_sov_sym(f + offset_r, flmr + offset_lm, L, spin, dl_method, verbosity);
142 const double *f,
int L,
double tau,
int N)
147 int n, offset_lm, offset_r;
150 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
152 complex
double *flmr;
155 for (n = 0; n < N; n++){
157 offset_lm = n * flmsize;
158 offset_r = n * frsize;
159 ssht_core_mw_forward_sov_conv_sym_real(flmr + offset_lm, f + offset_r, L, dl_method, verbosity);
162 double *nodes = (
double*)calloc(N,
sizeof(
double));
163 double *weights = (
double*)calloc(N,
sizeof(
double));
164 assert(nodes != NULL);
165 assert(weights != NULL);
177 const complex
double *flmn,
178 const double *nodes,
int Nnodes,
179 int L,
double tau,
int N)
184 int n, offset_lm, offset_r;
187 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
189 complex
double *flmr;
195 for (n = 0; n < Nnodes; n++){
197 offset_lm = n * flmsize;
198 offset_r = n * frsize;
199 ssht_core_mw_inverse_sov_sym_real(f + offset_r, flmr + offset_lm, L, dl_method, verbosity);
210 double LN2 = 0.6931471805599453094;
211 double ONEMLN2 = 0.30685281944005469058277;
212 double PID2 = 1.5707963267948966192313217;
213 double PID4 = 0.78539816339744830961566084582;
214 double ROOTPI12 = 21.269446210866192327578;
215 double GAMMA1 = 2.6789385347077476336556;
216 double GAMMA2 = 1.3541179394264004169452;
218 double NU, NU2, BETA, BETA2, COSB;
220 double COTB, COT3B, COT6B, SECB, SEC2B;
221 double TRIGARG, EXPTERM, L3;
223 AX = pow(pow(X, 2.0), 0.5);
229 JL = 1.0 - AX2 / 6.0 * (1.0 - AX2 / 20.0);
235 JL = AX / 3.0 * (1.0 - AX2 / 10.0 * ( 1.0 - AX2 / 28.0 ) );
237 JL = (sin(AX) / AX - cos(AX)) / AX;
241 JL = AX2 / 15.0 * (1.0 - AX2 / 14.0 * (1.0 - AX2 / 36.0));
243 JL=(-3.00 * cos(AX) / AX - sin(AX) * (1.0 - 3.0 / AX2)) / AX;
247 JL = AX * AX2 / 105.0 * (1.0 - AX2 / 18.0 * (1.0 - AX2 / 44.0));
249 JL = (cos(AX) * (1.0 - 15.0 / AX2) - sin(AX) * (6.0 - 15.0 / AX2) / AX) / AX;
253 JL = pow(AX2 ,2.0) / 945.0 * (1.0 - AX2 / 22.0 * (1.0 - AX2 / 52.0));
255 JL = (sin(AX) * (1.0 - (45.0 - 105.0 / AX2) / AX2) + cos(AX) * (10.0 - 105.0 / AX2) / AX) / AX;
259 JL = pow(AX2, 2.0) * AX / 10395.0 * (1.0 - AX2 / 26.0 * (1.0 - AX2 / 60.0));
261 JL = (sin(AX) * (15.0 - (420.0 - 945.0 / AX2) / AX2) / AX - cos(AX) * (1.0 - (105.0 - 945.0 / AX2) / AX2)) / AX;
265 JL = pow(AX2, 3.0) / 135135.0 * (1.0 - AX2 / 30.0 * (1.0 - AX2 / 68.0));
267 JL = (sin(AX) * ( - 1.0 + (210.0 - (4725.0 - 10395.0 / AX2) / AX2) / AX2) +
268 cos(AX) * ( - 21.0 + (1260.0 - 10395.0 / AX2) / AX2) / AX) / AX;
277 else if( (AX2 / (
double)L) < 0.5){
278 JL = exp(L * log(AX / NU) - LN2 + NU * ONEMLN2 - (1.0 - (1.0 - 3.50 / NU2) / NU2 / 30.0) / 12.0 / NU)
279 / NU * (1.0 - AX2 / (4.0 * NU + 4.0) * (1.0 - AX2 / (8.0 * NU + 16.0) * (1.0 - AX2 / (12.0 * NU + 36.0))));
280 }
else if((pow(L, 2.0) / AX) < 5.0 - 1){
281 BETA = AX - PID2 * (L + 1);
282 JL = (cos(BETA) * (1.0 - (NU2 - 0.250) * (NU2 - 2.250) / 8.0 / AX2 * (1.0 - (NU2 - 6.25) * (NU2 - 12.250) / 48.0 / AX2))
283 - sin(BETA) * (NU2 - 0.250) / 2.0 / AX * (1.0 - (NU2 - 2.250) * (NU2 - 6.250) / 24.0 / AX2 * (1.0 - (NU2 - 12.25) *
284 (NU2 - 20.25) / 80.0 / AX2)) ) / AX ;
287 if(AX < NU - 1.31 * L3){
289 SX = sqrt(NU2 - AX2);
292 BETA = log(COSB + SX / AX);
293 COT3B = pow(COTB, 3.0);
294 COT6B = pow(COT3B, 2.0);
295 SEC2B = pow(SECB, 2.0);
296 EXPTERM = ( (2.0 + 3.0 * SEC2B) * COT3B / 24.0
297 - ( (4.0 + SEC2B) * SEC2B * COT6B / 16.0
298 + ((16.0 - (1512.0 + (3654.0 + 375.0 * SEC2B) * SEC2B) * SEC2B) * COT3B / 5760.0
299 + (32.0 + (288.0 + (232.0 + 13.0 * SEC2B) * SEC2B) * SEC2B) * SEC2B * COT6B / 128.0 / NU) * COT6B / NU)
301 JL = sqrt(COTB * COSB) / (2.0 * NU) * exp( - NU * BETA + NU / COTB - EXPTERM);
302 }
else if (AX > NU + 1.48 * L3){
304 SX = sqrt(AX2 - NU2);
308 COT3B = pow(COTB, 3.0);
309 COT6B = pow(COT3B, 2.0);
310 SEC2B = pow(SECB, 2.0);
311 TRIGARG = NU / COTB - NU * BETA - PID4
312 - ((2.0 + 3.0 * SEC2B) * COT3B / 24.0
313 + (16.0 - (1512.0 + (3654.0 + 375.0 * SEC2B) * SEC2B) * SEC2B) * COT3B * COT6B / 5760.0 / NU2) / NU;
314 EXPTERM = ( (4.0 + SEC2B) * SEC2B * COT6B / 16.0
315 - (32.0 + (288.0 + (232.0 + 13.0 * SEC2B) * SEC2B) * SEC2B) * SEC2B * pow(COT6B, 2.0) / 128.0 / NU2) / NU2;
316 JL = sqrt(COTB * COSB) / NU * exp( - EXPTERM) * cos(TRIGARG);
319 BETA2 = pow(BETA, 2.0);
322 SECB = pow(SX, 0.3333333333333333);
323 SEC2B = pow(SECB, 2.0);
324 JL = ( GAMMA1 * SECB + BETA * GAMMA2 * SEC2B
325 - (BETA2 / 18.0 - 1.0 / 45.0) * BETA * SX * SECB * GAMMA1
326 - ((BETA2 - 1.0) * BETA2 / 36.0 + 1.0 / 420.0) * SX * SEC2B * GAMMA2
327 + (((BETA2 / 1620.0 - 7.0 / 3240.0) * BETA2 + 1.0 / 648.0) * BETA2 - 1.0 / 8100.0) * SX2 * SECB * GAMMA1
328 + (((BETA2 / 4536.0 - 1.0 / 810.0) * BETA2 + 19.0 / 11340.0) * BETA2 - 13.0 / 28350.0) * BETA * SX2 * SEC2B * GAMMA2
329 - ((((BETA2 / 349920.0 - 1.0 / 29160.0) * BETA2 + 71.0 / 583200.0) * BETA2 - 121.0 / 874800.0) *
330 BETA2 + 7939.0 / 224532000.0) * BETA * SX2 * SX * SECB * GAMMA1) * sqrt(SX) / ROOTPI12;
336 if( (X < 0) && (L % 2 != 0) )
347 for (i = 0; i < Nnodes; i++)
348 jell[i] =
j_ell(nodes[i], ell);
355 const complex
double *f,
356 int L,
double tau,
int N)
366 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
367 int offset_lm, offset_r;
369 complex
double *flmr;
372 for (n = 0; n < N; n++){
374 offset_lm = n * flmsize;
375 offset_r = n * frsize;
376 ssht_core_mw_forward_sov_conv_sym(flmr + offset_lm, f + offset_r, L, spin, dl_method, verbosity);
379 double *nodes = (
double*)calloc(N,
sizeof(
double));
380 double *weights = (
double*)calloc(N,
sizeof(
double));
381 assert(nodes != NULL);
382 assert(weights != NULL);
395 const complex
double *flmn,
396 const double *nodes,
int Nnodes,
397 int L,
double tau,
int N)
401 assert(nodes != NULL);
405 int n, offset_lm, offset_r;
408 ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
410 complex
double *flmr;
416 for (n = 0; n < Nnodes; n++){
418 offset_lm = n * flmsize;
419 offset_r = n * frsize;
420 ssht_core_mw_inverse_sov_sym(f + offset_r, flmr + offset_lm, L, spin, dl_method, verbosity);
void flag_core_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N, int spin)
void flag_core_allocate_f(complex double **f, int L, int N)
void flag_core_allocate_flmn(complex double **flmn, int L, int N)
void flag_core_analysis(complex double *flmn, const complex double *f, int L, double tau, int N, int spin)
int flag_core_flmn_size(int L, int N)
void flag_core_synthesis_real(double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N)
void flag_spherlaguerre_mapped_synthesis(complex double *f, const complex double *fn, const double *nodes, int Nnodes, double tau, int N, int mapsize)
void flag_core_fourierbessel_analysis(complex double *flmn, const complex double *f, int L, double tau, int N)
void flag_core_allocate_f_real(double **f, int L, int N)
void flag_spherbessel_basis(double *jell, const int ell, const double *nodes, int Nnodes)
void flag_spherlaguerre_mapped_analysis(complex double *fn, const complex double *f, const double *nodes, const double *weights, double tau, int N, int mapsize)
int ssht_fr_size_mw(int L)
double j_ell(double X, int l)
void flag_core_fourierbessel_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N)
void flag_spherlaguerre_sampling(double *nodes, double *weights, double tau, int N)
void flag_core_analysis_real(complex double *flmn, const double *f, int L, double tau, int N)
int flag_core_f_size_mw(int L, int N)