PAlgebra.h
301 };
long OrderOf(long i) const
The order of i'th generator (if any)
Definition: PAlgebra.h:217
long getCoord(long i, long d) const
get coordinate in dimension d of index i
Definition: hypercube.h:104
long getNSlots() const
The number of plaintext slots = phi(m)/ord(p)
Definition: PAlgebra.h:186
long indexInZmstar_unchecked(long t) const
Returns the index of t in (Z/mZ)* – no range checking.
Definition: PAlgebra.h:244
const vec_RX & getCrtCoeffs() const
Returns the CRT coefficients: element i contains (prod_{j!=i} F_j)^{-1} mod F_i, where F_0 F_1 ....
Definition: PAlgebra.h:642
void embedInAllSlots(RX &H, const RX &alpha, const MappingData< type > &mappingData) const
Returns H in R[X]/Phi_m(X) s.t. for every t in T, the element Ht = (H mod Ft) in R[X]/Ft(X) represent...
Definition: PAlgebra.cpp:887
void decodePlaintext(std::vector< RX > &alphas, const RX &ptxt, const MappingData< type > &mappingData) const
Return an array such that alphas[i] in R[X]/G(X) represent the same element as rt = (H mod Ft) in R[X...
Definition: PAlgebra.cpp:1228
virtual const PAlgebra & getZMStar() const override
Returns reference to underlying PAlgebra object.
Definition: PAlgebra.h:611
long genToPow(long i, long j) const
the i'th generator to the power j mod m
Definition: PAlgebra.cpp:606
long addCoord(long i, long k, long offset) const
adds offset to index k in the i'th dimension
Definition: PAlgebra.h:272
const std::vector< NTL::ZZX > & getFactorsOverZZ() const
Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
Definition: PAlgebra.h:845
virtual long getR() const override
The value r.
Definition: PAlgebra.h:620
const quarter_FFT & getQuarterFFTInfo() const
Definition: PAlgebra.h:293
long assembleIndexByDim(std::pair< long, long > idx, long dim) const
The inverse of breakIndexByDim.
Definition: PAlgebra.h:266
zzX getMask_zzX(UNUSED long i, UNUSED long j) const override
Definition: PAlgebra.h:784
long indexInZmstar(long t) const
Returns the index of t in (Z/mZ)*.
Definition: PAlgebra.h:241
long fftSizeNeeded() const
The largest FFT we need to handle degree-m polynomials.
Definition: PAlgebra.h:288
Definition: PAlgebra.h:33
virtual PAlgebraModBase * clone() const =0
virtual void restoreContext() const =0
Restores the NTL context for p^r.
virtual void restoreContext() const override
Restores the NTL context for p^r.
Definition: PAlgebra.h:626
const std::vector< NTL::ZZX > & getFactorsOverZZ() const override
Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
Definition: PAlgebra.h:780
const PAlgebra & getZMStar() const
Returns reference to underlying PAlgebra object.
Definition: PAlgebra.h:843
long ZmStarGen(long i) const
the i'th generator in (Z/mZ)^* /(p) (if any)
Definition: PAlgebra.h:205
virtual const PAlgebra & getZMStar() const =0
Returns reference to underlying PAlgebra object.
void restoreContext() const
Restores the NTL context for p^r.
Definition: PAlgebra.h:854
void assertEq(const T &a, const T &b, const std::string &message)
Definition: assertions.h:108
long addCoord(long i, long d, long offset) const
add offset to coordinate in dimension d of index i
Definition: hypercube.h:115
bool incrementCoords(VecType &v) const
Definition: hypercube.h:138
Definition: PGFFT.h:30
virtual PAlgebraModBase * clone() const override
Returns a pointer to a "clone".
Definition: PAlgebra.h:602
std::pair< long, long > breakIndexByDim(long idx, long dim) const
Definition: PAlgebra.h:261
PAlgebra(long mm, long pp=2, const std::vector< long > &_gens=std::vector< long >(), const std::vector< long > &_ords=std::vector< long >())
Definition: PAlgebra.cpp:431
virtual const std::vector< NTL::ZZX > & getFactorsOverZZ() const override
Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
Definition: PAlgebra.h:614
long assembleIndexByDim(std::pair< long, long > idx, long dim) const
The inverse of breakIndexByDim.
Definition: hypercube.cpp:29
void printout(std::ostream &out=std::cout) const
Prints the structure in a readable form.
Definition: PAlgebra.cpp:107
PA_tag getTag() const override
Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
Definition: PAlgebra.h:772
const NTL::ZZX & getPhimX() const
The cyclotomix polynomial Phi_m(X)
Definition: PAlgebra.h:192
long getPow2() const
if m = 2^k, then pow2 == k; otherwise, pow2 == 0
Definition: PAlgebra.h:189
void CRT_decompose(std::vector< RX > &crt, const RX &H) const
Returns a std::vector crt[] such that crt[i] = H mod Ft (with t = T[i])
Definition: PAlgebra.cpp:872
long getProd(long d) const
product of sizes of dimensions d, d+1, ...
Definition: hypercube.h:95
bool operator!=(const PAlgebraMod &other) const
Definition: PAlgebra.h:835
bool operator==(const PAlgebraMod &other) const
Definition: PAlgebra.h:829
Definition: PAlgebra.h:41
const PAlgebra & getZMStar() const override
Returns reference to underlying PAlgebra object.
Definition: PAlgebra.h:774
long getPPowR() const override
The value p^r.
Definition: PAlgebra.h:776
bool SameOrd(long i) const
Is ord(i'th generator) the same as its order in (Z/mZ)^*?
Definition: PAlgebra.h:223
PAlgebraModBase * buildPAlgebraMod(const PAlgebra &zMStar, long r)
Builds a table, of type PA_GF2 if p == 2 and r == 1, and PA_zz_p otherwise.
Definition: PAlgebra.cpp:632
double getNormBnd() const
max-norm-on-pwfl-basis <= normBnd * max-norm-canon-embed
Definition: PAlgebra.h:180
virtual PA_tag getTag() const override
Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
Definition: PAlgebra.h:608
void embedInSlots(RX &H, const std::vector< RX > &alphas, const MappingData< type > &mappingData) const
Returns H in R[X]/Phi_m(X) s.t. for every t in T, the element Ht = (H mod Ft) in R[X]/Ft(X) represent...
Definition: PAlgebra.cpp:925
bool comparePAlgebra(const PAlgebra &palg, unsigned long m, unsigned long p, unsigned long r, const std::vector< long > &gens, const std::vector< long > &ords)
returns true if the palg parameters match the rest, false otherwise
double getPolyNormBnd() const
max-norm-on-pwfl-basis <= polyNormBnd * max-norm-canon-embed
Definition: PAlgebra.h:183
const RXModulus & getPhimXMod() const
Returns reference to an RXModulus representing Phi_m(X) (mod p^r)
Definition: PAlgebra.h:634
void mapToSlots(MappingData< type > &mappingData, const RX &G) const
Compute the maps for all the slots. In the current implementation, we if r > 1, then we must have eit...
Definition: PAlgebra.cpp:1101
long getNFactors() const
The number of distinct prime factors of m.
Definition: PAlgebra.h:174
Definition: apiAttributes.h:21
PAlgebraModCx(const PAlgebra &palg, long _r)
Definition: PAlgebra.h:763
long repInZmstar_unchecked(long idx) const
Returns rep whose index is i.
Definition: PAlgebra.h:247
bool nextExpVector(std::vector< long > &exps) const
Definition: PAlgebra.h:282
const PAlgebraModDerived< type > & getDerived(type) const
Definition: PAlgebra.h:820
const std::vector< std::vector< RX > > & getMaskTable() const
Returns ref to maskTable, which is used to implement rotations (in the EncryptedArray module).
Definition: PAlgebra.h:657
Holds a vector of dimensions for a hypercube and some additional data.
Definition: hypercube.h:28
virtual zzX getMask_zzX(long i, long j) const =0
virtual long getPPowR() const override
The value p^r.
Definition: PAlgebra.h:623
PAlgebraModDerived(const PAlgebra &zMStar, long r)
Definition: PAlgebra.cpp:668
long indexOfRep(long t) const
Returns the index of t in T.
Definition: PAlgebra.h:235
void printAll(std::ostream &out=std::cout) const
Definition: PAlgebra.cpp:149
void CRT_reconstruct(RX &H, std::vector< RX > &crt) const
Returns H in R[X]/Phi_m(X) s.t. for every i<nSlots and t=T[i], we have H == crt[i] (mod Ft)
Definition: PAlgebra.cpp:994
long coordinate(long i, long k) const
Returns coordinate of index k along the i'th dimension.
Definition: PAlgebra.h:257
long getRadM() const
getRadM() = prod of distinct prime factors of m
Definition: PAlgebra.h:177
long exponentiate(const std::vector< long > &exps, bool onlySameOrd=false) const
Returns prod_i gi^{exps[i]} mod m. If onlySameOrd=true, use only generators that have the same order ...
Definition: PAlgebra.cpp:91
virtual PA_tag getTag() const =0
Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
const vec_RX & getFactors() const
Returns reference to the factors of Phim_m(X) modulo p^r.
Definition: PAlgebra.h:637
long numOfGens() const
The prime-power factorization of m.
Definition: PAlgebra.h:202
virtual const std::vector< NTL::ZZX > & getFactorsOverZZ() const =0
Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
std::pair< long, long > breakIndexByDim(long idx, long dim) const
Definition: hypercube.cpp:20
long ith_rep(long i) const
Returns the i'th element in T.
Definition: PAlgebra.h:232
Definition: PAlgebra.h:758
void restoreContext() const override
Restores the NTL context for p^r.
Definition: PAlgebra.h:777
zzX getMask_zzX(long i, long j) const override
Definition: PAlgebra.h:659
PA_tag getTag() const
Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
Definition: PAlgebra.h:841
void buildLinPolyCoeffs(std::vector< RX > &C, const std::vector< RX > &L, const MappingData< type > &mappingData) const
Returns a coefficient std::vector C for the linearized polynomial representing M.
Definition: PAlgebra.cpp:1266
PAlgebraMod(const PAlgebra &zMStar, long r)
Definition: PAlgebra.h:811
PAlgebraModDerived(const PAlgebraModDerived &other)
Definition: PAlgebra.h:560
PAlgebraModDerived & operator=(const PAlgebraModDerived &other)
Definition: PAlgebra.h:577
long ProdOrdsFrom(long i) const
The product prod_{j=i}^{n-1} OrderOf(i)
Definition: PAlgebra.h:220