evaluate_polynomial
GLEngine.evaluate_polynomial(ciphertext, coefficients, hadamard_multiplication_key)
- 암호문을 이용하여 주어진 계수에 대응하는 다항식을 계산합니다.
암호화 된 행렬의 원소 \(x\)와 다항식 계수 \([a_0, a_1, \dots, a_n]\) 에 대해, \(a_0 + a_1x^1 + a_2x^2 + \cdots + a_nx^n\) 를 계산합니다.
- Input:
- ciphertext: GLCiphertext
- coefficients: an array of double
- hadamard_multiplication_key: HadamardMultiplicationKey
- Output:
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
)