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.
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.