template class for both bigint and smallint implementations More...
#include <CModulus.h>
Public Member Functions | |
Cmod (const Cmod &other) | |
Cmod (const PAlgebra &zms, const zz &qq, const zz &rt) | |
Cmod & | operator= (const Cmod &other) |
const PAlgebra & | getZMStar () const |
unsigned | getM () const |
unsigned | getPhiM () const |
const zz & | getQ () const |
const zz & | getRoot () const |
const zpxModulus & | getPhimX () const |
zpx & | getScratch () const |
void | restoreModulus () const |
Restore NTL's current modulus. | |
void | FFT (zzv &y, const ZZX &x) const |
void | iFFT (zpx &x, const zzv &y) const |
template class for both bigint and smallint implementations
This is a wrapper around the bluesteinFFT routines, for one modulus q. Two classes are defined here, Cmodulus for a small moduli (long) and CModulus for a large ones (ZZ). These classes are otherwise identical hence they are implemented using a class template.
On initialization, it initizlies NTL's zz_pContext/ZZ_pContext for this q and computes a 2m-th root of unity r mod q and also r^{-1} mod q. Thereafter this class provides FFT and iFFT routines that converts between time & frequency domains. Some tables are computed the first time that each dierctions is called, which are then used in subsequent computations.
The "time domain" polynomials are represented as ZZX, whic are reduced modulo Phi_m(X). The "frequency domain" are jusr vectors of integers (vec_long or vec_ZZ), that store only the evaluation in primitive m-th roots of unity.