Plaintext

class openfhe.Plaintext

Bases: pybind11_object

Decode(self: openfhe.Plaintext) bool

Decode the polynomial into a plaintext.

Encode(self: openfhe.Plaintext) bool

Encode the plaintext into a polynomial.

GetCKKSPackedValue(self: openfhe.Plaintext) List[complex]

Get the packed value of the plaintext for CKKS-based plaintexts.

Returns:

The packed value of the plaintext.

Return type:

List[complex]

GetLength(self: openfhe.Plaintext) int

Get method to return the length of the plaintext.

Returns:

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

Return type:

int

GetLevel(self: openfhe.Plaintext) int
GetLogError(self: openfhe.Plaintext) float
GetLogPrecision(*args, **kwargs)

Overloaded function.

  1. GetLogPrecision(self: openfhe.Plaintext) -> float

    Get the log of the plaintext precision.

    return:

    The log of the plaintext precision.

    rtype:

    float

  2. GetLogPrecision(self: openfhe.Plaintext) -> float

GetNoiseScaleDeg(self: openfhe.Plaintext) int
GetPackedValue(self: openfhe.Plaintext) List[int]
GetRealPackedValue(self: openfhe.Plaintext) List[float]

Get the real component of the packed value of the plaintext for CKKS-based plaintexts.

Returns:

The real-component of the packed value of the plaintext.

Return type:

List[double]

GetScalingFactor(self: openfhe.Plaintext) float

Get the scaling factor of the plaintext for CKKS-based plaintexts.

Returns:

The scaling factor of the plaintext.

Return type:

float

GetSchemeID(*args, **kwargs)

Overloaded function.

  1. GetSchemeID(self: openfhe.Plaintext) -> openfhe.SCHEME

    Get the encryption technique of the plaintext for BFV-based plaintexts.

    return:

    The scheme ID of the plaintext.

    rtype:

    SCHEME

  2. GetSchemeID(self: openfhe.Plaintext) -> openfhe.SCHEME

    Get the encryption technique of the plaintext for BFV-based plaintexts.

    return:

    The scheme ID of the plaintext.

    rtype:

    SCHEME

GetSlots(self: openfhe.Plaintext) int
GetStringValue(self: openfhe.Plaintext) str
HighBound(self: openfhe.Plaintext) int

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

Returns:

floor(p/2)

Return type:

int

IsEncoded(self: openfhe.Plaintext) bool

Check if the plaintext is encoded.

Returns:

True if the plaintext is encoded, False otherwise.

Return type:

bool

LowBound(self: openfhe.Plaintext) int

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)

Return type:

int

SetFormat(self: openfhe.Plaintext, fmt: openfhe.Format) None

SetFormat - allows format to be changed for openfhe.Plaintext evaluations

Parameters:

fmt

SetIntVectorValue(self: openfhe.Plaintext, arg0: List[int]) None
SetLength(self: openfhe.Plaintext, newSize: int) None

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

Parameters:

newSize (int) – The new size of the plaintext.

SetLevel(self: openfhe.Plaintext, arg0: int) None
SetNoiseScaleDeg(self: openfhe.Plaintext, arg0: int) None
SetScalingFactor(self: openfhe.Plaintext, sf: float) None

Set the scaling factor of the plaintext for CKKS-based plaintexts.

Parameters:

sf (float) – The scaling factor to set.

SetSlots(self: openfhe.Plaintext, arg0: int) None
SetStringValue(self: openfhe.Plaintext, arg0: str) None