Trait prio::flp::Gadget

source ·
pub trait Gadget<F: FftFriendlyFieldElement>: Debug {
    // Required methods
    fn call(&mut self, inp: &[F]) -> Result<F, FlpError>;
    fn call_poly(
        &mut self,
        outp: &mut [F],
        inp: &[Vec<F>]
    ) -> Result<(), FlpError>;
    fn arity(&self) -> usize;
    fn degree(&self) -> usize;
    fn calls(&self) -> usize;
    fn as_any(&mut self) -> &mut dyn Any;
}
Expand description

A gadget, a non-affine arithmetic circuit that is called when evaluating a validity circuit.

Required Methods§

source

fn call(&mut self, inp: &[F]) -> Result<F, FlpError>

Evaluates the gadget on input inp and returns the output.

source

fn call_poly(&mut self, outp: &mut [F], inp: &[Vec<F>]) -> Result<(), FlpError>

Evaluate the gadget on input of a sequence of polynomials. The output is written to outp.

source

fn arity(&self) -> usize

Returns the arity of the gadget. This is the length of inp passed to call or call_poly.

source

fn degree(&self) -> usize

Returns the circuit’s arithmetic degree. This determines the minimum length the outp buffer passed to call_poly.

source

fn calls(&self) -> usize

Returns the number of times the gadget is expected to be called.

source

fn as_any(&mut self) -> &mut dyn Any

This call is used to downcast a Box<dyn Gadget<F>> to a concrete type.

Implementors§

source§

impl<F, G> Gadget<F> for ParallelSumMultithreaded<F, G>
where F: FftFriendlyFieldElement + Sync + Send, G: 'static + Gadget<F> + Clone + Sync + Send,

source§

impl<F: FftFriendlyFieldElement> Gadget<F> for Mul<F>

source§

impl<F: FftFriendlyFieldElement> Gadget<F> for PolyEval<F>

source§

impl<F: FftFriendlyFieldElement, G: 'static + Gadget<F>> Gadget<F> for ParallelSum<F, G>