SEAL icon indicating copy to clipboard operation
SEAL copied to clipboard

how do I get the real polynomial coefficients?

Open guo623 opened this issue 3 years ago • 8 comments

Hi, when I use CKKS scheme, after decrypting a ciphertext (without modulo switching), I get Plaintext, which stores the coefficients of polynomial with size poly_modulus_degree * (coeff_modulus_size - 1), so what should I do to get the real polynomial coefficients? Looking forward to your answer, have a nice day!

guo623 avatar Aug 15 '22 03:08 guo623

Polynomials with real coefficients only exist as intermediate results in encode or decode methods.

WeiDaiWD avatar Aug 15 '22 15:08 WeiDaiWD

Thanks for your answer, but I would like to ask: If I have a vector now, and I encode it using CKKS (only this one operation, no additional operations), then the resulting Plaintext stores data of size poly_modulus_degree * (coeff_modulus_size - 1), how do I operate to get the polynomial coefficients of this vector?

guo623 avatar Aug 16 '22 13:08 guo623

Plaintext::data()[index]

WeiDaiWD avatar Aug 16 '22 18:08 WeiDaiWD

Thanks for your answer, now I got the polynomial coefficients, but its size is not slot_count, but poly_modulus_degree * (coeff_modulus_size - 1), so what should I do and how should I operate to get the real polynomial coefficients?

guo623 avatar Aug 19 '22 02:08 guo623

What do you mean by "real"? Do you mean real numbers?

WeiDaiWD avatar Aug 23 '22 03:08 WeiDaiWD

Sorry for not making my question clear, real means actually, because the polynomial coefficients I get via Plaintext::data()[index] are not slot_count size, but poly_modulus_degree * (coeff_modulus_size - 1) So I would like to ask how to operate to get the polynomial coefficients?

guo623 avatar Aug 24 '22 01:08 guo623

In CKKS, you encode a vector of dimension slot_count into a polynomial of degree (poly_modulus_degree - 1). Each coefficient of this new polynomial is stored in RNS form with respect to (coeff_modulus_size - 1) prime moduli, in stripes of size poly_modulus_degree.

WeiDaiWD avatar Aug 24 '22 21:08 WeiDaiWD

Thank you very much for your answer!

guo623 avatar Aug 28 '22 06:08 guo623