fhe-si icon indicating copy to clipboard operation
fhe-si copied to clipboard

Question: the final result is the operand modulo P, is it necessary to reconstrcut the final result?

Open DylanWangWQF opened this issue 3 years ago • 1 comments

Hi Prof. Wu @dwu4 , I want to use your code to do some experiments with HElib. I have a question about the final result in the test of Linear Regression: at the beginning, we modulo the plaintext modulus P and then perform a series of homomorphic operations.

columnBatch.push_back(to_ZZ(rawData[k][j]) % p);
if(j==0) curLabel.push_back(to_ZZ(labels[k]) % p);

Finally, we get the final result is the operand modulo P? Do we need to reconstruct the result by multiplying P. For example, if we are given such a group HElib parameters: /*m=*/12800, /*p=*/127, /*r=*/1, /*bits=*/119, /*c=*/2. The final result exceed p=127 and will modulo 127.

DylanWangWQF avatar Dec 26 '21 03:12 DylanWangWQF

I found the plaintext result is the operand modulo p.

for (unsigned i = 0; i < theta.size(); i++)
    {
        cout << "  theta[" << i << "] = " << theta_Pt[i] % (param.p) << endl;
    }
    cout << "  Determinant: " << det_Pt % (param.p) << endl;

DylanWangWQF avatar Dec 29 '21 01:12 DylanWangWQF