Why is 8.03626 rooted in ciphertext as nan?

    Plaintext plaintextMultipartyNew3;
    cc->Decrypt(v1,serverprivatekey,&plaintextMultipartyNew3);
    plaintextMultipartyNew3->SetLength(num);
    cout<<plaintextMultipartyNew3->GetCKKSPackedValue()<<endl;
    double lowerBound = 0;
    double upperBound = 10;
    uint32_t polyDegree = 50;
    auto c4_sqrt = cc->EvalChebyshevFunction([](double x) -> double { return std::sqrt(x); }, v1, lowerBound,upperBound, polyDegree);
    Plaintext plaintextMultipartyNew5;
    cc->Decrypt(c4_sqrt,serverprivatekey,&plaintextMultipartyNew5);
    plaintextMultipartyNew5->SetLength(num);
    cout<<plaintextMultipartyNew5->GetCKKSPackedValue()<<endl;

image
image

Hi @kenan

If the input v1 has approximate zeroes (both below and above zero) in all other slots (beyond the 3 slots with 8.03626), then the Chebyshev series interpolation will try to take a square root of negative numbers, which can result in nan. Chebyshev series is evaluated for all slots in the ciphertext (half the ring dimension). You can set all other slots to something higher than 0, e.g., 1.0, and then it should work.