Some features to enable ScatteringSystem reconstruction
[qpms.git] / oldtests / Bmaxcumsum.c
blob11ff352e23784984a37c844eba5b3d82c94c115c
1 #include "../qpms/gaunt.h"
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <assert.h>
6 //const int lMax = 30;
8 #define MIN(x,y) (((x)>(y))?(y):(x))
10 static inline int Qmax(int m, int n, int mu, int nu) {
11 return MIN(n, MIN(nu, (n+nu+1-abs(-m+mu))/2));
14 int main(int argc, char **argv)
16 int lMax;
17 if (argc < 2)
18 lMax = 30;
19 else lMax = atoi(argv[1]);
21 printf("// assuming lMax == %d:\n", lMax);
22 size_t Bmaxcumsum = 0;
23 printf("0x%zx,\n", Bmaxcumsum);
24 for (int n = 0; n <= lMax; n++)
25 for (int m = -n; m <= n; m++)
26 for (int nu = 0; nu <= lMax; nu++)
27 for (int mu = -nu; mu <= nu; mu++) {
28 //FIXME toto je možná úplně blbě
29 assert(gaunt_q_max(-m, n+1, mu, nu) == Qmax(m, n, mu, nu);
30 Bmaxcumsum += gaunt_q_max(-m, n+1, mu, nu) + 1;
31 printf("0x%zx,\n", Bmaxcumsum);
33 return 0;