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§
sourcefn call(&mut self, inp: &[F]) -> Result<F, FlpError>
fn call(&mut self, inp: &[F]) -> Result<F, FlpError>
Evaluates the gadget on input inp
and returns the output.
sourcefn call_poly(&mut self, outp: &mut [F], inp: &[Vec<F>]) -> Result<(), FlpError>
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
.
sourcefn arity(&self) -> usize
fn arity(&self) -> usize
Returns the arity of the gadget. This is the length of inp
passed to call
or
call_poly
.