Could we implement any non-linear PBS function at low layer API e.g. core_crypto and call it from high level API? For example, function f(x) = sqrt(x) is implemented by PBS at core_crypto and we call it from high level API with FheInt32 input argument and functoin f shall return FheInt32 output.
So a FheUint from the high level API is a wrapper around a radix from the integer API. They are composed of many blocks, so if you want to do a function like sqrt, applying a pbs that maps sqrt on each block is not going to yield the correct results, you cannot apply a PBS from core_crypto to the whole encrypted value.
The is a match_value method that you could use as it allows to apply a lookup table to a FheUint. However as it uses a lot of core_pbs internally it is not very practical beyond 8-10 bits
Hi, thanks for your reply! if I look into the example of “match_value”, it uses FheUint16. Does it also take time? What do you mean by “not very practical beyond 8-10 bits”?
Any thoughts or plans for users to implement custom PBS function to be called at high level API? Is concrete better in the sense? (I don’t think so though, as it’s compiler to build Rust high level API layer and it doesn’t touch core_crypto at all)
By practical I mean that beyond 12 bits, the computation is going to take a few seconds even on very beefy CPU
Applying a PBS, or more correctly a lookup table on ciphertexts which encrypts a lot of bits (either as a single ciphertext or as a collection of ciphertexts) is a hard subject, hence why the current solution takes time, it is something we work on.
Concrete is a totally different product (its a compiler) with different goals and approach, but even with it, if you try to apply a lookup table on ciphertext that encrypts a lots of bits, you are either going to have errors about unfulfillable constraints or very long compute times