SEAL-Python
SEAL-Python copied to clipboard
CKKS rotate_vector ValueError: encrypted size must be 2
Type ValueError
Descripe
I = np.array([1, 0, 0, 0, 1, 0, 0, 0, 1])
plain_I = ckks_encoder.encode(I, scale)
E_I = encryptor.encrypt(plain_I)
A = np.array([1, 0, 0, 0, 1, 0, 0, 0, 1])
plain_A = ckks_encoder.encode(A, scale)
E_A = encryptor.encrypt(plain_A)
print("E_A.size:")
print(E_A.size())
print("E_I.size:")
print(E_I.size())
E_mult=evaluator.multiply(E_A,E_I)
print("E_mult.size:")
print(E_mult.size())
evaluator.rotate_vector(E_mult, 1, galois_keys)
First I have a ciphertext E_mult, which is the product of two ciphertexts E_A and E_I. Now I want to rotate the ciphertext E_mult, but such an error occurs. The size of E_A and E_I are both 2, but the size of E_mult is 3. Why does the rotate_vector function have to require the size of the ciphertext to be 2?

And how to change the encrypted size of E_mult? Or how to solve this problem?
The parameters are as follows.

This problem is solved by using the relinearize function, which can change the size of E_mult from 3 to 2.