Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message from Rescale(c) when level of c is lowest in FIXEDMANUAL #577

Open
Maokami opened this issue Nov 3, 2023 · 1 comment
Labels
cleanup Code cleanup

Comments

@Maokami
Copy link

Maokami commented Nov 3, 2023

HI!
In the following code snippet, rescaling ciphertext twice where multiplicativedepth is one. I guess the second rescale operation is applied to the ciphertext which already has lowest level.

#include "openfhe.h"

using namespace lbcrypto;

int main() {
    CCParams<CryptoContextCKKSRNS> parameters;
    parameters.SetMultiplicativeDepth(1);
    parameters.SetScalingTechnique(FIXEDMANUAL);

    CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);

    cc->Enable(PKE);
    cc->Enable(LEVELEDSHE);

    auto keys = cc->KeyGen();

    cc->EvalMultKeyGen(keys.secretKey);

    std::vector<double> x1 = {1, 0.5, 0.75, 1.0, 2.0, 3.0, 4.0, 5.0};

    Plaintext ptxt1 = cc->MakeCKKSPackedPlaintext(x1);

    auto c1 = cc->Encrypt(keys.publicKey, ptxt1);
    
    cc -> RescaleInPlace(c1);
    cc -> RescaleInPlace(c1);

    return 0;
}

It produce an error with message Removing last element of DCRTPoly object renders it invalid!.
I believe the message could be made more descriptive!

@Maokami
Copy link
Author

Maokami commented Nov 3, 2023

Maybe related to #351?

@yspolyakov yspolyakov added this to the Future Releases milestone Nov 8, 2023
@yspolyakov yspolyakov added the cleanup Code cleanup label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code cleanup
Projects
None yet
Development

No branches or pull requests

2 participants