In SEAL library, I want to multiply a BFV ciphertext ct with an integer inverse. Here are what I do:
- Compute the integer inverse as follows:
uint64_t inverse = invert_mod(pow(2, log_total_item),enc_params_.plain_modulus());
- Encode inverse to BFV plaintext using the following code:
Plaintext inverse_pt(to_string(inverse));
- Compute multiplication as follows:
evaluator.Multiply_plain_inplace(*ct*, *inverse_pt*);
But the value of inverse is too large:
enc_params_.plain_modulus() = 1152921504606830593
inverse = 1134907106097348865
Error occurs in step 2 like this:
terminate called after throwing an instance of 'std::invalid_argument'
what(): hex_poly has too large coefficients
It seems that inverse is too large and can not be transformed to BFV plaintext directly. I want to know is there any method that can solve this problem.