Fix saving lists of arrays with recent versions of numpy
[qpms.git] / qpms / test_translations.c
blob03ed04efd703204a118d866c44e33fc6035d3824
1 #include "translations.h"
2 #include <stdio.h>
3 //#include <math.h>
4 #include <complex.h>
6 typedef struct {
7 qpms_normalisation_t norm;
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"
18 int main() {
19 for(testcase_single_trans_t *tc = testcases_Taylor; tc->J != QPMS_BESSEL_UNDEF; tc++) {
20 //if (tc->n > 40 || tc->nu > 40 ) continue;
22 printf("m=%d, n=%d, mu=%d, nu=%d,\n", tc->m,tc->n,tc->mu,tc->nu);
23 complex double A = qpms_trans_single_A_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
24 complex double B = qpms_trans_single_B_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
25 printf("A = %.16f+%.16fj, relerr=%.16f, J=%d\n",
26 creal(A), cimag(A), (0 == cabs(tc->result_A - A)) ? 0 :
27 cabs(tc->result_A - A)/((cabs(A) < cabs(tc->result_A)) ? cabs(A) : cabs(tc->result_A)),
28 tc->J);
29 printf("B = %.16f+%.16fj, relerr=%.16f, J=%d\n",
30 creal(B), cimag(B), (0 == cabs(tc->result_B - B)) ? 0 :
31 cabs(tc->result_B - B)/((cabs(B) < cabs(tc->result_B)) ? cabs(B) : cabs(tc->result_B)),
32 tc->J);