Suppose I have two vectors x = [1,2,3,4] and y = [5,1,2,6]
.
I composed and encrypted the two array using PolyCRTBuilder ( Ciphertextx and Ciphertexty ) .
If I subtract the two ciphertexts ( Ciphertextx MINUS Ciphertexty ), I should get Result = [-4, 1, 1, -2]
but after the homomorphic subtraction I am getting ResultDecrypted = [40957, 1, 1, 40959]
.
I understood that because the plaintext is only defined modulo plain_modulus, we got that result. But i want the resultant negative values to be used for the next computation how can i assign the resultant negative values to a vector and use the same for the further computations
You are using a pretty old version of SEAL if it still has PolyCRTBuilder
; in newer versions of the library this has been renamed to BatchEncoder
and it supports encoding to/from std::vector<std::int64_t>
which, I believe, is what you want.