diff --git a/bin/encoder.o b/bin/encoder.o index 66bb08d71a4344b4bc6a95824fd5374cbded1496..bb082c90422ecb58de966ffdb42466f0808f5e8e 100644 Binary files a/bin/encoder.o and b/bin/encoder.o differ diff --git a/run b/run index b4f07aa828b550f23c6d96b2287e1cd1ec7e1f57..b1c3c0ea847007b73cfc044827f9e4f452b6ead7 100755 Binary files a/run and b/run differ diff --git a/src/encoder.cpp b/src/encoder.cpp index bebc80b10ae465568f6ac1b126121ab38238000b..41308ebf268d099b8f8a60e9a3f2133913d6c061 100644 --- a/src/encoder.cpp +++ b/src/encoder.cpp @@ -75,12 +75,34 @@ dcomparr Encoder::piInv(dcomparr input){ dcomparr Encoder::sigma(Polynomial pol){ int N = M/4; dcomparr out; - for(int i=0; i<N; i++){ - for (int j=0; j<M/2; j++){ - out.arr[i] += pol.coeffs[j] * vandermonde[i][j]; + if(pol.degree == 2*N){ + for(int i=0; i<N; i++){ + for (int j=0; j<M/2; j++){ + out.arr[i] += pol.coeffs[j] * vandermonde[i][j]; + } + } + }else{ + int R = 2; + dcomplex tempVandermonde[10][10]; + + while (R < pol.degree){ + R <<=2; + } + + for(int i=0; i<R; i++){ + for(int j=0; j<R; j++){ + int power = (2*i+1) * j; + dcomplex temp = pow(exp((2*M_PI/M) * J), power); + tempVandermonde[i][j] = temp; + } } - } + for(int i=0; i<R/2; i++){ + for (int j=0; j<R; j++){ + out.arr[i] += pol.coeffs[j] * tempVandermonde[i][j]; + } + } + } return out; }