encode_to_plain_matrix

Engine.encode_to_plain_matrix(matrix, level)
Encodes a matrix into a plain matrix format for matrix multiplication.
  • Input:
    • matrix: A Python list or numpy array. Data types supported include int, double, and complex double.
    • The matrix should be square, with both dimensions equal to Engine.slot_count.
    • level: optional
      • Specifies the maximum multiplication level for encoding. Lower levels reduce space usage but also reduce the maximum multiplication depth.
  • Output:
    • PlainMatrix
import numpy as np

from desilofhe import Engine

engine = Engine(slot_count=64)

message = np.arange(64 * 64).reshape(64, 64)
plain_matrix = engine.encode_to_plain_matrix(message)
plain_matrix_level_2 = engine.encode_to_plain_matrix(message, level=2)