Struct snarkvm_circuit_types::prelude::LinearCombination
source · pub struct LinearCombination<F>where
F: PrimeField,{ /* private fields */ }
Implementations§
source§impl<F> LinearCombination<F>where
F: PrimeField,
impl<F> LinearCombination<F>where F: PrimeField,
sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Returns true
if there are no terms in the linear combination.
sourcepub fn is_public(&self) -> bool
pub fn is_public(&self) -> bool
Returns true
if there is exactly one term with a coefficient of one,
and the term contains a public variable.
sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true
if the linear combination is not constant or public.
sourcepub fn is_boolean_type(&self) -> bool
pub fn is_boolean_type(&self) -> bool
Returns true
if the linear combination represents a Boolean
type,
and is well-formed.
Properties:
- Either
constant
orterms
is utilized, however never both. - Every individual variable in the linear combination must always be either
0
or1
. - The value of the linear combination must always be either
0
or1
.
Trait Implementations§
source§impl<F> Add<&LinearCombination<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Add<&LinearCombination<F>> for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: &LinearCombination<F>
) -> <&LinearCombination<F> as Add<&LinearCombination<F>>>::Output
fn add( self, other: &LinearCombination<F> ) -> <&LinearCombination<F> as Add<&LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<&LinearCombination<F>> for &Variable<F>where
F: PrimeField,
impl<F> Add<&LinearCombination<F>> for &Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: &LinearCombination<F>
) -> <&Variable<F> as Add<&LinearCombination<F>>>::Output
fn add( self, other: &LinearCombination<F> ) -> <&Variable<F> as Add<&LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<&LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Add<&LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: &LinearCombination<F>
) -> <LinearCombination<F> as Add<&LinearCombination<F>>>::Output
fn add( self, other: &LinearCombination<F> ) -> <LinearCombination<F> as Add<&LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<&LinearCombination<F>> for Variable<F>where
F: PrimeField,
impl<F> Add<&LinearCombination<F>> for Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: &LinearCombination<F>
) -> <Variable<F> as Add<&LinearCombination<F>>>::Output
fn add( self, other: &LinearCombination<F> ) -> <Variable<F> as Add<&LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<&Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Add<&Variable<F>> for LinearCombination<F>where F: PrimeField,
source§impl<F> Add<LinearCombination<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Add<LinearCombination<F>> for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: LinearCombination<F>
) -> <&LinearCombination<F> as Add<LinearCombination<F>>>::Output
fn add( self, other: LinearCombination<F> ) -> <&LinearCombination<F> as Add<LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<LinearCombination<F>> for &Variable<F>where
F: PrimeField,
impl<F> Add<LinearCombination<F>> for &Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: LinearCombination<F>
) -> <&Variable<F> as Add<LinearCombination<F>>>::Output
fn add( self, other: LinearCombination<F> ) -> <&Variable<F> as Add<LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Add<LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: LinearCombination<F>
) -> <LinearCombination<F> as Add<LinearCombination<F>>>::Output
fn add( self, other: LinearCombination<F> ) -> <LinearCombination<F> as Add<LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<LinearCombination<F>> for Variable<F>where
F: PrimeField,
impl<F> Add<LinearCombination<F>> for Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.source§fn add(
self,
other: LinearCombination<F>
) -> <Variable<F> as Add<LinearCombination<F>>>::Output
fn add( self, other: LinearCombination<F> ) -> <Variable<F> as Add<LinearCombination<F>>>::Output
Performs the
+
operation. Read moresource§impl<F> Add<Variable<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Add<Variable<F>> for &LinearCombination<F>where F: PrimeField,
source§impl<F> Add<Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Add<Variable<F>> for LinearCombination<F>where F: PrimeField,
source§impl<F> AddAssign<&LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> AddAssign<&LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
source§fn add_assign(&mut self, other: &LinearCombination<F>)
fn add_assign(&mut self, other: &LinearCombination<F>)
Performs the
+=
operation. Read moresource§impl<F> AddAssign<LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> AddAssign<LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
source§fn add_assign(&mut self, other: LinearCombination<F>)
fn add_assign(&mut self, other: LinearCombination<F>)
Performs the
+=
operation. Read moresource§impl<F> Clone for LinearCombination<F>where
F: Clone + PrimeField,
impl<F> Clone for LinearCombination<F>where F: Clone + PrimeField,
source§fn clone(&self) -> LinearCombination<F>
fn clone(&self) -> LinearCombination<F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F> Debug for LinearCombination<F>where
F: PrimeField,
impl<F> Debug for LinearCombination<F>where F: PrimeField,
source§impl<F> Display for LinearCombination<F>where
F: PrimeField,
impl<F> Display for LinearCombination<F>where F: PrimeField,
source§impl<F> From<&[Variable<F>]> for LinearCombination<F>where
F: PrimeField,
impl<F> From<&[Variable<F>]> for LinearCombination<F>where F: PrimeField,
source§fn from(variables: &[Variable<F>]) -> LinearCombination<F>
fn from(variables: &[Variable<F>]) -> LinearCombination<F>
Converts to this type from the input type.
source§impl<F, const N: usize> From<&[Variable<F>; N]> for LinearCombination<F>where
F: PrimeField,
impl<F, const N: usize> From<&[Variable<F>; N]> for LinearCombination<F>where F: PrimeField,
source§impl<E> From<&Address<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Address<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(
address: &Address<E>
) -> LinearCombination<<E as Environment>::BaseField>
fn from( address: &Address<E> ) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<&Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(
boolean: &Boolean<E>
) -> LinearCombination<<E as Environment>::BaseField>
fn from( boolean: &Boolean<E> ) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<&Field<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Field<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(field: &Field<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(field: &Field<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<&Group<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Group<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(group: &Group<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(group: &Group<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E, I> From<&Integer<E, I>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
I: IntegerType,
impl<E, I> From<&Integer<E, I>> for LinearCombination<<E as Environment>::BaseField>where E: Environment, I: IntegerType,
source§fn from(
integer: &Integer<E, I>
) -> LinearCombination<<E as Environment>::BaseField>
fn from( integer: &Integer<E, I> ) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<&LinearCombination<<E as Environment>::BaseField>> for Field<E>where
E: Environment,
impl<E> From<&LinearCombination<<E as Environment>::BaseField>> for Field<E>where E: Environment,
source§fn from(
linear_combination: &LinearCombination<<E as Environment>::BaseField>
) -> Field<E>
fn from( linear_combination: &LinearCombination<<E as Environment>::BaseField> ) -> Field<E>
Converts to this type from the input type.
source§impl<E> From<&Scalar<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<&Scalar<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(scalar: &Scalar<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(scalar: &Scalar<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<F> From<&Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> From<&Variable<F>> for LinearCombination<F>where F: PrimeField,
source§fn from(variable: &Variable<F>) -> LinearCombination<F>
fn from(variable: &Variable<F>) -> LinearCombination<F>
Converts to this type from the input type.
source§impl<F> From<&Vec<Variable<F>, Global>> for LinearCombination<F>where
F: PrimeField,
impl<F> From<&Vec<Variable<F>, Global>> for LinearCombination<F>where F: PrimeField,
source§impl<F, const N: usize> From<[Variable<F>; N]> for LinearCombination<F>where
F: PrimeField,
impl<F, const N: usize> From<[Variable<F>; N]> for LinearCombination<F>where F: PrimeField,
source§impl<E> From<Address<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Address<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(address: Address<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(address: Address<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Boolean<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(boolean: Boolean<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(boolean: Boolean<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<Field<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Field<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(field: Field<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(field: Field<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<Group<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Group<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(group: Group<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(group: Group<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E, I> From<Integer<E, I>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
I: IntegerType,
impl<E, I> From<Integer<E, I>> for LinearCombination<<E as Environment>::BaseField>where E: Environment, I: IntegerType,
source§fn from(
integer: Integer<E, I>
) -> LinearCombination<<E as Environment>::BaseField>
fn from( integer: Integer<E, I> ) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<E> From<LinearCombination<<E as Environment>::BaseField>> for Field<E>where
E: Environment,
impl<E> From<LinearCombination<<E as Environment>::BaseField>> for Field<E>where E: Environment,
source§fn from(
linear_combination: LinearCombination<<E as Environment>::BaseField>
) -> Field<E>
fn from( linear_combination: LinearCombination<<E as Environment>::BaseField> ) -> Field<E>
Converts to this type from the input type.
source§impl<E> From<Scalar<E>> for LinearCombination<<E as Environment>::BaseField>where
E: Environment,
impl<E> From<Scalar<E>> for LinearCombination<<E as Environment>::BaseField>where E: Environment,
source§fn from(scalar: Scalar<E>) -> LinearCombination<<E as Environment>::BaseField>
fn from(scalar: Scalar<E>) -> LinearCombination<<E as Environment>::BaseField>
Converts to this type from the input type.
source§impl<F> From<Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> From<Variable<F>> for LinearCombination<F>where F: PrimeField,
source§fn from(variable: Variable<F>) -> LinearCombination<F>
fn from(variable: Variable<F>) -> LinearCombination<F>
Converts to this type from the input type.
source§impl<F> From<Vec<Variable<F>, Global>> for LinearCombination<F>where
F: PrimeField,
impl<F> From<Vec<Variable<F>, Global>> for LinearCombination<F>where F: PrimeField,
source§impl<F> Mul<&F> for &LinearCombination<F>where
F: PrimeField,
impl<F> Mul<&F> for &LinearCombination<F>where F: PrimeField,
source§impl<F> Mul<&F> for LinearCombination<F>where
F: PrimeField,
impl<F> Mul<&F> for LinearCombination<F>where F: PrimeField,
source§impl<F> Mul<F> for &LinearCombination<F>where
F: PrimeField,
impl<F> Mul<F> for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
*
operator.source§impl<F> Mul<F> for LinearCombination<F>where
F: PrimeField,
impl<F> Mul<F> for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
*
operator.source§impl<F> Neg for &LinearCombination<F>where
F: PrimeField,
impl<F> Neg for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§impl<F> Neg for LinearCombination<F>where
F: PrimeField,
impl<F> Neg for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§impl<F> Sub<&LinearCombination<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Sub<&LinearCombination<F>> for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: &LinearCombination<F>
) -> <&LinearCombination<F> as Sub<&LinearCombination<F>>>::Output
fn sub( self, other: &LinearCombination<F> ) -> <&LinearCombination<F> as Sub<&LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<&LinearCombination<F>> for &Variable<F>where
F: PrimeField,
impl<F> Sub<&LinearCombination<F>> for &Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: &LinearCombination<F>
) -> <&Variable<F> as Sub<&LinearCombination<F>>>::Output
fn sub( self, other: &LinearCombination<F> ) -> <&Variable<F> as Sub<&LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<&LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Sub<&LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: &LinearCombination<F>
) -> <LinearCombination<F> as Sub<&LinearCombination<F>>>::Output
fn sub( self, other: &LinearCombination<F> ) -> <LinearCombination<F> as Sub<&LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<&LinearCombination<F>> for Variable<F>where
F: PrimeField,
impl<F> Sub<&LinearCombination<F>> for Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: &LinearCombination<F>
) -> <Variable<F> as Sub<&LinearCombination<F>>>::Output
fn sub( self, other: &LinearCombination<F> ) -> <Variable<F> as Sub<&LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<&Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Sub<&Variable<F>> for LinearCombination<F>where F: PrimeField,
source§impl<F> Sub<LinearCombination<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Sub<LinearCombination<F>> for &LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: LinearCombination<F>
) -> <&LinearCombination<F> as Sub<LinearCombination<F>>>::Output
fn sub( self, other: LinearCombination<F> ) -> <&LinearCombination<F> as Sub<LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<LinearCombination<F>> for &Variable<F>where
F: PrimeField,
impl<F> Sub<LinearCombination<F>> for &Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: LinearCombination<F>
) -> <&Variable<F> as Sub<LinearCombination<F>>>::Output
fn sub( self, other: LinearCombination<F> ) -> <&Variable<F> as Sub<LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<LinearCombination<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Sub<LinearCombination<F>> for LinearCombination<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: LinearCombination<F>
) -> <LinearCombination<F> as Sub<LinearCombination<F>>>::Output
fn sub( self, other: LinearCombination<F> ) -> <LinearCombination<F> as Sub<LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<LinearCombination<F>> for Variable<F>where
F: PrimeField,
impl<F> Sub<LinearCombination<F>> for Variable<F>where F: PrimeField,
§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.source§fn sub(
self,
other: LinearCombination<F>
) -> <Variable<F> as Sub<LinearCombination<F>>>::Output
fn sub( self, other: LinearCombination<F> ) -> <Variable<F> as Sub<LinearCombination<F>>>::Output
Performs the
-
operation. Read moresource§impl<F> Sub<Variable<F>> for &LinearCombination<F>where
F: PrimeField,
impl<F> Sub<Variable<F>> for &LinearCombination<F>where F: PrimeField,
source§impl<F> Sub<Variable<F>> for LinearCombination<F>where
F: PrimeField,
impl<F> Sub<Variable<F>> for LinearCombination<F>where F: PrimeField,
Auto Trait Implementations§
impl<F> RefUnwindSafe for LinearCombination<F>where F: RefUnwindSafe,
impl<F> !Send for LinearCombination<F>
impl<F> !Sync for LinearCombination<F>
impl<F> Unpin for LinearCombination<F>where F: Unpin,
impl<F> UnwindSafe for LinearCombination<F>where F: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more