FLAG  1.0b1
Exact Fourier-Laguerre transform in spherical coordinates
flag_test.c
Go to the documentation of this file.
1 // FLAG package
2 // Copyright (C) 2012
3 // Boris Leistedt & Jason McEwen
4 
5 #include "flag.h"
6 #include <math.h>
7 #include <stdlib.h>
8 #include <complex.h>
9 #include <fftw3.h>
10 #include <ssht.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <assert.h>
14 #include <time.h>
15 
16 #define MAX(a,b) ((a) > (b) ? (a) : (b))
17 
18 double maxerr_cplx(complex double *a, complex double *b, int size)
19 {
20  double value = 0;
21  int i;
22  for(i = 0; i<size; i++){
23  //printf("%6.5e %6.5e %6.5e\n", creal(a[i]-b[i]), cimag(a[i]-b[i]), cabs(a[i]-b[i]));
24  value = MAX( cabs( a[i]-b[i] ), value );
25  }
26  return value;
27 }
28 
29 double maxerr(double *a, double *b, int size)
30 {
31  double value = 0;
32  int i;
33  for(i = 0; i<size; i++){
34  value = MAX( abs( a[i]-b[i] ), value );
35  }
36  return value;
37 }
38 
39 double ran2_dp(int idum)
40 {
41  int IM1=2147483563,IM2=2147483399,IMM1=IM1-1,
42  IA1=40014,IA2=40692,IQ1=53668,IQ2=52774,IR1=12211,IR2=3791,
43  NTAB=32,NDIV=1+IMM1/NTAB;
44 
45  double AM=1./IM1,EPS=1.2e-7,RNMX=1.-EPS;
46  int j,k;
47  static int iv[32],iy,idum2 = 123456789;
48  // N.B. in C static variables are initialised to 0 by default.
49 
50  if (idum <= 0) {
51  idum= (-idum>1 ? -idum : 1); // max(-idum,1);
52  idum2=idum;
53  for(j=NTAB+8;j>=1;j--) {
54  k=idum/IQ1;
55  idum=IA1*(idum-k*IQ1)-k*IR1;
56  if (idum < 0) idum=idum+IM1;
57  if (j < NTAB) iv[j-1]=idum;
58  }
59  iy=iv[0];
60  }
61  k=idum/IQ1;
62  idum=IA1*(idum-k*IQ1)-k*IR1;
63  if (idum < 0) idum=idum+IM1;
64  k=idum2/IQ2;
65  idum2=IA2*(idum2-k*IQ2)-k*IR2;
66  if (idum2 < 0) idum2=idum2+IM2;
67  j=1+iy/NDIV;
68  iy=iv[j-1]-idum2;
69  iv[j-1]=idum;
70  if(iy < 1)iy=iy+IMM1;
71  return (AM*iy < RNMX ? AM*iy : RNMX); // min(AM*iy,RNMX);
72 
73 }
74 
75 void flag_random_f(complex double *f, int L, int N, int seed)
76 {
77  int i;
78  srand( time(NULL) );
79  for (i=0; i<flag_core_f_size_mw(L, N); i++){
80  f[i] = (2.0*ran2_dp(seed) - 1.0) + I * (2.0*ran2_dp(seed) - 1.0);
81  }
82 }
83 
84 void flag_random_flmn(complex double *flmn, int L, int N, int seed)
85 {
86  int i;
87  srand( time(NULL) );
88  for (i=0; i<flag_core_flmn_size(L, N); i++){
89  flmn[i] = (2.0*ran2_dp(seed) - 1.0) + I * (2.0*ran2_dp(seed) - 1.0);//rand()/795079784.0;
90  }
91 }
92 
93 void flag_random_flmn_real(complex double *flmn, int L, int N, int seed)
94 {
95  int en, el, m, msign, i, i_op, offset;
96  int flmsize = ssht_flm_size(L);
97 
98  for (en=0; en<N; en++) {
99  offset = en * flmsize;
100  for (el=0; el<L; el++) {
101  m = 0;
102  ssht_sampling_elm2ind(&i, el, m);
103  flmn[offset+i] = (2.0*ran2_dp(seed) - 1.0);
104  for (m=1; m<=el; m++) {
105  ssht_sampling_elm2ind(&i, el, m);
106  flmn[offset+i] = (2.0*ran2_dp(seed) - 1.0) + I * (2.0*ran2_dp(seed) - 1.0);
107  ssht_sampling_elm2ind(&i_op, el, -m);
108  msign = m & 1;
109  msign = 1 - msign - msign; // (-1)^m
110  flmn[offset+i_op] = msign * conj(flmn[offset+i]);
111  }
112  }
113  }
114 }
115 
116 void print_f(const complex double *f,int L, int N)
117 {
118  int mapsize = (2*L-1)*L;
119  int n, j;
120  for(n=0;n<N+1;n++){
121  printf("\n -- Layer %i -- \n", n);
122  for(j=0;j<mapsize;j++){
123  printf(" (%f,%f) ",creal(f[n*mapsize+j]),cimag(f[n*mapsize+j]));
124  }
125  }
126  printf("\n");
127 }
128 
129 void print_f_real(const double *f,int L, int N)
130 {
131  int mapsize = (2*L-1)*L;
132  int n, j;
133  for(n=0;n<N+1;n++){
134  printf("\n -- Layer %i -- \n", n);
135  for(j=0;j<mapsize;j++){
136  printf(" %f ",(f[n*mapsize+j]));
137  }
138  }
139  printf("\n");
140 }
141 
142 void print_flmn(const complex double *flmn,int L, int N)
143 {
144  int mapsize = ssht_flm_size(L);
145  int n, j;
146  for(n=0;n<N;n++){
147  printf("\n -- Layer %i -- \n", n);
148  for(j=0;j<mapsize;j++){
149  printf(" (%f,%f) ",creal(flmn[n*mapsize+j]),cimag(flmn[n*mapsize+j]));
150  }
151  }
152  printf("\n");
153 }
154 
155 void flag_sampling_test(int L, int N, double tau)
156 {
157 
158  double *rs, *thetas, *phis, *laguweights;
159 
160  flag_sampling_allocate(&rs, &thetas, &phis, &laguweights, L, N);
161  flag_sampling(rs, thetas, phis, laguweights, tau, L, N);
162 
163  free(rs);
164  free(thetas);
165  free(phis);
166  free(laguweights);
167 
168 }
169 
171 {
172  double *roots = (double*)calloc(N, sizeof(double));
173  double *weights = (double*)calloc(N, sizeof(double));
174  const int alpha = ALPHA;
175 
176  flag_spherlaguerre_quadrature(roots, weights, N, alpha);
177  //int n;
178  //for (n=0; n<N+1; n++)
179  // printf("Root %i = %f with weight %f \n",n,roots[n],weights[n]);
180 
181 }
182 
184 {
185  const double R = 1.0;
186  double tau = flag_spherlaguerre_tau(R, N);
187  const int alpha = ALPHA;
188 
189  double *roots = (double*)calloc(N, sizeof(double));
190  double *weights = (double*)calloc(N, sizeof(double));
191  flag_spherlaguerre_quadrature(roots, weights, N, alpha);
192  double tau_bis = R / roots[N-1];
193  free(roots);
194  free(weights);
195 
196  //printf("Tau = %4.4e\n",tau);
197  //printf("Taubis = %4.4e\n",tau_bis);
198 
199  assert(tau != 0);
200  assert(cabs(tau_bis-tau) < 1e-14);
201 }
202 
203 void flag_spherlaguerre_sampling_test(int N, double tau)
204 {
205  double *nodes = (double*)calloc(N, sizeof(double));
206  double *weights = (double*)calloc(N, sizeof(double));
207 
208  flag_spherlaguerre_sampling(nodes, weights, tau, N);
209  assert(nodes != NULL);
210  assert(weights != NULL);
211 
212  //int n;for (n=0; n<N+1; n++)
213  // printf("Node %i = %f \n",n,nodes[n]);
214  free(nodes);
215  free(weights);
216 }
217 
218 void flag_spherlaguerre_cmplx_transform_test(int L, int N, double tau, int seed)
219 {
220  clock_t time_start, time_end;
221  complex double *f, *fn, *fn_rec;
222  int flmsize = ssht_flm_size(L);
223 
224  flag_core_allocate_f(&f, L, N);
225  flag_core_allocate_flmn(&fn, L, N);
226  flag_core_allocate_flmn(&fn_rec, L, N);
227 
228  flag_random_flmn(fn, L, N, seed);
229 
230  double *nodes = (double*)calloc(N, sizeof(double));
231  double *weights = (double*)calloc(N, sizeof(double));
232 
233  flag_spherlaguerre_sampling(nodes, weights, tau, N);
234 
235  time_start = clock();
236  flag_spherlaguerre_mapped_synthesis(f, fn, nodes, N, tau, N, flmsize);
237  time_end = clock();
238  printf(" - Duration of mapped inverse synthesis : %4.4f seconds\n",
239  (time_end - time_start) / (double)CLOCKS_PER_SEC);
240 
241  time_start = clock();
242  flag_spherlaguerre_mapped_analysis(fn_rec, f, nodes, weights, tau, N, flmsize);
243  time_end = clock();
244  printf(" - Duration of mapped forward analysis : %4.4f seconds\n",
245  (time_end - time_start) / (double)CLOCKS_PER_SEC);
246 
247  printf(" - Maximum abs error on reconstruction : %6.5e\n",
248  maxerr_cplx(fn, fn_rec, N));
249 
250 
251  free(f);
252  free(fn);
253  free(fn_rec);
254  free(weights);
255  free(nodes);
256 }
257 
258 void flag_spherlaguerre_transform_test(int N, double tau)
259 {
260  clock_t time_start, time_end;
261  double *f = (double*)calloc(N, sizeof(double));
262  double *fn = (double*)calloc(N, sizeof(double));
263  double *fnrec = (double*)calloc(N, sizeof(double));
264  int n;
265 
266  srand ( time(NULL) );
267 
268  for (n=0; n<N; n++){
269  fn[n] = rand()/795079784.0;
270  }
271 
272  double *nodes = (double*)calloc(N, sizeof(double));
273  double *weights = (double*)calloc(N, sizeof(double));
274 
275  flag_spherlaguerre_sampling(nodes, weights, tau, N);
276 
277  time_start = clock();
278  flag_spherlaguerre_synthesis(f, fn, nodes, N, tau, N);
279  time_end = clock();
280  printf(" - Duration of 1D inverse synthesis : %4.0e seconds\n",
281  (time_end - time_start) / (double)CLOCKS_PER_SEC);
282 
283  time_start = clock();
284  flag_spherlaguerre_analysis(fnrec, f, nodes, weights, tau, N);
285  time_end = clock();
286  printf(" - Duration of 1D forward analysis : %4.0e seconds\n",
287  (time_end - time_start) / (double)CLOCKS_PER_SEC);
288 
289  printf(" - Maximum abs error on reconstruction : %6.5e\n",
290  maxerr(fn, fnrec, N));
291 
292  /*
293  printf("\nTau = %f\n",flag_spherlaguerre_tau(1.0, N));
294  for (n=0; n<N+1; n++){
295  printf("%i > node=%f",n, nodes[n]);
296  printf(" weight=%f",weights[n]);
297  printf(" f=%f\n",f[n]);
298  }
299  for (n=0; n<N; n++){
300  printf(" fn=%f - fnrec=%f",fn[n],fnrec[n]);
301  printf(" d=%2.2e r=%2.2e\n",fn[n]-fnrec[n],fn[n]/fnrec[n]);
302  }
303  */
304 
305 
306  free(f);
307  free(fn);
308  free(fnrec);
309  free(weights);
310  free(nodes);
311 }
312 
313 void flag_transform_test(int L, int N, double tau, int seed)
314 {
315  complex double *f, *flmn, *flmnrec;
316  clock_t time_start, time_end;
317 
318  int spin = 0;
319 
320  flag_core_allocate_f(&f, L, N);
321  flag_core_allocate_flmn(&flmn, L, N);
322  flag_core_allocate_flmn(&flmnrec, L, N);
323 
324  flag_random_flmn(flmn, L, N, seed);
325  //print_flmn(flmn, L, N);
326 
327  double *nodes = (double*)calloc(N, sizeof(double));
328  double *weights = (double*)calloc(N, sizeof(double));
329 
330  flag_spherlaguerre_sampling(nodes, weights, tau, N);
331 
332  time_start = clock();
333  flag_core_synthesis(f, flmn, nodes, N, L, tau, N, spin);
334  time_end = clock();
335  printf(" - Duration of full 3D synthesis : %4.4f seconds\n",
336  (time_end - time_start) / (double)CLOCKS_PER_SEC);
337  //print_f(f, L, N);
338 
339  time_start = clock();
340  flag_core_analysis(flmnrec, f, L, tau, N, spin);
341  time_end = clock();
342  printf(" - Duration of full 3D analysis : %4.4f seconds\n",
343  (time_end - time_start) / (double)CLOCKS_PER_SEC);
344  //print_flmn(flmnrec, L, N);
345 
346  printf(" - Maximum abs error on reconstruction : %6.5e\n",
347  maxerr_cplx(flmn, flmnrec, flag_core_flmn_size(L, N)));
348 
349  free(f);
350  free(flmn);
351  free(flmnrec);
352  free(nodes);
353  free(weights);
354 }
355 
356 
357 
358 void flag_transform_furter_test(int L, int N, double tau, int seed)
359 {
360  int spin = 0;
361  int verbosity = 0;
362  clock_t time_start, time_end, t_for, t_back;
363  int flmsize = ssht_flm_size(L);
364  int frsize = ssht_fr_size_mw(L);
365  int n, offset_lm, offset_r;
366  ssht_dl_method_t dl_method = SSHT_DL_TRAPANI;
367 
368  double *nodes = (double*)calloc(N, sizeof(double));
369  double *weights = (double*)calloc(N, sizeof(double));
370  printf("Sampling...");fflush(NULL);
371  flag_spherlaguerre_sampling(nodes, weights, tau, N);
372  printf("done\n");fflush(NULL);
373 
374  complex double *flmn, *flmr, *flmn_rec, *f, *flmr_rec;
375 
376  flag_core_allocate_flmn(&flmn, L, N);
377  flag_core_allocate_flmn(&flmr, L, N);
378  flag_core_allocate_flmn(&flmn_rec, L, N);
379  flag_core_allocate_flmn(&flmr_rec, L, N);
380  flag_core_allocate_f(&f, L, N);
381 
382  flag_random_flmn(flmn, L, N, seed);
383 
384  printf("Starting synthesis\n");fflush(NULL);
385  time_start = clock();
386  flag_spherlaguerre_mapped_synthesis(flmr, flmn, nodes, N, tau, N, flmsize);
387  time_end = clock();
388  printf(" - Synthesis : SLAG 3D synthes duration : %4.4f seconds\n",
389  (time_end - time_start) / (double)CLOCKS_PER_SEC);
390  time_start = clock();
391 
392  flag_spherlaguerre_mapped_analysis(flmn_rec, flmr, nodes, weights, tau, N, flmsize);
393  time_end = clock();
394  printf(" - Synthesis : SLAG 3D analys duration : %4.4f seconds\n",
395  (time_end - time_start) / (double)CLOCKS_PER_SEC);
396  printf(" - SLAG maximum absolute error : %6.5e\n",
397  maxerr_cplx(flmn, flmn_rec, flag_core_flmn_size(L, N)));
398  //for (n = 0; n < N; n++)
399  //for (i = 0; i < flmsize; i++)
400  //printf("n=%i - i=%i - (%f,%f) - (%f,%f)\n",n,i,creal(flmn[i+n*flmsize]),cimag(flmn[i+n*flmsize]),creal(flmn_rec[i+n*flmsize]),cimag(flmn_rec[i+n*flmsize]));
401 
402  t_for = 0;
403  t_back = 0;
404  for (n = 0; n < N; n++){
405  offset_lm = n * flmsize;
406  offset_r = n * frsize;
407  ssht_core_mw_inverse_sov_sym(f + offset_r, flmr + offset_lm, L, spin, dl_method, verbosity);
408  time_end = clock();
409  t_back += (time_end - time_start) / (N);
410  time_start = clock();
411  ssht_core_mw_forward_sov_conv_sym(flmr_rec + offset_lm, f + offset_r, L, spin, dl_method, verbosity);
412  time_end = clock();
413  t_for += (time_end - time_start) / (N);
414  time_start = clock();
415  }
416  //for (n = 0; n < N; n++)
417  //for (i = 0; i < frsize; i++)
418  //printf("n=%i - i=%i - (%f,%f)\n",n,i,creal(f[i+n*frsize]),cimag(f[i+n*frsize]));
419 
420  printf(" - Synthesis : SSHT forward av duration : %4.4f seconds\n",
421  t_for / (double)CLOCKS_PER_SEC);
422  printf(" - Analysis : SSHT backward av duration : %4.4f seconds\n",
423  t_back / (double)CLOCKS_PER_SEC);
424  printf(" - SSHT maximum absolute error : %6.5e\n",
425  maxerr_cplx(flmr, flmr_rec, flag_core_flmn_size(L, N)));
426 
427  free(flmn_rec);
428  flag_core_allocate_f(&flmn_rec, L, N);
429  free(flmr);
430  flag_core_allocate_flmn(&flmr, L, N);
431 
432  time_start = clock();
433  flag_spherlaguerre_mapped_analysis(flmn_rec, flmr_rec, nodes, weights, tau, N, flmsize);
434  time_end = clock();
435  printf(" - Analysis : SLAG 3D analysis duration : %4.4f seconds\n",
436  (time_end - time_start) / (double)CLOCKS_PER_SEC);
437  time_start = clock();
438  flag_spherlaguerre_mapped_synthesis(flmr, flmn_rec, nodes, N, tau, N, flmsize);
439  time_end = clock();
440  printf(" - Analysis : SLAG 3D synthesis duration: %4.4f seconds\n",
441  (time_end - time_start) / (double)CLOCKS_PER_SEC);
442  printf(" - SLAG maximum absolute error : %6.5e\n",
443  maxerr_cplx(flmr, flmr_rec, flag_core_flmn_size(L, N)));
444  printf(" - Final FLAG maximum absolute error : %6.5e\n",
445  maxerr_cplx(flmn, flmn_rec, flag_core_flmn_size(L, N)));
446 
447  free(flmn);
448  free(flmn_rec);
449  free(flmr);
450  free(flmr_rec);
451 }
452 
453 void flag_transform_real_test(int L, int N, double tau, int seed)
454 {
455  double *f;
456  complex *flmn, *flmnrec;
457  clock_t time_start, time_end;
458 
459  flag_core_allocate_f_real(&f, L, N);
460  flag_core_allocate_flmn(&flmn, L, N);
461  flag_core_allocate_flmn(&flmnrec, L, N);
462 
463  flag_random_flmn_real(flmn, L, N, seed);
464  //print_flmn(flmn, L, N);
465 
466  double *nodes = (double*)calloc(N, sizeof(double));
467  double *weights = (double*)calloc(N, sizeof(double));
468 
469  flag_spherlaguerre_sampling(nodes, weights, tau, N);
470 
471  time_start = clock();
472  flag_core_synthesis_real(f, flmn, nodes, N, L, tau, N);
473  time_end = clock();
474  printf(" - Duration of full 3D synthesis : %4.4f seconds\n",
475  (time_end - time_start) / (double)CLOCKS_PER_SEC);
476 
477  time_start = clock();
478  flag_core_analysis_real(flmnrec, f, L, tau, N);
479  time_end = clock();
480  printf(" - Duration of full 3D analysis : %4.4f seconds\n",
481  (time_end - time_start) / (double)CLOCKS_PER_SEC);
482  //print_flmn(flmnrec, L, N);
483 
484  printf(" - Maximum abs error on reconstruction : %6.5e\n",
485  maxerr_cplx(flmn, flmnrec, flag_core_flmn_size(L, N)));
486 
487  free(f);
488  free(flmn);
489  free(flmnrec);
490  free(nodes);
491  free(weights);
492 }
493 
494 
495 void flag_transform_performance_test(double tau, int NREPEAT, int NSCALE, int seed)
496 {
497  complex double *f, *flmn, *flmnrec;
498  clock_t time_start, time_end;
499  int sc, repeat;
500  double tottime_analysis = 0, tottime_synthesis = 0;
501  double accuracy = 0.0;
502 
503  int spin = 0;
504  int L = 2;
505  int N = 2;
506 
507  for (sc=0; sc<NSCALE; sc++) {
508 
509  L *= 2;
510  N *= 2;
511 
513 
514  flag_core_allocate_flmn(&flmn, L, N);
515 
516  double *nodes = (double*)calloc(N, sizeof(double));
517  double *weights = (double*)calloc(N, sizeof(double));
518 
519  //printf("> Radial sampling...");fflush(NULL);
520  flag_spherlaguerre_sampling(nodes, weights, tau, N);
521  //printf("done\n");
522 
523  printf("\n > tau = %4.4f -- L = %i N = %i \n", tau, L, N);
524  for (repeat=0; repeat<NREPEAT; repeat++){
525 
526  //printf(" -> Iteration : %i on %i\n",repeat+1,NREPEAT);
527 
528  flag_random_flmn(flmn, L, N, seed);
529 
530  flag_core_allocate_f(&f, L, N);
531 
532  time_start = clock();
533  flag_core_synthesis(f, flmn, nodes, N, L, tau, N, spin);
534  time_end = clock();
535  tottime_synthesis += (time_end - time_start) / (double)CLOCKS_PER_SEC;
536  //printf(" - Duration for FLAG synthesis : %4.4f seconds\n", (time_end - time_start) / (double)CLOCKS_PER_SEC);
537  flag_core_allocate_flmn(&flmnrec, L, N);
538 
539  time_start = clock();
540  flag_core_analysis(flmnrec, f, L, tau, N, spin);
541  time_end = clock();
542  tottime_analysis += (time_end - time_start) / (double)CLOCKS_PER_SEC;
543  //printf(" - Duration for FLAG analysis : %4.4f seconds\n", (time_end - time_start) / (double)CLOCKS_PER_SEC);
544  accuracy += maxerr_cplx(flmn, flmnrec, flag_core_flmn_size(L, N));
545  //printf(" - Max error on reconstruction : %6.5e\n", maxerr_cplx(flmn, flmnrec, flag_core_flmn_size(L, N)));
546 
547  free(f);
548  free(flmnrec);
549 
550  }
551 
552  tottime_synthesis = tottime_synthesis / (double)NREPEAT;
553  tottime_analysis = tottime_analysis / (double)NREPEAT;
554  accuracy = accuracy / (double)NREPEAT;
555 
556 
557  printf(" - Average duration for FLAG synthesis : %4.4f seconds\n", tottime_synthesis);
558  printf(" - Average duration for FLAG analysis : %4.4f seconds\n", tottime_analysis);
559  printf(" - Average max error on reconstruction : %6.5e\n", accuracy);
560 
561  free(flmn);
562  free(nodes);
563  free(weights);
564 
565  }
566 
567 
568 }
569 
570 
571 int main(int argc, char *argv[])
572 {
573  //const int NREPEAT = 4;
574  //const int NSCALE = 5;
575  const int L = 32;
576  const int N = 32;
577  const double tau = 1.0;
578  const int seed = (int)(10000.0*(double)clock()/(double)CLOCKS_PER_SEC);
579 
580 
581  double *roots = (double*)calloc(N, sizeof(double));
582  double *weights = (double*)calloc(N, sizeof(double));
583  int i;
584  //const int alpha = ALPHA;
585  //flag_spherlaguerre_quadrature(roots, weights, N, alpha);
586  flag_spherlaguerre_sampling(roots, weights, tau, N);
587  for(i=0;i<N;i++)
588  printf("Root[%i] = %f with weight %5.5e\n",i,roots[i],weights[i]);
589  free(roots);
590  free(weights);
591 
592 
593  printf("==========================================================\n");
594  printf("PARAMETERS : ");
595  printf(" L = %i N = %i tau = %4.1f seed = %i\n", L, N, tau, seed);
596  printf("----------------------------------------------------------\n");
597  printf("> Testing Laguerre quadrature...");
599  printf("OK\n");
600 
601  printf("> Testing Laguerre tau calculation...");
603  printf("OK\n");
604 
605  printf("> Testing Laguerre sampling scheme...");
607  printf("OK\n");
608 
609  printf("----------------------------------------------------------\n");
610 
611  printf("> Testing 1D Laguerre transform...\n");
613  fflush(NULL);
614 
615  printf("----------------------------------------------------------\n");
616 
617  printf("> Testing cmplx mapped Laguerre transform...\n");
619  fflush(NULL);
620 
621  printf("----------------------------------------------------------\n");
622 
623  printf("> Testing FLAG sampling scheme...");
624  flag_sampling_test(L, N, tau);
625  printf("OK\n");
626 
627  printf("> Testing FLAG transform...\n");
628  flag_transform_test(L, N, tau, seed);
629  fflush(NULL);
630 
631  printf("> Testing REAL FLAG transform...\n");
632  flag_transform_real_test(L, N, tau, seed);
633  fflush(NULL);
634 
635  printf("----------------------------------------------------------\n");
636 
637  printf("> Testing FLAG in further details...\n");
638  flag_transform_furter_test(L, N, tau, seed);
639  fflush(NULL);
640 
641  printf("==========================================================\n");
642 
643  //printf("> FLAG transform : performance and accuracy tests\n");
644  //flag_transform_performance_test(tau, NREPEAT, NSCALE, seed);
645  //fflush(NULL);
646 
647  //printf("==========================================================\n");
648 
649  return 0;
650 }
void flag_core_synthesis(complex double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N, int spin)
Definition: flag_core.c:110
void flag_sampling(double *rs, double *thetas, double *phis, double *laguweights, double tau, int L, int N)
Definition: flag_sampling.c:69
void flag_random_flmn(complex double *flmn, int L, int N, int seed)
Definition: flag_test.c:84
void flag_sampling_allocate(double **rs, double **thetas, double **phis, double **laguweights, int L, int N)
Definition: flag_sampling.c:48
double ran2_dp(int idum)
Definition: flag_test.c:39
void flag_core_allocate_f(complex double **f, int L, int N)
Definition: flag_core.c:51
void flag_spherlaguerre_sampling_test(int N, double tau)
Definition: flag_test.c:203
void flag_core_allocate_flmn(complex double **flmn, int L, int N)
Definition: flag_core.c:41
void flag_transform_furter_test(int L, int N, double tau, int seed)
Definition: flag_test.c:358
void flag_core_analysis(complex double *flmn, const complex double *f, int L, double tau, int N, int spin)
Definition: flag_core.c:71
int flag_core_flmn_size(int L, int N)
Definition: flag_core.c:27
void flag_core_synthesis_real(double *f, const complex double *flmn, const double *nodes, int Nnodes, int L, double tau, int N)
Definition: flag_core.c:176
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_transform_real_test(int L, int N, double tau, int seed)
Definition: flag_test.c:453
double maxerr(double *a, double *b, int size)
Definition: flag_test.c:29
void flag_spherlaguerre_transform_test(int N, double tau)
Definition: flag_test.c:258
void flag_sampling_test(int L, int N, double tau)
Definition: flag_test.c:155
int ssht_flm_size(int L)
Definition: flag_core.c:20
#define ALPHA
Definition: flag.h:4
void flag_spherlaguerre_cmplx_transform_test(int L, int N, double tau, int seed)
Definition: flag_test.c:218
void flag_transform_test(int L, int N, double tau, int seed)
Definition: flag_test.c:313
#define MAX(a, b)
Definition: flag_test.c:16
void print_f_real(const double *f, int L, int N)
Definition: flag_test.c:129
void flag_core_allocate_f_real(double **f, int L, int N)
Definition: flag_core.c:61
void flag_random_flmn_real(complex double *flmn, int L, int N, int seed)
Definition: flag_test.c:93
double flag_spherlaguerre_tau(double R, int N)
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)
Definition: flag_core.c:13
void flag_spherlaguerre_tau_test(int N)
Definition: flag_test.c:183
void flag_spherlaguerre_quadrature_test(int N)
Definition: flag_test.c:170
double maxerr_cplx(complex double *a, complex double *b, int size)
Definition: flag_test.c:18
void flag_spherlaguerre_sampling(double *nodes, double *weights, double tau, int N)
void flag_transform_performance_test(double tau, int NREPEAT, int NSCALE, int seed)
Definition: flag_test.c:495
void flag_core_analysis_real(complex double *flmn, const double *f, int L, double tau, int N)
Definition: flag_core.c:141
int flag_core_f_size_mw(int L, int N)
Definition: flag_core.c:34
void flag_spherlaguerre_quadrature(double *roots, double *weights, int N, int alpha)
void print_flmn(const complex double *flmn, int L, int N)
Definition: flag_test.c:142
int main(int argc, char *argv[])
Definition: flag_test.c:571
void flag_spherlaguerre_synthesis(double *f, const double *fn, const double *nodes, int Nnodes, double tau, int N)
void flag_spherlaguerre_analysis(double *fn, const double *f, const double *nodes, const double *weights, double tau, int N)
void flag_random_f(complex double *f, int L, int N, int seed)
Definition: flag_test.c:75
void print_f(const complex double *f, int L, int N)
Definition: flag_test.c:116