encode_to_light_plaintext

Engine.encode_to_light_plaintext(array, level)
Encodes a message into a light plaintext format for multiplication. The message is encoded in segments of length Engine.slot_count. If the message length is not divisible by the slot count, the remaining slots are padded with zeros during encoding. The recommended range of values to encode is [-1, 1].
  • Input:
    • array: A Python list or a numpy ndarray. Supported data types include int, double, and complex double.
    • level: int, optional
      • Should be set to the level of the ciphertext that the light plaintext will be multiplied to.
      • The level should be an integer greater than or equal to 1.
  • Output:
    • LightPlaintext

Warning

  • The matrix form does not yet support this operation.
from desilofhe import Engine

engine = Engine()

message = [1, 2, 3]
encoded = engine.encode_to_light_plaintext(message)
from desilofhe import Engine

engine = Engine()

message = [1, 2, 3]
encoded = engine.encode_to_light_plaintext(message, level=3)