Disable "hard" examples in CI
[qpms.git] / qpms / test_translations2.c
blobe0c67e41e4ecd662e0b5f0fecf8c8e937384710f
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 lMax=10;
20 int main() {
21 qpms_trans_calculator *c = qpms_trans_calculator_init(lMax, QPMS_NORMALISATION_TAYLOR);
23 for(testcase_single_trans_t *tc = testcases_Taylor; tc->J != QPMS_BESSEL_UNDEF; tc++) {
24 if (!tc->n || !tc->nu || tc->n > lMax || tc->nu > lMax ) continue;
26 printf("m=%d, n=%d, mu=%d, nu=%d,\n", tc->m,tc->n,tc->mu,tc->nu);
27 #if 0
28 complex double A = qpms_trans_single_A_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
29 complex double B = qpms_trans_single_B_Taylor(tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
30 #else
31 complex double A = qpms_trans_single_A(QPMS_NORMALISATION_TAYLOR, tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
32 complex double B = qpms_trans_single_B(QPMS_NORMALISATION_TAYLOR,tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
33 #endif
34 complex double A2 = qpms_trans_calculator_get_A(c, tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
35 complex double B2 = qpms_trans_calculator_get_B(c, tc->m, tc->n, tc->mu, tc->nu, tc->kdlj, true, tc->J);
36 printf("A = %.16f+%.16fj, relerr=%.16f, J=%d\n",
37 creal(A), cimag(A), (0 == cabs(tc->result_A - A)) ? 0 :
38 cabs(tc->result_A - A)/((cabs(A) < cabs(tc->result_A)) ? cabs(A) : cabs(tc->result_A)),
39 tc->J);
40 printf("A' = %.16f+%.16fj, relerr=%.16f, relerr2=%.3e\n",
41 creal(A2), cimag(A2), (0 == cabs(tc->result_A - A2)) ? 0 :
42 cabs(tc->result_A - A2)/((cabs(A2) < cabs(tc->result_A)) ? cabs(A2) : cabs(tc->result_A)),
43 (0 == cabs(A - A2)) ? 0 :
44 cabs(A - A2)/((cabs(A2) < cabs(A)) ? cabs(A2) : cabs(A))
46 printf("B = %.16f+%.16fj, relerr=%.16f, J=%d\n",
47 creal(B), cimag(B), (0 == cabs(tc->result_B - B)) ? 0 :
48 cabs(tc->result_B - B)/((cabs(B) < cabs(tc->result_B)) ? cabs(B) : cabs(tc->result_B)),
49 tc->J);
50 printf("B' = %.16f+%.16fj, relerr=%.16f, relerr2=%.3e\n",
51 creal(B2), cimag(B2), (0 == cabs(tc->result_B - B2)) ? 0 :
52 cabs(tc->result_B - B2)/((cabs(B2) < cabs(tc->result_B)) ? cabs(B2) : cabs(tc->result_B)),
53 (0 == cabs(B - B2)) ? 0 :
54 cabs(B - B2)/((cabs(B2) < cabs(B)) ? cabs(B2) : cabs(B))
57 complex double A,B;
58 // Test of zero R
59 sph_t kdlj = {0, 1, 2};
60 int m = -1, n = 1, mu = -1, nu = 1;
61 qpms_trans_calculator_get_AB_p(c,&A,&B,m,n,mu,nu,kdlj,false,3);
62 printf("A = %.6e+%.6ej, B = %.6e+%.6ej\n", creal(A),cimag(A),creal(B),cimag(B));
63 qpms_trans_calculator_free(c);