helib::EncryptedArray Class Reference

A simple wrapper for a smart pointer to an EncryptedArrayBase. This is the interface that higher-level code should use. More...

#include <EncryptedArray.h>

Public Member Functions

 EncryptedArray (const Context &context, const NTL::ZZX &G=NTL::ZZX(1, 1))
 constructor: G defaults to the monomial X, PAlgebraMod from context More...
 
 EncryptedArray (const Context &context, const PAlgebraMod &_alMod)
 constructor: G defaults to F0, PAlgebraMod explicitly given More...
 
EncryptedArray & operator= (const EncryptedArray &other)
 
template<typename type >
const EncryptedArrayDerived< type > & getDerived (type) const
 downcast operator example: const EncryptedArrayDerived<PA_GF2>& rep = ea.getDerived(PA_GF2()); More...
 
const EncryptedArrayCx & getCx () const
 
Direct access to EncryptedArrayBase methods
PA_tag getTag () const
 
template<template< typename > class T, typename... Args>
void dispatch (Args &&... args) const
 
const Context & getContext () const
 
const PAlgebraMod & getAlMod () const
 
const PAlgebra & getPAlgebra () const
 
long getDegree () const
 
void rotate (Ctxt &ctxt, long k) const
 
void shift (Ctxt &ctxt, long k) const
 
void rotate1D (Ctxt &ctxt, long i, long k, bool dc=false) const
 
void shift1D (Ctxt &ctxt, long i, long k) const
 
template<typename PTXT , typename ARRAY >
void encode (PTXT &ptxt, const ARRAY &array) const
 
void encodeUnitSelector (zzX &ptxt, long i) const
 
template<typename PTXT , typename ARRAY >
void decode (ARRAY &array, const PTXT &ptxt) const
 
template<typename T >
void random (std::vector< T > &array) const
 
template<typename T >
void encrypt (Ctxt &ctxt, const PubKey &pKey, const T &ptxt) const
 
template<typename T >
void decrypt (const Ctxt &ctxt, const SecKey &sKey, T &ptxt) const
 
void buildLinPolyCoeffs (std::vector< NTL::ZZX > &C, const std::vector< NTL::ZZX > &L) const
 
void restoreContext () const
 
void restoreContextForG () const
 
long size () const
 
long dimension () const
 
long sizeOfDimension (long i) const
 
long nativeDimension (long i) const
 
long coordinate (long i, long k) const
 
long addCoord (long i, long k, long offset) const
 
template<typename U >
void rotate1D (std::vector< U > &out, const std::vector< U > &in, long i, long offset) const
 rotate an array by offset in the i'th dimension (output should not alias input) More...
 

Detailed Description

A simple wrapper for a smart pointer to an EncryptedArrayBase. This is the interface that higher-level code should use.

Constructor & Destructor Documentation

◆ EncryptedArray() [1/2]

helib::EncryptedArray::EncryptedArray ( const Context &  context,
const NTL::ZZX &  G = NTL::ZZX(1, 1) 
)
inline

constructor: G defaults to the monomial X, PAlgebraMod from context

◆ EncryptedArray() [2/2]

helib::EncryptedArray::EncryptedArray ( const Context &  context,
const PAlgebraMod &  _alMod 
)
inline

constructor: G defaults to F0, PAlgebraMod explicitly given

Member Function Documentation

◆ addCoord()

long helib::EncryptedArray::addCoord ( long  i,
long  k,
long  offset 
) const
inline

◆ buildLinPolyCoeffs()

void helib::EncryptedArray::buildLinPolyCoeffs ( std::vector< NTL::ZZX > &  C,
const std::vector< NTL::ZZX > &  L 
) const
inline

◆ coordinate()

long helib::EncryptedArray::coordinate ( long  i,
long  k 
) const
inline

◆ decode()

template<typename PTXT , typename ARRAY >
void helib::EncryptedArray::decode ( ARRAY &  array,
const PTXT &  ptxt 
) const
inline

◆ decrypt()

template<typename T >
void helib::EncryptedArray::decrypt ( const Ctxt &  ctxt,
const SecKey &  sKey,
T &  ptxt 
) const
inline

◆ dimension()

long helib::EncryptedArray::dimension ( ) const
inline

◆ dispatch()

template<template< typename > class T, typename... Args>
void helib::EncryptedArray::dispatch ( Args &&...  args) const
inline

◆ encode()

template<typename PTXT , typename ARRAY >
void helib::EncryptedArray::encode ( PTXT &  ptxt,
const ARRAY &  array 
) const
inline

◆ encodeUnitSelector()

void helib::EncryptedArray::encodeUnitSelector ( zzX &  ptxt,
long  i 
) const
inline

◆ encrypt()

template<typename T >
void helib::EncryptedArray::encrypt ( Ctxt &  ctxt,
const PubKey &  pKey,
const T &  ptxt 
) const
inline

◆ getAlMod()

const PAlgebraMod& helib::EncryptedArray::getAlMod ( ) const
inline

◆ getContext()

const Context& helib::EncryptedArray::getContext ( ) const
inline

◆ getCx()

const EncryptedArrayCx& helib::EncryptedArray::getCx ( ) const
inline

◆ getDegree()

long helib::EncryptedArray::getDegree ( ) const
inline

◆ getDerived()

template<typename type >
const EncryptedArrayDerived<type>& helib::EncryptedArray::getDerived ( type  ) const
inline

downcast operator example: const EncryptedArrayDerived<PA_GF2>& rep = ea.getDerived(PA_GF2());

◆ getPAlgebra()

const PAlgebra& helib::EncryptedArray::getPAlgebra ( ) const
inline

◆ getTag()

PA_tag helib::EncryptedArray::getTag ( ) const
inline

◆ nativeDimension()

long helib::EncryptedArray::nativeDimension ( long  i) const
inline

◆ operator=()

EncryptedArray& helib::EncryptedArray::operator= ( const EncryptedArray &  other)
inline

◆ random()

template<typename T >
void helib::EncryptedArray::random ( std::vector< T > &  array) const
inline

◆ restoreContext()

void helib::EncryptedArray::restoreContext ( ) const
inline

◆ restoreContextForG()

void helib::EncryptedArray::restoreContextForG ( ) const
inline

◆ rotate()

void helib::EncryptedArray::rotate ( Ctxt &  ctxt,
long  k 
) const
inline

◆ rotate1D() [1/2]

void helib::EncryptedArray::rotate1D ( Ctxt &  ctxt,
long  i,
long  k,
bool  dc = false 
) const
inline

◆ rotate1D() [2/2]

template<typename U >
void helib::EncryptedArray::rotate1D ( std::vector< U > &  out,
const std::vector< U > &  in,
long  i,
long  offset 
) const
inline

rotate an array by offset in the i'th dimension (output should not alias input)

◆ shift()

void helib::EncryptedArray::shift ( Ctxt &  ctxt,
long  k 
) const
inline

◆ shift1D()

void helib::EncryptedArray::shift1D ( Ctxt &  ctxt,
long  i,
long  k 
) const
inline

◆ size()

long helib::EncryptedArray::size ( ) const
inline

◆ sizeOfDimension()

long helib::EncryptedArray::sizeOfDimension ( long  i) const
inline