Closed lidh15 closed 3 years ago
Sorry for reply late, I didn't receive the email from Github or missed it, if you are using the ckks scheme, you can get the sum of a vector like this:
slot_count = ckks_encoder.slot_count()
for i in range(int(math.log(slot_count, 2))):
temp = evaluator.rotate_vector(ct, 1 << i, gk)
evaluator.add_inplace(ct, temp)
And you can multiply float(1/slot_count)
with a sum ciphertext, it will be close to the mean value if the scale is valid.
I checked the methods of Evaluator class and failed to find a sum or mean value calculator. Currently, I'm doing it like rotate vector by one slot and add it to the sum. But this is too slow to apply out of a demo. Is there a solution or seal is not going to support such operations?