Newbie questions - simple integers with larger numbers

I am trying to modify the simple-integers example to add the following two integer vectors:

// First plaintext vector is encoded
std::vector<int64_t> vectorOfInts1 = {100000, 120000, 130000, 140000, 150000, 100006, 70000, 80000, 90000, 100000, 110000, 100002};
Plaintext plaintext1               = cryptoContext->MakePackedPlaintext(vectorOfInts1);
// Second plaintext vector is encoded
std::vector<int64_t> vectorOfInts2 = {106000, 120060, 133000, 141000, 154000, 180006, 75000, 81000, 95000, 140000, 119000, 105002};
Plaintext plaintext2               = cryptoContext->MakePackedPlaintext(vectorOfInts2);

I get the following runtime exception.

libc++abi: terminating with uncaught exception of type lbcrypto::math_error: ...openfhe-development/src/core/lib/math/nbtheory.cpp:294 
Please provide a primeModulus(q) and a cyclotomic number(m) satisfying the condition: (q-1)/m is an integer. 
The values of primeModulus = 500009 and m = 16384 do not satisfy this condition

Where can I find information on how to select the right parameters for my use case?

Thanks

1 Like

Please provide the crypto-context parameters or the source code of your test case.

1 Like

To use MakePackedPlaintext with BFV/BGV, you need to choose a prime plaintext modulus t such that t = 1 (mod m), which in your case is 16,384. Try using a plaintext modulus of 557,057.

1 Like

That seems to have solved the error.
Thank you!

1 Like