0
$\begingroup$

In SEAL library, I want to multiply a BFV ciphertext ct with an integer inverse. Here are what I do:

  1. Compute the integer inverse as follows:
uint64_t inverse = invert_mod(pow(2, log_total_item),enc_params_.plain_modulus());
  1. Encode inverse to BFV plaintext using the following code:
Plaintext inverse_pt(to_string(inverse));
  1. 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.

$\endgroup$

1 Answer 1

0
$\begingroup$

As far as I know: if you are trying to multiply a ciphertext by a very large constant (inverse, I assume), this is a highly nontrivial task (because of the simultaneous error scale-up). In fact, if you're able to do that, you already did the essential part of bootstrapping itself (check e.g. Section 3, first paragraph and following).

Now, that's what might be the reason, why you get an error message here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.