-
Hi, BR |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
To compute If you are using BFV/BGV: https://petsymposium.org/popets/2021/popets-2021-0046.pdf If you are using CKKS: https://www.computer.org/csdl/journal/tq/5555/01/09517029/1wau0zex2z6 (eprint is down at the time of this post) To compute Compose the above with an FFT-like algorithm, comparing pairs of elements. After log2(vector_size) iterations, you'll end up with a vector encrypting all zero except 1 a the index of the of the maximum value. You can get the value of this index by doing an inner product with a plaintext vector encoding the position of each index. |
Beta Was this translation helpful? Give feedback.
To compute
max(a,b)
:If you are using BFV/BGV: https://petsymposium.org/popets/2021/popets-2021-0046.pdf
If you are using CKKS: https://www.computer.org/csdl/journal/tq/5555/01/09517029/1wau0zex2z6 (eprint is down at the time of this post)
Else you can compose CKKS with lookup tables to evaluate non-linear functions, such as sign or ReLU. See the example in
lattigo/examples/ckks/advanced/lut
->max(a, b) = b + ReLU(a-b)
andReLU(x) = x * sign(x)
wheresign(x) = 0 if x < 0 else 1
.To compute
index_max(vector)
:Compose the above with an FFT-like algorithm, comparing pairs of elements. After log2(vector_size) iterations, you'll end up with a vector encrypting all zero except 1 a the index of…