Fix missing import in finiterectlat-scatter.py
[qpms.git] / qpms / test_translations_xu_multipliers.c
blob2aaee54eceb5a00603a6ccc9b9c736e3778a0941
1 #include "translations.h"
2 #include "gaunt.h"
3 #include <stdio.h>
4 //#include <math.h>
5 #include <complex.h>
7 #ifdef QPMS_PACKED_B_MULTIPLIERS
8 #define BQ_OFFSET 1
9 #else
10 #define BQ_OFFSET 0
11 #endif
13 void qpms_trans_calculator_multipliers_B_general(
14 qpms_normalisation_t norm,
15 complex double *dest, int m, int n, int mu, int nu, int Qmax) ;
17 int lMax=13;
19 #define MIN(x,y) ((x)<(y)?(x):(y))
22 // Python test: Qmax(M, n, mu, nu) = floor(min(n,nu,(n+nu+1-abs(M+mu))/2))
23 // q in IntegerRange(1, Qmax(-m,n,mu,nu))
25 int main() {
26 qpms_trans_calculator *c = qpms_trans_calculator_init(lMax, QPMS_NORMALISATION_XU);
27 complex double dest[lMax + 2];
29 for(int n = 1; n <= lMax; ++n)
30 for(int nu = 1; nu <= lMax; ++nu)
31 for(int m = -n; m <= n; ++m)
32 for(int mu = -nu; mu <= nu; ++mu){
33 int Qmax_alt = MIN(n,MIN(nu,(n+nu+1-abs(mu-m))/2));
34 qpms_trans_calculator_multipliers_B_general(QPMS_NORMALISATION_XU_CS,
35 dest, m, n, mu, nu, Qmax_alt);
36 for(int q = BQ_OFFSET; q <= Qmax_alt; ++q) {
37 // int p = n + nu - 2*q;
38 int tubig = cabs(dest[q-BQ_OFFSET]) > 1e-8;
39 printf("%.16g + %.16g*I, // %d, %d, %d, %d, %d,%s\n",
40 creal(dest[q-BQ_OFFSET]), cimag(dest[q-BQ_OFFSET]), m, n, mu, nu, q,
41 q > Qmax_alt ? (tubig?" //tubig":" //tu") : "");
43 fflush(stdout);
48 qpms_trans_calculator_free(c);