Hi, I need help, I have this simple code, a single ciphertext-ciphertext multiplication:
int main(int argc, char* argv[]) {
uint32_t batchSize = 8;
CCParams<CryptoContextCKKSRNS> parameters;
parameters.SetMultiplicativeDepth(2);
parameters.SetScalingModSize(50);
parameters.SetScalingTechnique(FIXEDMANUAL);
parameters.SetBatchSize(batchSize);
CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);
cc->Enable(PKE);
cc->Enable(KEYSWITCH);
cc->Enable(LEVELEDSHE);
auto keys = cc->KeyGen();
cc->EvalMultKeyGen(keys.secretKey);
std::vector<double> x = {100.0, 100.01, 100.02, 100.03, 100.04, 100.05, 100.06, 100.07};
Plaintext ptxt = cc->MakeCKKSPackedPlaintext(x);
auto c = cc->Encrypt(keys.publicKey, ptxt);
auto c2 = cc->EvalMult(c, c);
auto cRes = cc->Rescale(c2);
Plaintext result;
cc->Decrypt(keys.secretKey, cRes, &result);
result->SetLength(batchSize);
std::cout << "Results = " << result << std::endl;
return 0;
}
It only has one multiplication, but when I set the SetMultiplicativeDepth(1)
it returns the wrong results. I changed the FIXEDMANUAL
to FIXEDAUTO
and removed the rescaling process, but it still behaves the same. Is this expected?
Thank you in advance!