Attribute Macro sunscreen_compiler_macros::fhe_program
source · [−]#[fhe_program]Expand description
Specifies a function to be an fhe_program. An fhe_program has any number of inputs that impl the
FheType trait and returns either a single type implementing FheType or a tuple of
types implementing FheType.
This function gets run by the compiler to build up the fhe_program you specify and does not
directly or eagerly perform homomorphic operations.
Parameters
scheme(required): Designates the scheme thisfhe_programuses. Today, this must be"bfv".
Examples
ⓘ
#[fhe_program(scheme = "bfv")]
fn multiply_add(
a: Cipher<Signed>,
b: Cipher<Signed>,
c: Cipher<Signed>
) -> Cipher<Signed> {
a * b + c
}ⓘ
#[fhe_program(scheme = "bfv")]
fn multi_out(
a: Cipher<Signed>,
b: Cipher<Signed>,
c: Cipher<Signed>
) -> (Cipher<Signed>, Cipher<Signed>) {
(a + b, b + c)
}