Class PackedEncoding

Inheritance Relationships

Base Type

Class Documentation

class lbcrypto::PackedEncoding : public lbcrypto::PlaintextImpl

Inheritence diagram for lbcrypto::PackedEncoding:

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::PackedEncoding" tooltip="lbcrypto::PackedEncoding" fillcolor="#BFBFBF"]
    "1" -> "2" [dir=forward tooltip="public-inheritance"]
}

Collaboration diagram for lbcrypto::PackedEncoding:

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 >"]
    "1" [label="lbcrypto::PackedEncoding" tooltip="lbcrypto::PackedEncoding" fillcolor="#BFBFBF"]
    "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 >"]
    "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"]
    "1" -> "2" [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"]
    "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<int64_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 PackedEncoding(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 PackedEncoding(std::shared_ptr<T> vp, EncodingParams ep, const std::vector<int64_t> &coeffs)
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 PackedEncoding(std::shared_ptr<T> vp, EncodingParams ep, std::initializer_list<int64_t> coeffs)
inline explicit PackedEncoding(const std::vector<int64_t> &rhs)

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 PackedEncoding(std::initializer_list<int64_t> arr)

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

Parameters

arr – the list to copy.

inline PackedEncoding()

Default empty constructor with empty uninitialized data elements.

virtual bool Encode() override

Encode the plaintext into a polynomial

Returns

true on success

virtual bool Decode() override

Decode the polynomial into the plaintext.

Returns

inline virtual const std::vector<int64_t> &GetPackedValue() const override
inline virtual void SetIntVectorValue(const std::vector<int64_t> &val) override

SetIntVectorValue

Parameters

val – integer vector to initialize the plaintext

inline virtual size_t GetLength() const override

Get method to return the length of plaintext

Returns

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

inline virtual void SetLength(size_t siz) override

SetLength of the plaintext to the given size

Parameters

siz

Public Members

void EncodingParams p

Public Static Functions

static inline uint32_t GetAutomorphismGenerator(uint32_t m)
static void SetParams(uint32_t m, EncodingParams params)

Method to set encoding params.

Parameters

m – the encoding cyclotomic order. @params params data structure storing encoding parameters

static void SetParams (uint32_t m, const PlaintextModulus &modulus) __attribute__((deprecated("use SetParams(uint32_t m

Method to set encoding params (this method should eventually be replaced by void SetParams(uint32_t m, EncodingParams params);)

Parameters

m – the encoding cyclotomic order. @params modulus is the plaintext modulus

static void Destroy()

Destructor method.

Protected Functions

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

PrintValue() is called by operator<<.

Parameters

out – stream to print to

inline virtual bool CompareTo(const PlaintextImpl &rhs) const override

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

Parameters

rhs – - the other plaintext to compare to.

Returns

whether the two plaintext are equivalent.