Fix missing import in finiterectlat-scatter.py
[qpms.git] / qpms / proftest.c
blobdd040d7bece37f5f96e4d79a62ca44f41d8b7d8d
2 #include "translations.h"
3 #include <stdio.h>
4 //#include <math.h>
5 #include <complex.h>
7 typedef struct {
8 int m, n, mu, nu;
9 sph_t kdlj;
10 qpms_bessel_t J;
11 complex double result_A, result_B;
12 } testcase_single_trans_t;
14 testcase_single_trans_t testcases_Taylor[] = {
15 #include "testcases_taylor"
19 int main() {
20 int repete = 500;
21 int lMax = 3;
22 qpms_trans_calculator *c = qpms_trans_calculator_init(lMax, QPMS_NORMALIZATION_TAYLOR);
23 for( int rr = 0; rr < repete; rr++)
24 for(testcase_single_trans_t *tc = testcases_Taylor; tc->J != QPMS_BESSEL_UNDEF; tc++) {
25 //if (tc->n > 40 || tc->nu > 40 ) continue;
26 complex double A_array[c->nelem * c->nelem];
27 complex double B_array[c->nelem * c->nelem];
28 qpms_trans_calculator_get_AB_arrays(c, A_array, B_array, c->nelem, 1, tc->kdlj, true, tc->J);
29 #if 0
30 complex double A = qpms_trans_single_A_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
31 complex double B = qpms_trans_single_B_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
32 printf("A = %.16f+%.16fj, relerr=%.16f, J=%d\n",
33 creal(A), cimag(A), (0 == cabs(tc->result_A - A)) ? 0 :
34 cabs(tc->result_A - A)/((cabs(A) < cabs(tc->result_A)) ? cabs(A) : cabs(tc->result_A)),
35 tc->J);
36 printf("B = %.16f+%.16fj, relerr=%.16f, J=%d\n",
37 creal(B), cimag(B), (0 == cabs(tc->result_B - B)) ? 0 :
38 cabs(tc->result_B - B)/((cabs(B) < cabs(tc->result_B)) ? cabs(B) : cabs(tc->result_B)),
39 tc->J);
40 #endif