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§
sourcefn add_negate(&mut self, x: NodeIndex) -> NodeIndex
fn add_negate(&mut self, x: NodeIndex) -> NodeIndex
Appends a negate operation that depends on operand x
.
sourcefn add_multiply(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
fn add_multiply(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
Appends a multiply operation that depends on the operands x
and y
.
sourcefn add_multiply_plaintext(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
fn add_multiply_plaintext(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
Appends a multiply operation that depends on the operands x
and y
.
sourcefn add_add(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
fn add_add(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
Appends an add operation that depends on the operands x
and y
.
sourcefn add_sub(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
fn add_sub(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
Appends a subtract operation that depends on the operands x
and y
.
sourcefn add_input_ciphertext(&mut self, id: usize) -> NodeIndex
fn add_input_ciphertext(&mut self, id: usize) -> NodeIndex
Appends an input ciphertext with the given name.
sourcefn add_input_plaintext(&mut self, id: usize) -> NodeIndex
fn add_input_plaintext(&mut self, id: usize) -> NodeIndex
Appends an input plaintext with the given name.
sourcefn add_input_literal(&mut self, value: Literal) -> NodeIndex
fn add_input_literal(&mut self, value: Literal) -> NodeIndex
Appends a constant literal.
value
: The integer or floating-point value in the literal.
sourcefn add_output_ciphertext(&mut self, x: NodeIndex) -> NodeIndex
fn add_output_ciphertext(&mut self, x: NodeIndex) -> NodeIndex
Adds a node designating x
as an output of the FHE program.
sourcefn add_relinearize(&mut self, x: NodeIndex) -> NodeIndex
fn add_relinearize(&mut self, x: NodeIndex) -> NodeIndex
Appends an operation that relinearizes x
.
sourcefn add_rotate_left(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
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.
sourcefn append_rotate_right(&mut self, x: NodeIndex, y: NodeIndex) -> NodeIndex
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.
sourcefn get_outputs(&self) -> Box<dyn Iterator<Item = NodeIndex> + '_>
fn get_outputs(&self) -> Box<dyn Iterator<Item = NodeIndex> + '_>
Returns the node indices of output ciphertexts
sourcefn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Returns the number of inputs ciphertexts this FHE program takes.
sourcefn prune(&self, nodes: &[NodeIndex]) -> Self
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 newFheProgram
containing nodes in the transitive closure of this set.
sourcefn validate(&self) -> Result<()>
fn validate(&self) -> Result<()>
Validates this FheProgram
for correctness.
sourcefn requires_relin_keys(&self) -> bool
fn requires_relin_keys(&self) -> bool
Whether or not this FHE program needs relin keys to run. Needed for relinearization.
sourcefn requires_galois_keys(&self) -> bool
fn requires_galois_keys(&self) -> bool
Whether or not this FHE program requires Galois keys to run. Needed for rotation and row swap operations.