Skip to main content

VectorGadget

Trait VectorGadget 

Source
pub trait VectorGadget<FV> {
    // Required methods
    fn add(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>;
    fn sub(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>;
    fn scale<Scalar, Output>(
        &self,
        scalar: &Scalar,
    ) -> Result<Vec<Output>, SynthesisError>
       where for<'a> &'a Scalar: Mul<&'a FV, Output = Output>;
    fn hadamard(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>;
}
Expand description

VectorGadget defines operations on in-circuit vector variables.

Required Methods§

Source

fn add(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

VectorGadget::add computes the element-wise sum of two vectors.

Source

fn sub(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

VectorGadget::sub computes the element-wise difference of two vectors.

Source

fn scale<Scalar, Output>( &self, scalar: &Scalar, ) -> Result<Vec<Output>, SynthesisError>
where for<'a> &'a Scalar: Mul<&'a FV, Output = Output>,

VectorGadget::scale multiplies every element by a scalar.

Source

fn hadamard(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

VectorGadget::hadamard computes the element-wise (Hadamard) product of two vectors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<FV> VectorGadget<FV> for [FV]
where for<'a> &'a FV: Add<&'a FV, Output = FV> + Sub<&'a FV, Output = FV> + Mul<&'a FV, Output = FV>,

Source§

fn add(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

Source§

fn sub(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

Source§

fn scale<Scalar, Output>( &self, scalar: &Scalar, ) -> Result<Vec<Output>, SynthesisError>
where for<'a> &'a Scalar: Mul<&'a FV, Output = Output>,

Source§

fn hadamard(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>

Implementors§