HElib: PAlgebraMod Class Reference

HElib 1.0 Implementing Homomorphic Encryption

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions Variables Friends Pages
Public Member Functions | List of all members
PAlgebraMod Class Reference

The structure of Z[X]/(Phi_m(X), p) More...

`#include <PAlgebra.h>`

## Public Member Functions
| PAlgebraMod (const PAlgebra &zMStar, long r)
template<class type >
const PAlgebraModDerived< type > & | getDerived (type) const
bool | operator== (const PAlgebraMod &other) const
bool | operator!= (const PAlgebraMod &other) const
PA_tag | getTag () const
| Returns the type tag: PA_GF2_tag or PA_zz_p_tag.
const PAlgebra & | getZMStar () const
| Returns reference to underlying PAlgebra object.
const vector< ZZX > & | getFactorsOverZZ () const
| Returns reference to the factorization of Phi_m(X) mod p^r, but as ZZX's.
long | getR () const
| The value r.
long | getPPowR () const
| The value p^r.
void | restoreContext () const
| Restores the NTL context for p^r.
void | genMaskTable () const
| Generates the "mask table" that is used to support rotations. More...

## Detailed Description

The structure of Z[X]/(Phi_m(X), p)

An object of type PAlgebraMod stores information about a PAlgebra object zMStar, and an integer r. It also provides support for encoding and decoding plaintext slots.

the PAlgebra object zMStar defines (Z/mZ)^* /(0), and the PAlgebraMod object stores various tables related to the polynomial ring Z/(p^r)[X]. To do this most efficiently, if p == 2 and r == 1, then these polynomials are represented as GF2X's, and otherwise as zz_pX's. Thus, the types of these objects are not determined until run time. As such, we need to use a class heirarchy, as follows.

- PAlgebraModBase is a virtual class

- PAlegbraModDerived<type> is a derived template class, where type is either PA_GF2 or PA_zz_p.

- The class PAlgebraMod is a simple wrapper around a smart pointer to a PAlgebraModBase object: copying a PAlgebra object results is a "deep copy" of the underlying object of the derived class. It provides dDirect access to the virtual methods of PAlgebraModBase, along with a "downcast" operator to get a reference to the object as a derived type, and also == and != operators.

## Member Function Documentation

void PAlgebraMod::genMaskTable | ( |  | ) | const
| inline

Generates the "mask table" that is used to support rotations.

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) // order of generator i

template<class type >

const PAlgebraModDerived<type>& PAlgebraMod::getDerived | ( | type |  | ) | const
| inline

Downcast operator example: const PAlgebraModDerived<PA_GF2>& rep = alMod.getDerived(PA_GF2());

The documentation for this class was generated from the following file:

- src/PAlgebra.h