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§
Sourcefn add(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>
fn add(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>
VectorGadget::add computes the element-wise sum of two vectors.
Sourcefn sub(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>
fn sub(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>
VectorGadget::sub computes the element-wise difference of two
vectors.
Sourcefn scale<Scalar, Output>(
&self,
scalar: &Scalar,
) -> Result<Vec<Output>, SynthesisError>
fn scale<Scalar, Output>( &self, scalar: &Scalar, ) -> Result<Vec<Output>, SynthesisError>
VectorGadget::scale multiplies every element by a scalar.
Sourcefn hadamard(&self, other: &Self) -> Result<Vec<FV>, SynthesisError>
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".