TFHE-rs and lut

Is there a simple LUT example that I can use for TFHE-rs? (I thought I have seen that earlier using closures, but now I no longer sure.).

Hello @agol

Depending on the API you are using there are different ways to do that.

Here is an example for the shortint API from our documentation Operations | TFHE-rs

Which API level are you using ?

Cheers

Thanks! I am just exploring for now. A couple of follow-up questions.

  1. How do I get the size of the LUT, in general? (or print the entries of LUT)?
  2. Are luts for integer API?
  3. What other keys are legal besides PARAM_MESSAGE_2_CARRY_2_KS_PBS? For example, in the code snippet, let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); can, what other constants can be used? (I tried looking into the documentation).

Hello @agol

You should be able to access the lookup table underlying trivial GLWE ciphertext with

let acc = &lookup_table.acc;

to print you can likely do:

println!("{:?}", acc.as_ref());

Something akin to integer luts can be done with match_value-style functions ServerKey in tfhe::integer::server_key - Rust

Normally the other constants provided should be legal as well, check tfhe::shortint::parameters::$CURRENT_VERSION
though from our experience the best parameter set is the 2_2 one we give, it has good performance and all operations are supported. Asymmetrical parameters like 2_3 or parameters where the message and carry spaces have a non power of 2 bit width (think 3_3 parameters) may have surprising behaviors for certain functions.

Cheers