Plaintext

class openfhe.Plaintext

Bases: pybind11_object

Decode(*args, **kwargs)

Overloaded function.

  1. Decode(self: openfhe.openfhe.Plaintext) -> bool

    Decode the polynomial into a plaintext.

  2. Decode(self: openfhe.openfhe.Plaintext, arg0: typing.SupportsInt, arg1: typing.SupportsFloat, arg2: openfhe.openfhe.ScalingTechnique, arg3: openfhe.openfhe.ExecutionMode) -> bool

    Decode the polynomial into a plaintext.

Encode(self: openfhe.openfhe.Plaintext) → bool

Encode the plaintext into a polynomial.

GetCKKSPackedValue(self: openfhe.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]

GetCoefPackedValue(self: openfhe.openfhe.Plaintext) → list[int]
GetFormattedValues(self: openfhe.openfhe.Plaintext, arg0: SupportsInt) → str
GetLength(self: openfhe.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.openfhe.Plaintext) → int
GetLogError(self: openfhe.openfhe.Plaintext) → float
GetLogPrecision(*args, **kwargs)

Overloaded function.

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

    Get the log of the plaintext precision.

    return:

    The log of the plaintext precision.

    rtype:

    float

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

GetNoiseScaleDeg(self: openfhe.openfhe.Plaintext) → int
GetPackedValue(self: openfhe.openfhe.Plaintext) → list[int]
GetRealPackedValue(self: openfhe.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.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(self: openfhe.openfhe.Plaintext) → openfhe.openfhe.SCHEME

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

Returns:

The scheme ID of the plaintext.

Return type:

SCHEME

GetSlots(self: openfhe.openfhe.Plaintext) → int
GetStringValue(self: openfhe.openfhe.Plaintext) → str
HighBound(self: openfhe.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.openfhe.Plaintext) → bool

Check if the plaintext is encoded.

Returns:

True if the plaintext is encoded, False otherwise.

Return type:

bool

LowBound(self: openfhe.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.openfhe.Plaintext, fmt: openfhe.openfhe.Format) → None

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

Parameters:

fmt

SetIntVectorValue(self: openfhe.openfhe.Plaintext, arg0: collections.abc.Sequence[SupportsInt]) → None
SetLength(self: openfhe.openfhe.Plaintext, newSize: SupportsInt) → 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.openfhe.Plaintext, arg0: SupportsInt) → None
SetNoiseScaleDeg(self: openfhe.openfhe.Plaintext, arg0: SupportsInt) → None
SetScalingFactor(self: openfhe.openfhe.Plaintext, sf: SupportsFloat) → None

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

Parameters:

sf (float) – The scaling factor to set.

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