Hello everyone. I just try to understand the ComparisonViaSchemeSwitching function in our example code “/src/pke/examples/scheme-switching.cpp”.
And I encountered a problem.
For example, If I want to use EvalNOT to change LWESign, i will get the false results.
std::cout << "Obtained sign result in FHEW with plaintext modulus " << NativeInteger(pLWE2) << " and scale "
<< scaleSignFHEW << ": ";
std::vector<LWECiphertext> LWESign(LWECiphertexts.size());
for (uint32_t i = 0; i < LWECiphertexts.size(); ++i) {
LWESign[i] = ccLWE->EvalSign(LWECiphertexts[i]);
ccLWE->Decrypt(privateKeyFHEW, LWESign[i], &plainLWE, 2);
std::cout << plainLWE << " ";
}
std::cout << "\n";
uint32 p = 2;
for (uint32_t i = 0; i < LWECiphertexts.size(); ++i) {
auto LWENotSign = ccLWE->EvalNOT(LWESign[i]);
ccLWE->Decrypt(privateKeyFHEW, LWENotSign, &plainLWE, p);
std::cout << plainLWE << " ";
}
std::cout << "\n";
Return LWESign is [1 1 1 1 1 0 0 0 0 0 0 0 0 0 0], while LWENotSign is [0 0 0 0 1 1 0 1 1 1 1 1 0 1 0], not the [0 0 0 0 0 1 1 1 1 1 1 1 1 1 1].
Should I do modulus change before using EvalNOT? Or should I increase the variable p?