Score:0

Transform a large integer to Plaintext ERROR in SEAL Library

sc flag
Zhu

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.

Score:0
tn flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.