Is there an easy way to compute the mean of a ciphertext that was composed using PolyCRTBuilder and encrypted.
Here is the code snippet:
EncryptionParameters parms;
parms.set_poly_modulus("1x^4096 + 1");
parms.set_coeff_modulus(coeff_modulus_128(4096));
parms.set_plain_modulus(40961);
SEALContext context(parms);
print_parameters(context);
KeyGenerator keygen(context);
auto public_key = keygen.public_key();
// auto secret_key = keygen.secret_key();
Encryptor encryptor(context, public_key);
Evaluator evaluator(context);
// Decryptor decryptor(context, secret_key);
PolyCRTBuilder crtbuilder(context);
int slot_count = crtbuilder.slot_count();
int row_size = slot_count / 2;
vector<uint64_t> pod_matrix(slot_count, 0);
pod_matrix[0] = 5;
pod_matrix[1] = 2;
pod_matrix[2] = 56;
pod_matrix[3] = 34;
pod_matrix[row_size] = 47;
pod_matrix[row_size + 1] = 35;
pod_matrix[row_size + 2] = 16;
pod_matrix[row_size + 3] = 37;
Plaintext plain_matrix;
crtbuilder.compose(pod_matrix, plain_matrix);
Ciphertext encrypted_matrix;
encryptor.encrypt(plain_matrix, encrypted_matrix);
// Is there a way to compute the MEAN of encrypted_matrix and return one ciphertext that is the mean.
// I am trying to not use the secret key
Basically I have an array where I am packing all the array element into one ciphertext using Batching technique in SEAL. Once I create the ciphertext, I need to find the MEAN of the ciphertextArray. The mean should be a ciphertext (IntegerEncoded or FractionalEncoded) . Is there a way to achieve this without using the secret key ? Thank you.