A concrete instantiation of the virtual class. More...
#include <PAlgebra.h>

Public Member Functions | |
PAlgebraModDerived & | operator= (const PAlgebraModDerived &)=delete |
PAlgebraModDerived (const PAlgebra &zMStar, long r) | |
PAlgebraModDerived (const PAlgebraModDerived &other) | |
virtual PAlgebraModBase * | clone () const override |
Returns a pointer to a "clone". More... | |
virtual PA_tag | getTag () const override |
Returns the type tag: PA_GF2_tag or PA_zz_p_tag. More... | |
virtual const PAlgebra & | getZMStar () const override |
Returns reference to underlying PAlgebra object. More... | |
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. More... | |
virtual long | getR () const override |
The value r. More... | |
virtual long | getPPowR () const override |
The value p^r. More... | |
virtual void | restoreContext () const override |
Restores the NTL context for p^r. More... | |
const RXModulus & | getPhimXMod () const |
Returns reference to an RXModulus representing Phi_m(X) (mod p^r) More... | |
const vec_RX & | getFactors () const |
Returns reference to the factors of Phim_m(X) modulo p^r. More... | |
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 ... is the factorization of Phi_m(X) mod p^r. More... | |
const std::vector< std::vector< RX > > & | getMaskTable () const |
Returns ref to maskTable, which is used to implement rotations (in the EncryptedArray module). More... | |
zzX | getMask_zzX (long i, long j) const override |
Embedding in the plaintext slots and decoding back | |
In all the functions below, G must be irreducible mod p, and the order of G must divide the order of p modulo m (as returned by zMStar.getOrdP()). In addition, when r > 1, G must be the monomial X (RX(1, 1)) | |
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]) More... | |
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) More... | |
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 either deg(G) == 1 or G == factors[0]. More... | |
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) represents the same element as alpha in R[X]/G(X). More... | |
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) represents the same element as alphas[i] in R[X]/G(X). More... | |
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]/Ft(X) where t=T[i]. More... | |
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. More... | |
![]() | |
virtual | ~PAlgebraModBase () |
Detailed Description
template<typename type>
class helib::PAlgebraModDerived< type >
A concrete instantiation of the virtual class.
Constructor & Destructor Documentation
◆ PAlgebraModDerived() [1/2]
helib::PAlgebraModDerived< type >::PAlgebraModDerived | ( | const PAlgebra & | zMStar, |
long | r | ||
) |
◆ PAlgebraModDerived() [2/2]
|
inline |
Member Function Documentation
◆ buildLinPolyCoeffs()
void helib::PAlgebraModDerived< type >::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.
For h in Z/(p^r)[X] of degree < d,
G is assumed to be defined in mappingData, with d = deg(G). L describes a linear map M by describing its action on the standard power basis: M(x^j mod G) = (L[j] mod G), for j = 0..d-1.
◆ clone()
|
inlineoverridevirtual |
Returns a pointer to a "clone".
Implements helib::PAlgebraModBase.
◆ CRT_decompose()
void helib::PAlgebraModDerived< type >::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])
◆ CRT_reconstruct()
void helib::PAlgebraModDerived< type >::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)
◆ decodePlaintext()
void helib::PAlgebraModDerived< type >::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]/Ft(X) where t=T[i].
The mappingData argument should contain the output of mapToSlots(G).
◆ embedInAllSlots()
void helib::PAlgebraModDerived< type >::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) represents the same element as alpha in R[X]/G(X).
Must have deg(alpha)<deg(G). The mappingData argument should contain the output of mapToSlots(G).
◆ embedInSlots()
void helib::PAlgebraModDerived< type >::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) represents the same element as alphas[i] in R[X]/G(X).
Must have deg(alpha[i])<deg(G). The mappingData argument should contain the output of mapToSlots(G).
◆ getCrtCoeffs()
|
inline |
Returns the CRT coefficients: element i contains (prod_{j!=i} F_j)^{-1} mod F_i, where F_0 F_1 ... is the factorization of Phi_m(X) mod p^r.
◆ getFactors()
|
inline |
Returns reference to the factors of Phim_m(X) modulo p^r.
◆ getFactorsOverZZ()
|
inlineoverridevirtual |
Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
Implements helib::PAlgebraModBase.
◆ getMask_zzX()
|
inlineoverridevirtual |
Implements helib::PAlgebraModBase.
◆ getMaskTable()
|
inline |
Returns ref to maskTable, which is used to implement rotations (in the EncryptedArray module).
maskTable[i][j]
is a polynomial representation of a mask that is 1 in all slots whose i'th coordinate is at least j, and 0 elsewhere. We have:
maskTable.size() == zMStar.numOfGens() // # of generators for i = 0..maskTable.size()-1: maskTable[i].size() == zMStar.OrderOf(i)+1 // order of generator i
◆ getPhimXMod()
|
inline |
Returns reference to an RXModulus representing Phi_m(X) (mod p^r)
◆ getPPowR()
|
inlineoverridevirtual |
The value p^r.
Implements helib::PAlgebraModBase.
◆ getR()
|
inlineoverridevirtual |
The value r.
Implements helib::PAlgebraModBase.
◆ getTag()
|
inlineoverridevirtual |
Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
Implements helib::PAlgebraModBase.
◆ getZMStar()
|
inlineoverridevirtual |
Returns reference to underlying PAlgebra object.
Implements helib::PAlgebraModBase.
◆ mapToSlots()
void helib::PAlgebraModDerived< type >::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 either deg(G) == 1 or G == factors[0].
◆ operator=()
|
delete |
◆ restoreContext()
|
inlineoverridevirtual |
Restores the NTL context for p^r.
Implements helib::PAlgebraModBase.