Hi all, I have been trying to understand the comparison of two number in TFHE. I have been referring to the tfhe page (link I am not allowed to share being a new user)
use tfhe::integer::gen_keys_radix;
use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2;
fn main() {
// We generate keys to encrypt 16 bits radix-encoded integers
// using 8 blocks of 2 bits
let (cks, sks) = gen_keys_radix(PARAM_MESSAGE_2_CARRY_2, 8);
let clear_a = 2382u16;
let clear_b = 29374u16;
let mut a = cks.encrypt(clear_a as u64);
let mut b = cks.encrypt(clear_b as u64);
let encrypted_max = sks.smart_max_parallelized(&mut a, &mut b);
let decrypted_max: u64 = cks.decrypt(&encrypted_max);
assert_eq!(decrypted_max as u16, clear_a.max(clear_b))
}
I would love to know how the
smart_max_parallelized(&mut a, &mut b);
works. I could not find the recipe of the function anywhere. I would really appreciate any leads.