Class CKKSPackedEncoding

Inheritance Relationships

Base Type

Class Documentation

class lbcrypto::CKKSPackedEncoding : public lbcrypto::PlaintextImpl

Inheritence diagram for lbcrypto::CKKSPackedEncoding:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="lbcrypto::PlaintextImpl" tooltip="lbcrypto::PlaintextImpl"] "1" [label="lbcrypto::CKKSPackedEncoding" tooltip="lbcrypto::CKKSPackedEncoding" fillcolor="#BFBFBF"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for lbcrypto::CKKSPackedEncoding:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "12" [label="lbcrypto::ILElement< DerivedType, BigVecType >" tooltip="lbcrypto::ILElement< DerivedType, BigVecType >"] "9" [label="lbcrypto::BigIntegerInterface< NativeIntegerT< NativeInt > >" tooltip="lbcrypto::BigIntegerInterface< NativeIntegerT< NativeInt > >"] "2" [label="lbcrypto::PlaintextImpl" tooltip="lbcrypto::PlaintextImpl"] "8" [label="intnat::NativeIntegerT< NativeInt >" tooltip="intnat::NativeIntegerT< NativeInt >"] "6" [label="lbcrypto::Serializable" tooltip="lbcrypto::Serializable"] "10" [label="lbcrypto::DCRTPolyImpl< BigVector >" tooltip="lbcrypto::DCRTPolyImpl< BigVector >"] "11" [label="lbcrypto::DCRTPolyInterface< DerivedType, BigVecType, LilVecType, RNSContainerType >" tooltip="lbcrypto::DCRTPolyInterface< DerivedType, BigVecType, LilVecType, RNSContainerType >"] "4" [label="lbcrypto::PolyInterface< DerivedType, VecType, ContainerType >" tooltip="lbcrypto::PolyInterface< DerivedType, VecType, ContainerType >"] "5" [label="lbcrypto::ILElement< DerivedType, VecType >" tooltip="lbcrypto::ILElement< DerivedType, VecType >"] "3" [label="lbcrypto::PolyImpl< NativeVector >" tooltip="lbcrypto::PolyImpl< NativeVector >"] "1" [label="lbcrypto::CKKSPackedEncoding" tooltip="lbcrypto::CKKSPackedEncoding" fillcolor="#BFBFBF"] "7" [label="lbcrypto::PolyImpl< BigVector >" tooltip="lbcrypto::PolyImpl< BigVector >"] "12" -> "6" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="usage"] "2" -> "7" [dir=forward tooltip="usage"] "2" -> "8" [dir=forward tooltip="usage"] "2" -> "10" [dir=forward tooltip="usage"] "8" -> "9" [dir=forward tooltip="public-inheritance"] "10" -> "11" [dir=forward tooltip="public-inheritance"] "11" -> "12" [dir=forward tooltip="public-inheritance"] "4" -> "5" [dir=forward tooltip="public-inheritance"] "5" -> "6" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "7" -> "4" [dir=forward tooltip="public-inheritance"] }

Type used for representing IntArray types. Provides conversion functions to encode and decode plaintext data as type vector<uint64_t>. This class uses bit packing techniques to enable efficient computing on vectors of integers. It is NOT supported for DCRTPoly.

Public Functions

template<typename T, typename std::enable_if<std::is_same<T, Poly::Params>::value || std::is_same<T, NativePoly::Params>::value || std::is_same<T, DCRTPoly::Params>::value, bool>::type = true>
inline CKKSPackedEncoding(std::shared_ptr<T> vp, EncodingParams ep)
template<typename T, typename std::enable_if<std::is_same<T, Poly::Params>::value || std::is_same<T, NativePoly::Params>::value || std::is_same<T, DCRTPoly::Params>::value, bool>::type = true>
inline CKKSPackedEncoding(std::shared_ptr<T> vp, EncodingParams ep, const std::vector<std::complex<double>> &coeffs, size_t noiseScaleDeg, uint32_t level, double scFact, size_t slots)
inline explicit CKKSPackedEncoding(const std::vector<std::complex<double>> &rhs, size_t slots)

Constructs a container with a copy of each of the elements in rhs, in the same order.

Parameters

rhs – - The input object to copy.

inline CKKSPackedEncoding()

Default empty constructor with empty uninitialized data elements.

inline CKKSPackedEncoding(const CKKSPackedEncoding &rhs)
inline CKKSPackedEncoding(CKKSPackedEncoding &&rhs)
virtual bool Encode()

Encode the plaintext into a polynomial

Returns

true on success

inline virtual bool Decode()

Decode the polynomial into the plaintext

Returns

bool Decode(size_t depth, double scalingFactor, ScalingTechnique scalTech, ExecutionMode executionMode)
inline virtual const std::vector<std::complex<double>> &GetCKKSPackedValue() const
inline virtual const std::vector<double> GetRealPackedValue() const
inline virtual PlaintextEncodings GetEncodingType() const

GetEncodingType

Returns

CKKS_PACKED_ENCODING

inline virtual size_t GetLength() const

Get method to return the length of plaintext

Returns

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

inline virtual double GetLogError() const

Get method to return log2 of estimated standard deviation of approximation error

inline virtual double GetLogPrecision() const

Get method to return log2 of estimated precision

inline virtual void SetLength(size_t siz)

SetLength of the plaintext to the given size

Parameters

siz

inline virtual bool CompareTo(const PlaintextImpl &other) const

Method to compare two plaintext to test for equivalence. This method does not test that the plaintext are of the same type.

Parameters

other – - the other plaintext to compare to.

Returns

whether the two plaintext are equivalent.

inline virtual void PrintValue(std::ostream &out) const

PrintValue is called by operator<<

Parameters

out

Public Static Functions

static std::vector<DCRTPoly::Integer> CRTMult(const std::vector<DCRTPoly::Integer> &a, const std::vector<DCRTPoly::Integer> &b, const std::vector<DCRTPoly::Integer> &mods)

Static utility method to multiply two numbers in CRT representation. CRT representation is stored in a vector of native integers, and each position corresponds to the remainder of the number against one of the moduli in mods.

Parameters
  • a – is the first number in CRT representation.

  • b – is the second number in CRT representation.

Returns

the product of the two numbers in CRT representation.

static void Destroy()

Destructor method.

Protected Functions

inline usint GetDefaultSlotSize()
void FitToNativeVector(const std::vector<int64_t> &vec, int64_t bigBound, NativeVector *nativeVec) const

Set modulus and recalculates the vector values to fit the modulus

Parameters
  • &vec – input vector

  • &bigValue – big bound of the vector values.

  • &modulus – modulus to be set for vector.