evaluate_polynomial

GLEngine.evaluate_polynomial(ciphertext, coefficients, hadamard_multiplication_key)
Evaluate a polynomial of input coefficients with input ciphertext. For coefficients \([a_0, a_1, \dots, a_n]\), it computes \(a_0 + a_1x + a_2x^2 + \cdots + a_nx^n\), where \(x\) is an entry of the encrypted matrix.
  • Input:
    • ciphertext: GLCiphertext
    • coefficients: an array of double
    • hadamard_multiplication_key: HadamardMultiplicationKey
  • Output:
    • GLCiphertext
import numpy as np
from desilofhe import GLEngine

engine = GLEngine()
secret_key = engine.create_secret_key()
hadamard_multiplication_key = engine.create_hadamard_multiplication_key(
    secret_key
)
message = np.ones(engine.shape, dtype=np.float64)
ciphertext = engine.encrypt(message, secret_key)

coefficients = [1, 2, 3]
polynomial = engine.evaluate_polynomial(
    ciphertext, coefficients, hadamard_multiplication_key
)