PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
lbcrypto::PlaintextImpl Class Referenceabstract

This class represents plaintext in the Palisade library. More...

#include <plaintext.h>

Inheritance diagram for lbcrypto::PlaintextImpl:
Inheritance graph
[legend]
Collaboration diagram for lbcrypto::PlaintextImpl:
Collaboration graph
[legend]

Public Member Functions

 PlaintextImpl (shared_ptr< Poly::Params > vp, EncodingParams ep, bool isEncoded=false)
 
 PlaintextImpl (shared_ptr< NativePoly::Params > vp, EncodingParams ep, bool isEncoded=false)
 
 PlaintextImpl (shared_ptr< DCRTPoly::Params > vp, EncodingParams ep, bool isEncoded=false)
 
 PlaintextImpl (const PlaintextImpl &rhs)
 
 PlaintextImpl (const PlaintextImpl &&rhs)
 
virtual PlaintextEncodings GetEncodingType () const =0
 
double GetScalingFactor () const
 
void SetScalingFactor (double sf)
 
bool IsEncoded () const
 
const EncodingParams GetEncodingParams () const
 
virtual bool Encode ()=0
 
virtual bool Decode ()=0
 
int64_t LowBound () const
 
int64_t HighBound () const
 
void SetFormat (Format fmt) const
 
template<typename Element >
Element & GetElement ()
 
template<typename Element >
const Element & GetElement () const
 
usint GetElementRingDimension () const
 
const BigInteger GetElementModulus () const
 
virtual size_t GetLength () const =0
 
virtual void SetLength (size_t newSize)
 
size_t GetDepth () const
 
void SetDepth (size_t d)
 
size_t GetLevel () const
 
void SetLevel (size_t l)
 
virtual double GetLogError () const
 
virtual double GetLogPrecision () const
 
virtual const std::string & GetStringValue () const
 
virtual const vector< int64_t > & GetCoefPackedValue () const
 
virtual const vector< int64_t > & GetPackedValue () const
 
virtual const std::vector< std::complex< double > > & GetCKKSPackedValue () const
 
virtual const std::vector< double > GetRealPackedValue () const
 
virtual void SetStringValue (const std::string &)
 
virtual void SetIntVectorValue (const vector< int64_t > &)
 
virtual bool CompareTo (const PlaintextImpl &other) const =0
 
bool operator== (const PlaintextImpl &other) const
 
bool operator!= (const PlaintextImpl &other) const
 
virtual void PrintValue (std::ostream &out) const =0
 
template<>
const PolyGetElement () const
 
template<>
PolyGetElement ()
 
template<>
const NativePolyGetElement () const
 
template<>
NativePolyGetElement ()
 
template<>
const DCRTPolyGetElement () const
 
template<>
DCRTPolyGetElement ()
 

Protected Attributes

bool isEncoded
 
PtxtPolyType typeFlag
 
EncodingParams encodingParams
 
Poly encodedVector
 
NativePoly encodedNativeVector
 
DCRTPoly encodedVectorDCRT
 
double scalingFactor
 
size_t level
 
size_t depth
 

Static Protected Attributes

static const int intCTOR = 0x01
 
static const int vecintCTOR = 0x02
 
static const int fracCTOR = 0x04
 
static const int vecuintCTOR = 0x08
 

Friends

std::ostream & operator<< (std::ostream &out, const PlaintextImpl &item)
 

Detailed Description

This class represents plaintext in the Palisade library.

PlaintextImpl is primarily intended to be used as a container and in conjunction with specific encodings which inherit from this class which depend on the application the plaintext is used with. It provides virtual methods for encoding and decoding of data.

Member Function Documentation

◆ CompareTo()

virtual bool lbcrypto::PlaintextImpl::CompareTo ( const PlaintextImpl other) const
pure virtual

Method to compare two plaintext to test for equivalence. This method is called by operator==

Parameters
other- the other plaintext to compare to.
Returns
whether the two plaintext are equivalent.

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::CoefPackedEncoding, and lbcrypto::StringEncoding.

◆ Decode()

virtual bool lbcrypto::PlaintextImpl::Decode ( )
pure virtual

Decode the polynomial into the plaintext

Returns

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::StringEncoding, and lbcrypto::CoefPackedEncoding.

◆ Encode()

virtual bool lbcrypto::PlaintextImpl::Encode ( )
pure virtual

Encode the plaintext into a polynomial

Returns
true on success

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::StringEncoding, and lbcrypto::CoefPackedEncoding.

◆ GetElement() [1/4]

template<typename Element >
Element& lbcrypto::PlaintextImpl::GetElement ( )

GetElement

Returns
the Polynomial that the element was encoded into

◆ GetElement() [2/4]

template<>
const Poly& lbcrypto::PlaintextImpl::GetElement ( ) const
inline

GetElement

Returns
the Polynomial that the element was encoded into

◆ GetElement() [3/4]

template<>
const NativePoly& lbcrypto::PlaintextImpl::GetElement ( ) const
inline

GetElement

Returns
the NativePolynomial that the element was encoded into

◆ GetElement() [4/4]

template<>
const DCRTPoly& lbcrypto::PlaintextImpl::GetElement ( ) const
inline

GetElement

Returns
the DCRTPolynomial that the element was encoded into

◆ GetElementModulus()

const BigInteger lbcrypto::PlaintextImpl::GetElementModulus ( ) const
inline

GetElementModulus

Returns
modulus on the underlying elemenbt

◆ GetElementRingDimension()

usint lbcrypto::PlaintextImpl::GetElementRingDimension ( ) const
inline

GetElementRingDimension

Returns
ring dimension on the underlying element

◆ GetEncodingParams()

const EncodingParams lbcrypto::PlaintextImpl::GetEncodingParams ( ) const
inline

GetEncodingParams

Returns
Encoding params used with this plaintext

◆ GetEncodingType()

virtual PlaintextEncodings lbcrypto::PlaintextImpl::GetEncodingType ( ) const
pure virtual

GetEncodingType

Returns
Encoding type used by this plaintext

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::StringEncoding, and lbcrypto::CoefPackedEncoding.

◆ GetLength()

virtual size_t lbcrypto::PlaintextImpl::GetLength ( ) const
pure virtual

Get method to return the length of plaintext

Returns
the length of the plaintext in terms of the number of bits.

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::StringEncoding, and lbcrypto::CoefPackedEncoding.

◆ GetScalingFactor()

double lbcrypto::PlaintextImpl::GetScalingFactor ( ) const
inline

Get the scaling factor of the plaintext.

◆ HighBound()

int64_t lbcrypto::PlaintextImpl::HighBound ( ) const
inline

Calculate and return upper bound that can be encoded with the plaintext modulus the number to encode MUST be less than or equal to this value

Returns
floor(p/2)

◆ IsEncoded()

bool lbcrypto::PlaintextImpl::IsEncoded ( ) const
inline

IsEncoded

Returns
true when encoding is done

◆ LowBound()

int64_t lbcrypto::PlaintextImpl::LowBound ( ) const
inline

Calculate and return lower bound that can be encoded with the plaintext modulus the number to encode MUST be greater than this value

Returns
floor(-p/2)

◆ operator==()

bool lbcrypto::PlaintextImpl::operator== ( const PlaintextImpl other) const
inline

operator== for plaintexts. This method makes sure the plaintexts are of the same type.

Parameters
other- the other plaintext to compare to.
Returns
whether the two plaintext are the same.

◆ PrintValue()

virtual void lbcrypto::PlaintextImpl::PrintValue ( std::ostream &  out) const
pure virtual

PrintValue is called by operator<<

Parameters
out

Implemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::CoefPackedEncoding, and lbcrypto::StringEncoding.

◆ SetFormat()

void lbcrypto::PlaintextImpl::SetFormat ( Format  fmt) const
inline

SetFormat - allows format to be changed for PlaintextImpl evaluations

Parameters
fmt

◆ SetLength()

virtual void lbcrypto::PlaintextImpl::SetLength ( size_t  newSize)
inlinevirtual

resize the plaintext; only works for plaintexts that support a resizable vector (coefpacked)

Parameters
newSize

Reimplemented in lbcrypto::CKKSPackedEncoding, lbcrypto::PackedEncoding, and lbcrypto::CoefPackedEncoding.

◆ SetScalingFactor()

void lbcrypto::PlaintextImpl::SetScalingFactor ( double  sf)
inline

Set the scaling factor of the plaintext.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const PlaintextImpl item 
)
friend

operator<< for ostream integration - calls PrintValue

Parameters
out
item
Returns

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