Negating a ciphertext
Negating a value means taking its opposite. The opposite of a ciphertext representing a message in the interval is a ciphertext representing in the interval . This operation does not consume padding nor add noise but it modifies the interval of the encoder.
Operation | |
Type | Noiseless |
Side effects | Modifies encoding |
Computing an LWE opposite
To compute the opposite of an LWE, simply use the opposite
method, which will return a new ciphertext with the modified value. The method exists in a mutable opposite_inplace
form as well, which modifies the ciphertext itself. All operations in concrete are implemented in immutable and mutable forms, with mutable forms always postfixed with _inplace
.
Here is a complete example for a single LWE:
As for all operations in Concrete, they can be applied to a vector of messages using the VectorLWE
struct instead of LWE
. The vectorized form has an additional method opposite_nth
that enables negating a single value by passing its index to the function.
Last updated