for i in 0…n {
for j in 0…n {
if i != j {
let lt = encrypted_values[i].lt(&encrypted_values[j]); // FheBool
cmp_matrix[i][j] = lt_as_int;
}
}
}
After that we are apply column wise addition that why I change the data type.
for i in 0…n {
for j in 0…n {
if i != j {
let lt = encrypted_values[i].lt(&encrypted_values[j]); // FheBool
cmp_matrix[i][j] = lt_as_int;
}
}
}
After that we are apply column wise addition that why I change the data type.
Hi!
You can use cast_from
:
use tfhe::prelude::*;
use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt8};
let (client_key, server_key) = generate_keys(ConfigBuilder::default());
set_server_key(server_key);
let a = FheBool::encrypt(true, &client_key);
let b = FheInt8::cast_from(a);
let decrypted: i8 = b.decrypt(&client_key);
assert_eq!(decrypted, i8::from(true));