Fix saving lists of arrays with recent versions of numpy
[qpms.git] / qpms / test_gaunt.c
blobf912b5bb604ec1b5c6eeacf649b9f1a17ca4e767
1 #define GAUNT_PRECOMPILED
2 #include "gaunt.h"
3 #include <stdio.h>
4 #include <math.h>
6 const double rerrth = 1e-12;
8 int main()
10 int lMax = gaunt_table_lMax;
11 for (int n = 1; n <= lMax; n++)
12 for (int m = -n; m <= n; m++)
13 for (int nu = 1; nu <= lMax; nu++)
14 for (int mu = -nu; mu <= nu; mu++) {
15 int err;
16 int qmax = gaunt_q_max(m,n,mu,nu);
17 double gc_xu[qmax+1];
18 gaunt_xu(m,n,mu,nu,qmax,gc_xu,&err);
19 double const * gc_table = gaunt_table_retrieve_allq(m, n, mu, nu);
20 for (int q = 0; q < qmax; ++q) {
21 double rerr = (gc_xu[q] || gc_table[q]) ? 2 * (gc_xu[q] - gc_table[q]) / fabs(gc_xu[q] + gc_table[q]) : 0;
22 printf("%.5e %s %d %d %d %d %d %.16e %.16e\n",
23 rerr, (fabs(rerr) > rerrth) ? "!" : " ", m, n, mu, nu, q, gc_xu[q], gc_table[q]);
26 return 0;