/* When the user clicks on the button, toggle between hiding and showing the dropdown content */



added code, README and Makefile
[strong_simulation_gauss_sum_rank.git] / gausssums_multipleof12.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <complex.h>
4 #include <math.h>
5
6 int readPaulicoeffs(int* alpha, int* beta, int* gamma, int* delta, int numqubits);
7 complex double Gausssum1d(int quadraticcoeff, int linearcoeff);
8 complex double Kroneck(int arg);
9   
10 // order of matrix elements is [row][column]!!!
11
12 int main()
13 {
14
15   int i, j;
16   int x, y, xp, yp, xpp, ypp, xppp, yppp;
17   
18   int N;              // number of qubits
19   scanf("%d", &N);
20   if(N%12!=0) {
21     printf("Error: N must be a multiple of 12!\n");
22     return 1;
23   }
24
25   int alpha[N], beta[N], gamma[N], delta[N];
26
27   double complex summand, sum;
28
29   while(readPaulicoeffs(alpha, beta, gamma, delta, N)) {
30
31     /* for(i=0; i<N; i++) */
32     /*   printf("%d %d %d %d\n", alpha[i], beta[i], gamma[i], delta[i]); */
33
34     sum = 1.0+0.0*I;
35     for(i=0; i<N; i+=12) {
36       summand = 0.0*I;
37
38       j = i + 6; // index of second tensored primitive t=6
39       
40       
41       // first term
42       for(y=0; y<=1; y++) {
43         //**for(x=0;x<=(y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
44         for(x=y*(beta[i]+alpha[i+1]+beta[i+1])%2;x<=(y*(beta[i]+alpha[i+1]+beta[i+1])+y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
45           for(yp=((gamma[i+3]+delta[i+4])*x)%2; yp<=(1+(gamma[i+3]+gamma[i+4])*x)%2; yp++) {
46           //****for(yp=((gamma[i+3]+delta[i+4])*x*(1+alpha[i]+beta[i]))%2; yp<=(1+(gamma[i+3]+gamma[i+4])*x*(1+alpha[i]+beta[i]))%2; yp++) {
47             //**for(xp=0;xp<=(yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
48             for(xp=yp*(beta[i+3]+alpha[i+4]+beta[i+4])%2;xp<=(yp*(beta[i+3]+alpha[i+4]+beta[i+4])+yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
49
50               
51               //for(ypp=0; ypp<=1; ypp++) {
52               //**for(ypp=((gamma[j]+delta[j+1])*(x+xp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x+xp))%2;ypp++) {
53               for(ypp=((gamma[j]+delta[j+1])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp++) {
54                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
55                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
56                   //for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
57                   for(yppp=((gamma[j+3]+delta[j+4])*(x+xp+xpp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x+xp+xpp))%2; yppp++) {
58                     //****for(yppp=((gamma[j+3]+delta[j+4])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; yppp++) {
59                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
60                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
61                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
62                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
63                                            //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
64                                            + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
65                                   *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
66                                     + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
67                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
68                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
69                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
70                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
71                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
72                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
73                     }
74                   }
75                 }
76               }
77               for(ypp=0; ypp<=1; ypp++) {
78                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
79                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
80                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
81                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
82                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
83                           + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
84                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
85                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
86                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
87                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
88                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
89                     }
90                   }
91                 }
92               }
93               //for(ypp=0; ypp<=1; ypp++) {
94               for(ypp=((gamma[j]+delta[j+1])*(x+xp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x+xp))%2;ypp++) {
95               //****for(ypp=((gamma[j]+delta[j+1])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp++) {
96                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
97                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
98                   //for(yppp=xpp; yppp<=1; yppp++) {
99                   //**for(yppp=(x+xp+xpp)%2; yppp<=1; yppp++) {
100                   for(yppp=(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j]))%2; yppp<=1; yppp++) {
101                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
102                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+(x+xp+xpp))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(x+xp+xpp))%2; xppp++) {
103                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; xppp++) {
104                       //summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
105                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
106                                            //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
107                                            + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
108                                   *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
109                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
110                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
111                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
112                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
113                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
114                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
115                     }
116                   }
117                 }
118               }
119               
120               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
121                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
122                   for(yppp=0; yppp<=1; yppp++) {
123                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
124                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
125                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
126                           + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
127                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
128                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
129                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
130                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
131                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
132                     }
133                   }
134                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
135                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
136                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
137                           + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
138                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
139                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
140                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
141                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
142                     }
143                   }
144                   for(yppp=0; yppp<=1; yppp++) {
145                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
146                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
147                           + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
148                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
149                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
150                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
151                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
152                     }
153                   }
154                 }
155               }
156
157               //for(ypp=0; ypp<=1; ypp++) {
158               //**for(ypp=(x+xp)%2; ypp<=1; ypp++) {
159               for(ypp=(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; ypp<=1; ypp++) {
160                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
161                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+x+xp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x+xp)%2; xpp++) {
162                 for(xpp=(ypp*(delta[j]+delta[j+1])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp++) {
163                   //for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
164                   for(yppp=((gamma[j+3]+delta[j+4])*(x+xp+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x+xp+ypp))%2; yppp++) {
165                   //****for(yppp=((gamma[j+3]+delta[j+4])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+ypp))%2; yppp++) {
166                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
167                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
168                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
169                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
170                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
171                                            + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
172                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
173                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
174                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
175                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
176                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
177                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
178                     }
179                   }
180                 }
181               }
182               for(ypp=0; ypp<=1; ypp++) {
183                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
184                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
185                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
186                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
187                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
188                                   *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
189                                     + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
190                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
191                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
192                     }
193                   }
194                 }
195               }
196               //for(ypp=0; ypp<=1; ypp++) {
197               //**for(ypp=(x+xp)%2; ypp<=1; ypp++) {
198               for(ypp=(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; ypp<=1; ypp++) {
199                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
200                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+x+xp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x+xp)%2; xpp++) {
201                 for(xpp=(ypp*(delta[j]+delta[j+1])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp++) {
202                   //for(yppp=ypp; yppp<=1; yppp++) {
203                   //**for(yppp=(x+xp+ypp)%2; yppp<=1; yppp++) {
204                   for(yppp=(x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2; yppp<=1; yppp++) {
205                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
206                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+x+xp+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+x+xp+ypp)%2; xppp++) {
207                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+x*(1+alpha[i]+beta[i])+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2; xppp++) {
208                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
209                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
210                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
211                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
212                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
213                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
214                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
215                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
216                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
217                     }
218                   }
219                 }
220               }
221             }
222           }
223         }
224       }
225       
226       
227       // second term
228       for(y=0; y<=1; y++) {
229         //**for(x=0;x<=(y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
230         for(x=y*(beta[i]+alpha[i+1]+beta[i+1])%2;x<=(y*(beta[i]+alpha[i+1]+beta[i+1])+y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
231           for(yp=0; yp<=(1+alpha[i+5])%2; yp++) {
232             for(xp=0;xp<=(1+beta[i+5])%2; xp++) {
233               for(ypp=0; ypp<=1; ypp++) {
234                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
235                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
236                   for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
237                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
238                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
239                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
240                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
241                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
242                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
243                               + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
244                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
245                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
246                     }
247                   }
248                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
249                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
250                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
251                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
252                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
253                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
254                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
255                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
256                     }
257                   }
258                   //**for(yppp=xpp; yppp<=1; yppp++) {
259                   for(yppp=xpp*(1+alpha[j]+beta[j])%2; yppp<=1; yppp++) {
260                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
261                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp*(1+alpha[j]+beta[j]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp*(1+alpha[j]+beta[j]))%2; xppp++) {
262                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
263                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
264                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
265                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
266                                       + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
267                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
268                     }
269                   }
270                 }
271               }
272
273               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
274                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
275                   for(yppp=0; yppp<=1; yppp++) {
276                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
277                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
278                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
279                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
280                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
281                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
282                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
283                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
284                     }
285                   }
286                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
287                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
288                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
289                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
290                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
291                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
292                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
293                     }
294                   }
295                   for(yppp=0; yppp<=1; yppp++) {
296                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
297                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
298                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
299                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
300                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
301                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
302                     }
303                   }
304                 }
305               }
306
307               for(ypp=0; ypp<=1; ypp++) {
308                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
309                   for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
310                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
311                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
312                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
313                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
314                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
315                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
316                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
317                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
318                     }
319                   }
320                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
321                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
322                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
323                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
324                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
325                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
326                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
327                     }
328                   }
329                   for(yppp=ypp; yppp<=1; yppp++) {
330                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
331                       summand += ((0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
332                           + 0.125*pow(2.0,1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
333                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
334                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
335                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
336                     }
337                   }
338                 }
339               }
340             }
341           }
342         }
343       }
344
345       
346       // third term
347       for(y=0; y<=1; y++) {
348         //**for(x=0;x<=(y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
349         for(x=y*(beta[i]+alpha[i+1]+beta[i+1])%2;x<=(y*(beta[i]+alpha[i+1]+beta[i+1])+y*(gamma[i]+gamma[i+1])+(y+1)*(gamma[i]+delta[i+1]))%2; x++) {
350           //**for(yp=x; yp<=1; yp++) {
351           for(yp=x*(1+alpha[i]+beta[i])%2; yp<=1; yp++) {
352             //**for(xp=(yp*(delta[i+3]+delta[i+4])+x)%2;xp<=(1+yp*(gamma[i+3]+gamma[i+4])+x)%2; xp++) {
353             for(xp=(yp*(delta[i+3]+delta[i+4])+x*(1+alpha[i]+beta[i]))%2;xp<=(1+yp*(gamma[i+3]+gamma[i+4])+x*(1+alpha[i]+beta[i]))%2; xp++) {
354               //for(ypp=0; ypp<=1; ypp++) {
355               for(ypp=((gamma[j]+delta[j+1])*(x+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x+yp))%2;ypp++) {
356               //****for(ypp=((gamma[j]+delta[j+1])*(x*(1+alpha[i]+beta[i])+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x*(1+alpha[i]+beta[i])+yp))%2;ypp++) {
357                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
358                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
359                   //for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
360                   for(yppp=((gamma[j+3]+delta[j+4])*(x+yp+xpp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x+yp+xpp))%2; yppp++) {
361                   //****for(yppp=((gamma[j+3]+delta[j+4])*(x*(1+alpha[i]+beta[i])+yp+xpp*(1+alpha[j]+beta[j])))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x*(1+alpha[i]+beta[i])+yp+xpp*(1+alpha[j]+beta[j])))%2; yppp++) {
362                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
363                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
364                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
365                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
366                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
367                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
368                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
369                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
370                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
371                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
372                               + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
373                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
374                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
375                     }
376                   }
377                 }
378               }
379               for(ypp=0; ypp<=1; ypp++) {
380                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
381                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
382                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
383                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
384                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
385                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
386                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
387                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
388                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
389                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
390                     }
391                   }
392                 }
393               }
394               //for(ypp=0; ypp<=1; ypp++) {
395               for(ypp=((gamma[j]+delta[j+1])*(x+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x+yp))%2;ypp++) {
396               //****for(ypp=((gamma[j]+delta[j+1])*(x*(1+alpha[i]+beta[i])+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(x*(1+alpha[i]+beta[i])+yp))%2;ypp++) {
397                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
398                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
399                   //for(yppp=xpp; yppp<=1; yppp++) {
400                   //**for(yppp=(x+yp+xpp)%2; yppp<=1; yppp++) {
401                   for(yppp=(x*(1+alpha[i]+beta[i])+yp+xpp*(1+alpha[j]+beta[j]))%2; yppp<=1; yppp++) {
402                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
403                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+(x+yp+xpp))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(x+yp+xpp))%2; xppp++) {
404                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+(x*(1+alpha[i]+beta[i])+yp+xpp*(1+alpha[j]+beta[j])))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(x*(1+alpha[i]+beta[i])+yp+xpp*(1+alpha[j]+beta[j])))%2; xppp++) {
405                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
406                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
407                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
408                                            + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
409                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
410                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
411                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
412                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
413                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
414                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
415                     }
416                   }
417                 }
418               }
419               
420               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
421                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
422                   for(yppp=0; yppp<=1; yppp++) {
423                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
424                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
425                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
426                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
427                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
428                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
429                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
430                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
431                     }
432                   }
433                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
434                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
435                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
436                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
437                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
438                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
439                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
440                     }
441                   }
442                   for(yppp=0; yppp<=1; yppp++) {
443                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
444                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
445                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
446                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
447                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
448                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
449                     }
450                   }
451                 }
452               }
453
454               //for(ypp=0; ypp<=1; ypp++) {
455               //**for(ypp=(x+yp)%2; ypp<=1; ypp++) {
456               for(ypp=(x*(1+alpha[i]+beta[i])+yp)%2; ypp<=1; ypp++) {
457                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
458                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+x+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x+yp)%2; xpp++) {
459                 for(xpp=(ypp*(delta[j]+delta[j+1])+x*(1+alpha[i]+beta[i])+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x*(1+alpha[i]+beta[i])+yp)%2; xpp++) {
460                   //for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
461                   for(yppp=((gamma[j+3]+delta[j+4])*(x+yp+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x+yp+ypp))%2; yppp++) {
462                   //****for(yppp=((gamma[j+3]+delta[j+4])*(x*(1+alpha[i]+beta[i])+yp+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(x*(1+alpha[i]+beta[i])+yp+ypp))%2; yppp++) {
463                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
464                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
465                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
466                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
467                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
468                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
469                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
470                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
471                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
472                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
473                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
474                     }
475                   }
476                 }
477               }
478               for(ypp=0; ypp<=1; ypp++) {
479                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
480                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
481                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
482                       summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
483                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
484                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
485                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
486                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
487                     }
488                   }
489                 }
490               }
491               //for(ypp=0; ypp<=1; ypp++) {
492               //**for(ypp=(x+yp)%2; ypp<=1; ypp++) {
493               for(ypp=(x*(1+alpha[i]+beta[i])+yp)%2; ypp<=1; ypp++) {
494                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
495                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+x+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x+yp)%2; xpp++) {
496                 for(xpp=(ypp*(delta[j]+delta[j+1])+x*(1+alpha[i]+beta[i])+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+x*(1+alpha[i]+beta[i])+yp)%2; xpp++) {
497                   //for(yppp=ypp; yppp<=1; yppp++) {
498                   //**for(yppp=(x+yp+ypp)%2; yppp<=1; yppp++) {
499                   for(yppp=(x*(1+alpha[i]+beta[i])+yp+ypp)%2; yppp<=1; yppp++) {
500                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
501                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+x+yp+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+x+yp+ypp)%2; xppp++) {
502                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+x*(1+alpha[i]+beta[i])+yp+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+x*(1+alpha[i]+beta[i])+yp+ypp)%2; xppp++) {
503                       //summand += (2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
504                       summand += 2.0*(2.0*(0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*Gausssum1d(0.0,beta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(gamma[i+2]+delta[i+2]) 
505                                        //+ 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
506                                        + 0.125*pow(2.0,(1-y*pow(gamma[i]-gamma[i+1],2)-pow(y-1,2)*pow(gamma[i]-delta[i+1],2))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[i+1]-gamma[i])*pow(y+1,2)+2.0*(beta[i]+beta[i+1]+gamma[i]+delta[i+1])*x*pow(y+1,2)+2.0*(delta[i]+delta[i+1]+beta[i]+beta[i+1])*x*y+(2.0*beta[i]+3.0*delta[i]+delta[i+1])*y))*csqrt(-I)*Gausssum1d(gamma[i+2]+delta[i+2],0)*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1])*Kroneck(alpha[i+2]+beta[i+2]))
507                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
508                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
509                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
510                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
511                     }
512                   }
513                 }
514               }
515             }
516           }
517         }
518       }
519       
520       
521       // fourth term
522       for(y=0; y<=(1+alpha[i+2])%2; y++) {
523         for(x=0; x<=(1+beta[i+2])%2; x++) {
524           for(yp=0; yp<=1; yp++) {
525             //**for(xp=0;xp<=(yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
526             for(xp=yp*(beta[i+3]+alpha[i+4]+beta[i+4])%2;xp<=(yp*(beta[i+3]+alpha[i+4]+beta[i+4])+yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
527               for(ypp=0; ypp<=1; ypp++) {
528                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
529                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
530                   for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
531                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
532                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
533                     
534                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
535                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
536                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
537                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
538                               + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
539                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
540                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
541                     }
542                   }
543                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
544                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
545                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
546                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
547                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
548                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
549                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
550                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
551                     }
552                   }
553                   //**for(yppp=xpp; yppp<=1; yppp++) {
554                   for(yppp=xpp*(1+alpha[j]+beta[j])%2; yppp<=1; yppp++) {
555                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
556                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp*(1+alpha[j]+beta[j]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp*(1+alpha[j]+beta[j]))%2; xppp++) {
557                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
558                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
559                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
560                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
561                                       + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
562                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
563                     }
564                   }
565                 }
566               }
567
568               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
569                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
570                   for(yppp=0; yppp<=1; yppp++) {
571                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
572                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
573                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
574                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
575                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
576                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
577                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
578                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
579                     }
580                   }
581                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
582                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
583                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
584                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
585                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
586                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
587                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
588                     }
589                   }
590                   for(yppp=0; yppp<=1; yppp++) {
591                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
592                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
593                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
594                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
595                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
596                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
597                     }
598                   }
599                 }
600               }
601               
602               for(ypp=0; ypp<=1; ypp++) {
603                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
604                   for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
605                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
606                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
607                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
608                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
609                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
610                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
611                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
612                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
613                     }
614                   }
615                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
616                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
617                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
618                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
619                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
620                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
621                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
622                     }
623                   }
624                   for(yppp=ypp; yppp<=1; yppp++) {
625                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
626                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
627                 *(0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
628                   + 0.125*pow(2.0,1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
629                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
630                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
631                     }
632                   }
633                 }
634               }
635             }
636           }
637         }
638       }
639
640
641       // fifth term
642       for(y=0; y<=(1+alpha[i+2])%2; y++) {
643         for(x=0; x<=(1+beta[i+2])%2; x++) {
644           for(yp=0; yp<=(1+alpha[i+5])%2; yp++) {
645             for(xp=0;xp<=(1+beta[i+5])%2; xp++) {
646               for(ypp=0; ypp<=1; ypp++) {
647                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
648                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
649                   for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
650                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
651                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
652                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
653                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
654                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
655                               + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
656                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
657                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
658                     }
659                   }
660                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
661                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
662                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
663                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
664                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
665                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
666                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
667                     }
668                   }
669                   //**for(yppp=xpp; yppp<=1; yppp++) {
670                   for(yppp=xpp*(1+alpha[j]+beta[j])%2; yppp<=1; yppp++) {
671                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
672                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp*(1+alpha[j]+beta[j]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp*(1+alpha[j]+beta[j]))%2; xppp++) {
673                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
674                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
675                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
676                                       + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
677                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
678                     }
679                   }
680                 }
681               }
682
683               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
684                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
685                   for(yppp=0; yppp<=1; yppp++) {
686                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
687                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
688                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
689                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
690                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
691                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
692                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
693                     }
694                   }
695                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
696                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
697                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
698                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
699                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
700                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
701                     }
702                   }
703                   for(yppp=0; yppp<=1; yppp++) {
704                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
705                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
706                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
707                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
708                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
709                     }
710                   }
711                 }
712               }
713
714               for(ypp=0; ypp<=1; ypp++) {
715                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
716                   for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
717                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
718                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
719                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
720                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
721                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
722                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
723                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
724                     }
725                   }
726                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
727                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
728                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
729                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
730                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
731                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
732                     }
733                   }
734                   for(yppp=ypp; yppp<=1; yppp++) {
735                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
736                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
737                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
738                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
739                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
740                     }
741                   }
742                 }
743               }
744             }
745           }
746         }
747       }
748
749       
750       // sixth term
751       for(y=0; y<=(1+alpha[i+2])%2; y++) {
752         for(x=0; x<=(1+beta[i+2])%2; x++) {
753           for(yp=0; yp<=1; yp++) {
754             for(xp=(yp*(delta[i+3]+delta[i+4]))%2;xp<=(1+yp*(gamma[i+3]+gamma[i+4]))%2; xp++) {
755               for(ypp=0; ypp<=1; ypp++) {
756                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
757                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
758                   for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
759                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
760                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
761                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
762                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
763                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
764                               + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
765                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
766                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
767                     }
768                   }
769                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
770                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
771                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
772                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
773                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
774                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
775                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
776                     }
777                   }
778                   //**for(yppp=xpp; yppp<=1; yppp++) {
779                   for(yppp=xpp*(1+alpha[j]+beta[j])%2; yppp<=1; yppp++) {
780                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
781                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp*(1+alpha[j]+beta[j]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp*(1+alpha[j]+beta[j]))%2; xppp++) {
782                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
783                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
784                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
785                                       + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
786                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
787                     }
788                   }
789                 }
790               }
791
792               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
793                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
794                   for(yppp=0; yppp<=1; yppp++) {
795                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
796                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
797                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
798                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
799                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
800                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
801                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
802                     }
803                   }
804                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
805                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
806                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
807                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
808                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
809                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
810                     }
811                   }
812                   for(yppp=0; yppp<=1; yppp++) {
813                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
814                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
815                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
816                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
817                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
818                     }
819                   }
820                 }
821               }
822
823               for(ypp=0; ypp<=1; ypp++) {
824                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
825                   for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
826                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
827                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
828                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
829                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
830                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
831                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
832                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
833                     }
834                   }
835                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
836                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
837                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
838                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
839                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
840                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
841                     }
842                   }
843                   for(yppp=ypp; yppp<=1; yppp++) {
844                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
845                       summand += ((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+2]*y+pow(x+1,2)*(delta[i]+gamma[i+1]+2.0*beta[i+1])+x*(delta[i]+delta[i+1])))*Gausssum1d(1,beta[i]+beta[i+1]+delta[i]+(x+1)*gamma[i+1]+x*delta[i+1])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(gamma[i+2]+delta[i+2]))
846                                   *(0.125*(-I)*pow(2.0,(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
847                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
848                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
849                     }
850                   }
851                 }
852               }
853             }
854           }
855         }
856       }
857
858       
859       // seventh term
860       for(y=0; y<=1; y++) {
861         for(x=(y*(delta[i]+delta[i+1]))%2; x<=(1+y*(gamma[i]+gamma[i+1]))%2; x++) {
862           for(yp=((gamma[i+3]+delta[i+4])*y)%2; yp<=(1+(gamma[i+3]+gamma[i+4])*y)%2; yp++) {
863             //**for(xp=0;xp<=(yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
864             for(xp=yp*(beta[i+3]+alpha[i+4]+beta[i+4])%2;xp<=(yp*(beta[i+3]+alpha[i+4]+beta[i+4])+yp*(gamma[i+3]+gamma[i+4])+(yp+1)*(gamma[i+3]+delta[i+4]))%2; xp++) {
865               
866               //for(ypp=0; ypp<=1; ypp++) {
867               for(ypp=((gamma[j]+delta[j+1])*(y+xp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+xp))%2;ypp++) {
868                 //****for(ypp=((gamma[j]+delta[j+1])*(y+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp++) {
869                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
870                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
871                   //for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
872                   for(yppp=((gamma[j+3]+delta[j+4])*(y+xp+xpp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+xp+xpp))%2; yppp++) {
873                   //****for(yppp=((gamma[j+3]+delta[j+4])*(y+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; yppp++) {
874                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
875                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
876                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
877                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
878                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
879                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
880                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
881                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
882                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
883                               + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
884                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
885                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
886                     }
887                   }
888                 }
889               }
890               for(ypp=0; ypp<=1; ypp++) {
891                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
892                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
893                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
894                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
895                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
896                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
897                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
898                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
899                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
900                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
901                     }
902                   }
903                 }
904               }
905
906               //for(ypp=0; ypp<=1; ypp++) {
907               for(ypp=((gamma[j]+delta[j+1])*(y+xp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+xp))%2;ypp++) {
908               //****for(ypp=((gamma[j]+delta[j+1])*(y+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+xp*(1+alpha[i+3]+beta[i+3])))%2;ypp++) {
909                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
910                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
911                   //for(yppp=xpp; yppp<=1; yppp++) {
912                   //**for(yppp=(y+xp+xpp)%2; yppp<=1; yppp++) {
913                   for(yppp=(y+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j]))%2; yppp<=1; yppp++) {
914                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
915                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+(y+xp+xpp))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(y+xp+xpp))%2; xppp++) {
916                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+(y+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(y+xp*(1+alpha[i+3]+beta[i+3])+xpp*(1+alpha[j]+beta[j])))%2; xppp++) {
917                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
918                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
919                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
920                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
921                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
922                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
923                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
924                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
925                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
926                     }
927                   }
928                 }
929               }
930
931               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
932                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
933                   for(yppp=0; yppp<=1; yppp++) {
934                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
935                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
936                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
937                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
938                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
939                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
940                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
941                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
942                     }
943                   }
944                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
945                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
946                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
947                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
948                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
949                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
950                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
951                     }
952                   }
953                   for(yppp=0; yppp<=1; yppp++) {
954                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
955                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
956                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
957                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
958                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
959                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
960                     }
961                   }
962                 }
963               }
964
965               //for(ypp=0; ypp<=1; ypp++) {
966               //**for(ypp=(y+xp)%2; ypp<=1; ypp++) {
967               for(ypp=(y+xp*(1+alpha[i+3]+beta[i+3]))%2; ypp<=1; ypp++) {
968                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
969                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+y+xp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+xp)%2; xpp++) {
970                 for(xpp=(ypp*(delta[j]+delta[j+1])+y+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp++) {
971                   //for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
972                   for(yppp=((gamma[j+3]+delta[j+4])*(y+xp+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+xp+ypp))%2; yppp++) {
973                     //****for(yppp=((gamma[j+3]+delta[j+4])*(y+xp*(1+alpha[i+3]+beta[i+3])+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+xp*(1+alpha[i+3]+beta[i+3])+ypp))%2; yppp++) {
974                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
975                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
976                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
977                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
978                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
979                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
980                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
981                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
982                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
983                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
984                     }
985                   }
986                 }
987               }
988               for(ypp=0; ypp<=1; ypp++) {
989                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
990                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
991                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
992                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
993                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
994                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
995                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
996                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
997                     }
998                   }
999                 }
1000               }
1001               //for(ypp=0; ypp<=1; ypp++) {
1002               //**for(ypp=(y+xp)%2; ypp<=1; ypp++) {
1003               for(ypp=(y+xp*(1+alpha[i+3]+beta[i+3]))%2; ypp<=1; ypp++) {
1004                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
1005                 //**for(xpp=(ypp*(delta[j]+delta[j+1])+y+xp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+xp)%2; xpp++) {
1006                 for(xpp=(ypp*(delta[j]+delta[j+1])+y+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+xp*(1+alpha[i+3]+beta[i+3]))%2; xpp++) {
1007                   //for(yppp=ypp; yppp<=1; yppp++) {
1008                   //**for(yppp=(y+xp+ypp)%2; yppp<=1; yppp++) {
1009                   for(yppp=(y+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2; yppp<=1; yppp++) {
1010                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
1011                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+y+xp+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+y+xp+ypp)%2; xppp++) {
1012                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+y+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+y+xp*(1+alpha[i+3]+beta[i+3])+ypp)%2; xppp++) {
1013                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1014                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(1-yp*pow(gamma[i+3]-gamma[i+4],2)-pow(yp-1,2)*pow(gamma[i+3]-delta[i+4],2))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1015                 *(0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*Gausssum1d(0.0,beta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(gamma[i+5]+delta[i+5]) 
1016                   + 0.125*cexp(M_PI*I/2.0*((delta[i+4]-gamma[i+3])*pow(yp+1,2)+2.0*(beta[i+3]+beta[i+4]+gamma[i+3]+delta[i+4])*xp*pow(yp+1,2)+2.0*(delta[i+3]+delta[i+4]+beta[i+3]+beta[i+4])*xp*yp+(2.0*beta[i+3]+3.0*delta[i+3]+delta[i+4])*yp))*csqrt(-I)*Gausssum1d(gamma[i+5]+delta[i+5],0)*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4])*Kroneck(alpha[i+5]+beta[i+5])))
1017                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1018                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1019                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1020                     }
1021                   }
1022                 }
1023               }
1024             }
1025           }
1026         }
1027       }
1028
1029       
1030       // eighth term
1031       for(y=0; y<=1; y++) {
1032         for(x=(y*(delta[i]+delta[i+1]))%2; x<=(1+y*(gamma[i]+gamma[i+1]))%2; x++) {
1033           for(yp=0; yp<=(1+alpha[i+5])%2; yp++) {
1034             for(xp=0;xp<=(1+beta[i+5])%2; xp++) {
1035               for(ypp=0; ypp<=1; ypp++) {
1036                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1037                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1038                   for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
1039                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1040                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1041                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1042                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1043                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1044                               + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1045                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1046                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1047                     }
1048                   }
1049                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1050                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1051                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1052                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1053                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1054                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1055                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1056                     }
1057                   }
1058                   //**for(yppp=xpp; yppp<=1; yppp++) {
1059                   for(yppp=xpp*(1+alpha[j]+beta[j])%2; yppp<=1; yppp++) {
1060                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
1061                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp*(1+alpha[j]+beta[j]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp*(1+alpha[j]+beta[j]))%2; xppp++) {
1062                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1063                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1064                         *(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1065                                       + 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1066                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1067                     }
1068                   }
1069                 }
1070               }
1071
1072               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
1073                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
1074                   for(yppp=0; yppp<=1; yppp++) {
1075                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1076                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1077                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1078                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1079                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1080                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1081                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1082                     }
1083                   }
1084                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1085                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1086                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1087                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1088                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1089                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1090                     }
1091                   }
1092                   for(yppp=0; yppp<=1; yppp++) {
1093                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
1094                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1095                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1096                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1097                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1098                     }
1099                   }
1100                 }
1101               }
1102
1103               for(ypp=0; ypp<=1; ypp++) {
1104                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
1105                   for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
1106                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1107                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1108                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1109                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1110                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1111                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1112                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1113                     }
1114                   }
1115                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1116                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1117                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1118                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1119                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1120                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1121                     }
1122                   }
1123                   for(yppp=ypp; yppp<=1; yppp++) {
1124                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
1125                       summand += ((0.125*pow(2.0,pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1126                                   *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[i+5]*yp+pow(xp+1,2)*(delta[i+3]+gamma[i+4]+2.0*beta[i+4])+xp*(delta[i+3]+delta[i+4])))*Gausssum1d(1,beta[i+3]+beta[i+4]+delta[i+3]+(xp+1)*gamma[i+4]+xp*delta[i+4])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(gamma[i+5]+delta[i+5])))
1127                         *(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1128                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1129                     }
1130                   }
1131                 }
1132               }
1133             }
1134           }
1135         }
1136       }
1137
1138
1139       // ninth term
1140       for(y=0; y<=1; y++) {
1141         for(x=(y*(delta[i]+delta[i+1]))%2; x<=(1+y*(gamma[i]+gamma[i+1]))%2; x++) {
1142           for(yp=y; yp<=1; yp++) {
1143             for(xp=(yp*(delta[i+3]+delta[i+4])+y)%2;xp<=(1+yp*(gamma[i+3]+gamma[i+4])+y)%2; xp++) {
1144               //for(ypp=0; ypp<=1; ypp++) {
1145               for(ypp=((gamma[j]+delta[j+1])*(y+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+yp))%2;ypp++) {
1146                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1147                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1148                   //for(yppp=((gamma[j+3]+delta[j+4])*xpp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*xpp)%2; yppp++) {
1149                   for(yppp=((gamma[j+3]+delta[j+4])*(y+yp+xpp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+yp+xpp))%2; yppp++) {
1150                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1151                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1152                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1153                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1154                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1155                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1156                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1157                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1158                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1159                         *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1160                           + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1161                     }
1162                   }
1163                 }
1164               }
1165               for(ypp=0; ypp<=1; ypp++) {
1166                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1167                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1168                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1169                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1170                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1171                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1172                         *((0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1173                                   + 0.125*pow(2.0,1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1174                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1175                     }
1176                   }
1177                 }
1178               }
1179               //for(ypp=0; ypp<=1; ypp++) {
1180               for(ypp=((gamma[j]+delta[j+1])*(y+yp))%2;ypp<=(1+(gamma[j]+gamma[j+1])*(y+yp))%2;ypp++) {
1181                 //**for(xpp=0;xpp<=(ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1182                 for(xpp=ypp*(beta[j]+alpha[j+1]+beta[j+1])%2;xpp<=(ypp*(beta[j]+alpha[j+1]+beta[j+1])+ypp*(gamma[j]+gamma[j+1])+(ypp+1)*(gamma[j]+delta[j+1]))%2; xpp++) {
1183                   //for(yppp=xpp; yppp<=1; yppp++) {
1184                   //**for(yppp=(y+yp+xpp)%2; yppp<=1; yppp++) {
1185                   for(yppp=(y+yp+xpp*(1+alpha[j]+beta[j]))%2; yppp<=1; yppp++) {
1186                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+xpp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+xpp)%2; xppp++) {
1187                     //**for(xppp=(yppp*(delta[j+3]+delta[j+4])+(y+yp+xpp))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(y+yp+xpp))%2; xppp++) {
1188                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+(y+yp+xpp*(1+alpha[j]+beta[j])))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+(y+yp+xpp*(1+alpha[j]+beta[j])))%2; xppp++) {
1189                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1190                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1191                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1192                         //*(2.0*(0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1193                         *(2.0*(0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*Gausssum1d(0.0,beta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(gamma[j+2]+delta[j+2]) 
1194                                //+ 0.125*pow(2.0,(1-ypp*pow(gamma[j]-gamma[j+1],2)-pow(ypp-1,2)*pow(gamma[j]-delta[j+1],2))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1195                                + 0.125*cexp(M_PI*I/2.0*((delta[j+1]-gamma[j])*pow(ypp+1,2)+2.0*(beta[j]+beta[j+1]+gamma[j]+delta[j+1])*xpp*pow(ypp+1,2)+2.0*(delta[j]+delta[j+1]+beta[j]+beta[j+1])*xpp*ypp+(2.0*beta[j]+3.0*delta[j]+delta[j+1])*ypp))*csqrt(-I)*Gausssum1d(gamma[j+2]+delta[j+2],0)*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1])*Kroneck(alpha[j+2]+beta[j+2]))
1196                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1197                     }
1198                   }
1199                 }
1200               }
1201
1202               for(ypp=0; ypp<=(1+alpha[j+2])%2; ypp++) {
1203                 for(xpp=0; xpp<=(1+beta[j+2])%2; xpp++) {
1204                   for(yppp=0; yppp<=1; yppp++) {
1205                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1206                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1207                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1208                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1209                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1210                           *(0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1211                             + 0.125*pow(2.0,1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2))*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1212                     }
1213                   }
1214                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1215                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1216                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1217                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1218                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1219                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1220                     }
1221                   }
1222                   for(yppp=0; yppp<=1; yppp++) {
1223                     for(xppp=(yppp*(delta[j+3]+delta[j+4]))%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4]))%2; xppp++) {
1224                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1225                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1226                         *((0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+2]*ypp+pow(xpp+1,2)*(delta[j]+gamma[j+1]+2.0*beta[j+1])+xpp*(delta[j]+delta[j+1])))*Gausssum1d(1,beta[j]+beta[j+1]+delta[j]+(xpp+1)*gamma[j+1]+xpp*delta[j+1])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(gamma[j+2]+delta[j+2]))
1227                           *(0.125*(-I)*pow(2.0,(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1228                     }
1229                   }
1230                 }
1231               }
1232
1233               //for(ypp=0; ypp<=1; ypp++) {
1234               for(ypp=(y+yp)%2; ypp<=1; ypp++) {
1235                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
1236                 for(xpp=(ypp*(delta[j]+delta[j+1])+y+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+yp)%2; xpp++) {
1237                   //for(yppp=((gamma[j+3]+delta[j+4])*ypp)%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*ypp)%2; yppp++) {
1238                   for(yppp=((gamma[j+3]+delta[j+4])*(y+yp+ypp))%2; yppp<=(1+(gamma[j+3]+gamma[j+4])*(y+yp+ypp))%2; yppp++) {
1239                     //**for(xppp=0;xppp<=(yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1240                     for(xppp=yppp*(beta[j+3]+alpha[j+4]+beta[j+4])%2;xppp<=(yppp*(beta[j+3]+alpha[j+4]+beta[j+4])+yppp*(gamma[j+3]+gamma[j+4])+(yppp+1)*(gamma[j+3]+delta[j+4]))%2; xppp++) {
1241                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1242                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1243                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1244                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(1-yppp*pow(gamma[j+3]-gamma[j+4],2)-pow(yppp-1,2)*pow(gamma[j+3]-delta[j+4],2)))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1245                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1246                           *(0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*Gausssum1d(0.0,beta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(gamma[j+5]+delta[j+5]) 
1247                             + 0.125*cexp(M_PI*I/2.0*((delta[j+4]-gamma[j+3])*pow(yppp+1,2)+2.0*(beta[j+3]+beta[j+4]+gamma[j+3]+delta[j+4])*xppp*pow(yppp+1,2)+2.0*(delta[j+3]+delta[j+4]+beta[j+3]+beta[j+4])*xppp*yppp+(2.0*beta[j+3]+3.0*delta[j+3]+delta[j+4])*yppp))*csqrt(-I)*Gausssum1d(gamma[j+5]+delta[j+5],0)*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4])*Kroneck(alpha[j+5]+beta[j+5])));
1248                     }
1249                   }
1250                 }
1251               }
1252               for(ypp=0; ypp<=1; ypp++) {
1253                 for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
1254                   for(yppp=0; yppp<=(1+alpha[j+5])%2; yppp++) {
1255                     for(xppp=0;xppp<=(1+beta[j+5])%2; xppp++) {
1256                       summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1257                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1258                         *((0.125*pow(2.0,pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1259                           *(0.125*2.0*csqrt(-I)*cexp(M_PI*I/2.0*(2.0*beta[j+5]*yppp+pow(xppp+1,2)*(delta[j+3]+gamma[j+4]+2.0*beta[j+4])+xppp*(delta[j+3]+delta[j+4])))*Gausssum1d(1,beta[j+3]+beta[j+4]+delta[j+3]+(xppp+1)*gamma[j+4]+xppp*delta[j+4])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(gamma[j+5]+delta[j+5])));
1260                     }
1261                   }
1262                 }
1263               }
1264               //for(ypp=0; ypp<=1; ypp++) {
1265               for(ypp=(y+yp)%2; ypp<=1; ypp++) {
1266                 //for(xpp=(ypp*(delta[j]+delta[j+1]))%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1]))%2; xpp++) {
1267                 for(xpp=(ypp*(delta[j]+delta[j+1])+y+yp)%2; xpp<=(1+ypp*(gamma[j]+gamma[j+1])+y+yp)%2; xpp++) {
1268                   //for(yppp=ypp; yppp<=1; yppp++) {
1269                   for(yppp=(y+yp+ypp)%2; yppp<=1; yppp++) {
1270                     //for(xppp=(yppp*(delta[j+3]+delta[j+4])+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+ypp)%2; xppp++) {
1271                     for(xppp=(yppp*(delta[j+3]+delta[j+4])+y+yp+ypp)%2;xppp<=(1+yppp*(gamma[j+3]+gamma[j+4])+y+yp+ypp)%2; xppp++) {
1272                       //summand += (2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1273                       summand += 2.0*(2.0*(0.125*pow(2.0,(pow(y-1,2)*(pow(x,2)*(gamma[i]+delta[i+1])+pow(x-1,2)*(gamma[i+1]+delta[i])))*(pow(yp-1,2)*(pow(xp,2)*(gamma[i+3]+delta[i+4])+pow(xp-1,2)*(gamma[i+4]+delta[i+3])))*(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(y*(delta[i]+delta[i+1])+pow(y+1,2)*(delta[i]+gamma[i+1]+2*beta[i+1])+pow(x,2)+2*(beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y)*x))*Gausssum1d(0,x+beta[i]+beta[i+1]+delta[i]+gamma[i+1]*(y+1)+delta[i+1]*y+gamma[i+2]+delta[i+2])*Kroneck(gamma[i]+delta[i]-gamma[i+1]-delta[i+1]+1)*Kroneck(alpha[i+2]+beta[i+2]))
1274                                   *(0.125*(-I)*cexp(M_PI*I/2.0*(yp*(delta[i+3]+delta[i+4])+pow(yp+1,2)*(delta[i+3]+gamma[i+4]+2*beta[i+4])+pow(xp,2)+2*(beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp)*xp))*Gausssum1d(0,xp+beta[i+3]+beta[i+4]+delta[i+3]+gamma[i+4]*(yp+1)+delta[i+4]*yp+gamma[i+5]+delta[i+5])*Kroneck(gamma[i+3]+delta[i+3]-gamma[i+4]-delta[i+4]+1)*Kroneck(alpha[i+5]+beta[i+5])))
1275                         //*(2.0*(0.125*pow(2.0,(pow(ypp-1,2)*(pow(xpp,2)*(gamma[j]+delta[j+1])+pow(xpp-1,2)*(gamma[j+1]+delta[j])))*(pow(yppp-1,2)*(pow(xppp,2)*(gamma[j+3]+delta[j+4])+pow(xppp-1,2)*(gamma[j+4]+delta[j+3]))))*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1276                         *(2.0*(0.125*(-I)*cexp(M_PI*I/2.0*(ypp*(delta[j]+delta[j+1])+pow(ypp+1,2)*(delta[j]+gamma[j+1]+2*beta[j+1])+pow(xpp,2)+2*(beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp)*xpp))*Gausssum1d(0,xpp+beta[j]+beta[j+1]+delta[j]+gamma[j+1]*(ypp+1)+delta[j+1]*ypp+gamma[j+2]+delta[j+2])*Kroneck(gamma[j]+delta[j]-gamma[j+1]-delta[j+1]+1)*Kroneck(alpha[j+2]+beta[j+2]))
1277                           *(0.125*(-I)*cexp(M_PI*I/2.0*(yppp*(delta[j+3]+delta[j+4])+pow(yppp+1,2)*(delta[j+3]+gamma[j+4]+2*beta[j+4])+pow(xppp,2)+2*(beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp)*xppp))*Gausssum1d(0,xppp+beta[j+3]+beta[j+4]+delta[j+3]+gamma[j+4]*(yppp+1)+delta[j+4]*yppp+gamma[j+5]+delta[j+5])*Kroneck(gamma[j+3]+delta[j+3]-gamma[j+4]-delta[j+4]+1)*Kroneck(alpha[j+5]+beta[j+5])));
1278                     }
1279                   }
1280                 }
1281               }
1282             }
1283           }
1284         }
1285       }
1286       
1287       
1288       sum *= summand;
1289     }
1290     //printf("%lf+%lfI\n", creal(sum), cimag(sum));
1291     printf("%lf\n", cabs(creal(sum))); 
1292
1293
1294   }
1295
1296   return 0;
1297 }
1298
1299 complex double Kroneck(int arg)
1300 {
1301   arg = (arg+1)%2; // output 1 if argument is 0 mod 2 and 0 otherwise
1302   return ((complex double)arg);
1303 }
1304
1305 complex double Gausssum1d(int quadraticcoeff, int linearcoeff)
1306 {
1307   /*****************************************
1308   /* NOTE! we assume coeffs are either 0 or 1
1309   /* (So you cannot pass off a linear coeff as a quadratic coeff by multiplying it by a factor of 2 (and considering it as mod 4)!)
1310   *****************************************/
1311   
1312   quadraticcoeff %= 2;
1313   linearcoeff %= 2;
1314     
1315   if(quadraticcoeff == 0)
1316     if(linearcoeff == 0)
1317       return 2.0+0.0*I;
1318     else
1319       return 0.0*I;
1320   else
1321     if(linearcoeff == 0)
1322       return 1.0+1.0*I;
1323     else
1324       return 1.0-1.0*I;
1325
1326 }
1327
1328 int readPaulicoeffs(int *alpha, int *beta, int *gamma, int *delta, int numqubits)
1329 {
1330
1331   int i;
1332
1333   if(scanf("%d %d %d %d", &alpha[0], &beta[0], &gamma[0], &delta[0]) != EOF) {
1334     for(i=1; i<numqubits; i++) {
1335       scanf("%d %d %d %d", &alpha[i], &beta[i], &gamma[i], &delta[i]);
1336     }
1337     return 1;
1338   } else
1339     return 0;
1340
1341 }
1342
1343
1344