Class PlaintextImpl
Defined in File plaintext.h
Page Contents
Inheritance Relationships
Derived Types
public lbcrypto::CKKSPackedEncoding
(Class CKKSPackedEncoding)public lbcrypto::CoefPackedEncoding
(Class CoefPackedEncoding)public lbcrypto::PackedEncoding
(Class PackedEncoding)public lbcrypto::StringEncoding
(Class StringEncoding)
Class Documentation
-
class lbcrypto::PlaintextImpl
Inheritence diagram for lbcrypto::PlaintextImpl:
Collaboration diagram for lbcrypto::PlaintextImpl:
This class represents plaintext in the OpenFHE 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.
Subclassed by lbcrypto::CKKSPackedEncoding, lbcrypto::CoefPackedEncoding, lbcrypto::PackedEncoding, lbcrypto::StringEncoding
Public Functions
-
inline PlaintextImpl(const PlaintextImpl &rhs)
-
inline PlaintextImpl(PlaintextImpl &&rhs)
-
inline virtual ~PlaintextImpl()
-
virtual PlaintextEncodings GetEncodingType() const = 0
GetEncodingType
- Returns
Encoding type used by this plaintext
-
inline double GetScalingFactor() const
Get the scaling factor of the plaintext for CKKS-based plaintexts.
-
inline void SetScalingFactor(double sf)
Set the scaling factor of the plaintext for CKKS-based plaintexts.
-
inline const NativeInteger GetScalingFactorInt() const
Get the scaling factor of the plaintext for BGV-based plaintexts.
-
inline void SetScalingFactorInt(NativeInteger sf)
Set the scaling factor of the plaintext for BGV-based plaintexts.
-
inline SCHEME GetSchemeID() const
Get the encryption technique of the plaintext for BFV-based plaintexts.
-
inline bool IsEncoded() const
IsEncoded
- Returns
true when encoding is done
-
inline const EncodingParams GetEncodingParams() const
GetEncodingParams
- Returns
Encoding params used with this plaintext
-
virtual bool Encode() = 0
Encode the plaintext into a polynomial
- Returns
true on success
-
virtual bool Decode() = 0
Decode the polynomial into the plaintext
- Returns
-
inline int64_t LowBound() const
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)
-
inline int64_t HighBound() const
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)
-
inline void SetFormat(Format fmt) const
SetFormat - allows format to be changed for PlaintextImpl evaluations
- Parameters
fmt –
-
template<typename Element>
inline Element &GetElement() GetElement
- Returns
the Polynomial that the element was encoded into
-
inline usint GetElementRingDimension() const
GetElementRingDimension
- Returns
ring dimension on the underlying element
-
inline const BigInteger GetElementModulus() const
GetElementModulus
- Returns
modulus on the underlying elemenbt
-
virtual size_t GetLength() const = 0
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 newSize)
resize the plaintext; only works for plaintexts that support a resizable vector (coefpacked)
- Parameters
newSize –
-
inline size_t GetNoiseScaleDeg() const
-
inline void SetNoiseScaleDeg(size_t d)
-
inline size_t GetLevel() const
-
inline void SetLevel(size_t l)
-
inline virtual double GetLogError() const
-
inline virtual double GetLogPrecision() const
-
inline virtual const std::string &GetStringValue() const
-
inline virtual const std::vector<int64_t> &GetCoefPackedValue() const
-
inline virtual const std::vector<int64_t> &GetPackedValue() const
-
inline virtual const std::vector<std::complex<double>> &GetCKKSPackedValue() const
-
inline virtual const std::vector<double> GetRealPackedValue() const
-
inline virtual void SetStringValue(const std::string&)
-
inline virtual void SetIntVectorValue(const std::vector<int64_t>&)
-
virtual bool CompareTo(const PlaintextImpl &other) const = 0
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.
-
inline bool operator==(const PlaintextImpl &other) const
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.
-
inline bool operator!=(const PlaintextImpl &other) const
-
virtual void PrintValue(std::ostream &out) const = 0
PrintValue is called by operator<<
- Parameters
out –
-
template<>
inline const Poly &GetElement() const GetElement
- Returns
the Polynomial that the element was encoded into
-
template<>
inline const NativePoly &GetElement() const GetElement
- Returns
the NativePolynomial that the element was encoded into
-
template<>
inline NativePoly &GetElement()
Protected Types
Protected Attributes
-
bool isEncoded
-
PtxtPolyType typeFlag
-
EncodingParams encodingParams
-
mutable NativePoly encodedNativeVector
-
double scalingFactor = 1
-
NativeInteger scalingFactorInt = 1
-
size_t level = 0
-
size_t noiseScaleDeg = 1
Protected Static Attributes
-
static constexpr int intCTOR = 0x01
-
static constexpr int vecintCTOR = 0x02
-
static constexpr int fracCTOR = 0x04
-
static constexpr int vecuintCTOR = 0x08
Friends
-
friend std::ostream &operator<<(std::ostream &out, const PlaintextImpl &item)
operator<< for ostream integration - calls PrintValue
- Parameters
out –
item –
- Returns
-
inline PlaintextImpl(const PlaintextImpl &rhs)