Hi openfhe team!
I would like to know how to determine whether my inner product operation is correct based on the given parameters, ensuring that the calculation results are accurate. Currently, with the given parameter, the results start to become incorrect at around 200values. How to accurately determine the boundary value that this parameter can support?
bool innerProductBFV(std::vector<int64_t>& incomingVector) {
int64_t expectedResult = plainInnerProduct(incomingVector);
/////////////////////////////////////////////////////////
// Crypto CryptoParams
/////////////////////////////////////////////////////////
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(65537);
parameters.SetMultiplicativeDepth(20);
parameters.SetSecurityLevel(lbcrypto::HEStd_NotSet);
parameters.SetRingDim(1 << 7);
uint32_t batchSize = parameters.GetRingDim() / 2;
/////////////////////////////////////////////////////////
// Set crypto params and create context
/////////////////////////////////////////////////////////
lbcrypto::CryptoContext<lbcrypto::DCRTPoly> cc;
cc = GenCryptoContext(parameters);
// Enable the features that you wish to use.
cc->Enable(PKE);
cc->Enable(LEVELEDSHE);
cc->Enable(ADVANCEDSHE);
KeyPair keys = cc->KeyGen();
cc->EvalMultKeyGen(keys.secretKey);
cc->EvalSumKeyGen(keys.secretKey);
Plaintext plaintext1 = cc->MakePackedPlaintext(incomingVector);
auto ct1 = cc->Encrypt(keys.publicKey, plaintext1);
auto finalResult = cc->EvalInnerProduct(ct1, ct1, batchSize);
lbcrypto::Plaintext res;
cc->Decrypt(keys.secretKey, finalResult, &res);
auto final = res->GetPackedValue()[0];
std::cout << "Expected Result: " << expectedResult << " Inner Product Result: " << final << std::endl;
return expectedResult == final;
}