Trait FheProgramTrait

Source
pub trait FheProgramTrait {
Show 18 methods // Required methods fn add_negate(&mut self, x: NodeIndex) -> NodeIndex; fn add_multiply(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex; fn add_multiply_plaintext( &mut self, x: NodeIndex, y: NodeIndex, ) -> NodeIndex; fn add_add(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex; fn add_sub(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex; fn add_input_ciphertext(&mut self, id: usize) -> NodeIndex; fn add_input_plaintext(&mut self, id: usize) -> NodeIndex; fn add_input_literal(&mut self, value: Literal) -> NodeIndex; fn add_output_ciphertext(&mut self, x: NodeIndex) -> NodeIndex; fn add_relinearize(&mut self, x: NodeIndex) -> NodeIndex; fn add_rotate_left(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex; fn append_rotate_right(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex; fn get_outputs(&self) -> Box<dyn Iterator<Item = NodeIndex> + '_>; fn num_inputs(&self) -> usize; fn prune(&self, nodes: &[NodeIndex]) -> Self; fn validate(&self) -> Result<()>; fn requires_relin_keys(&self) -> bool; fn requires_galois_keys(&self) -> bool;
}
Expand description

Extension methods for FheProgram.

Required Methods§

Source

fn add_negate(&mut self, x: NodeIndex) -> NodeIndex

Appends a negate operation that depends on operand x.

Source

fn add_multiply(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends a multiply operation that depends on the operands x and y.

Source

fn add_multiply_plaintext(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends a multiply operation that depends on the operands x and y.

Source

fn add_add(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends an add operation that depends on the operands x and y.

Source

fn add_sub(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends a subtract operation that depends on the operands x and y.

Source

fn add_input_ciphertext(&mut self, id: usize) -> NodeIndex

Appends an input ciphertext with the given name.

Source

fn add_input_plaintext(&mut self, id: usize) -> NodeIndex

Appends an input plaintext with the given name.

Source

fn add_input_literal(&mut self, value: Literal) -> NodeIndex

Appends a constant literal.

  • value: The integer or floating-point value in the literal.
Source

fn add_output_ciphertext(&mut self, x: NodeIndex) -> NodeIndex

Adds a node designating x as an output of the FHE program.

Source

fn add_relinearize(&mut self, x: NodeIndex) -> NodeIndex

Appends an operation that relinearizes x.

Source

fn add_rotate_left(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends an operation that rotates ciphertext x left by the literal node at y places.

§Remarks

Recall that BFV has 2 rows in a Batched vector. This rotates each row. CKKS has one large vector.

Source

fn append_rotate_right(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex

Appends an operation that rotates ciphertext x right by the literal node at y places.

§Remarks

Recall that BFV has 2 rows in a Batched vector. This rotates each row. CKKS has one large vector.

Source

fn get_outputs(&self) -> Box<dyn Iterator<Item = NodeIndex> + '_>

Returns the node indices of output ciphertexts

Source

fn num_inputs(&self) -> usize

Returns the number of inputs ciphertexts this FHE program takes.

Source

fn prune(&self, nodes: &[NodeIndex]) -> Self

Runs tree shaking and returns a derived FheProgram with only dependencies required to run the requested nodes.

  • nodes: indices specifying a set of nodes in the graph. Prune return a new FheProgram containing nodes in the transitive closure of this set.
Source

fn validate(&self) -> Result<()>

Validates this FheProgram for correctness.

Source

fn requires_relin_keys(&self) -> bool

Whether or not this FHE program needs relin keys to run. Needed for relinearization.

Source

fn requires_galois_keys(&self) -> bool

Whether or not this FHE program requires Galois keys to run. Needed for rotation and row swap operations.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§