pub struct LinearCombination<F: Field>(pub Vec<(Variable, F)>);
Expand description
This represents a linear combination of some variables, with coefficients
in the field F
.
The (coeff, var)
pairs in a LinearCombination
are kept sorted according
to the index of the variable in its constraint system.
Tuple Fields§
§0: Vec<(Variable, F)>
Implementations§
Source§impl<F: Field> LinearCombination<F>
impl<F: Field> LinearCombination<F>
Sourcepub fn zero() -> LinearCombination<F>
pub fn zero() -> LinearCombination<F>
Outputs an empty linear combination.
Sourcepub fn replace_in_place(&mut self, other: Self)
pub fn replace_in_place(&mut self, other: Self)
Replaces the contents of self
with those of other
.
Sourcepub fn negate_in_place(&mut self)
pub fn negate_in_place(&mut self)
Negate the coefficients of all variables in self
.
Sourcepub fn double_in_place(&mut self)
pub fn double_in_place(&mut self)
Double the coefficients of all variables in self
.
Trait Implementations§
Source§impl<F: Field> Add<&LinearCombination<F>> for &LinearCombination<F>
impl<F: Field> Add<&LinearCombination<F>> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(self, other: &LinearCombination<F>) -> LinearCombination<F>
fn add(self, other: &LinearCombination<F>) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<'a, F: Field> Add<&'a LinearCombination<F>> for LinearCombination<F>
impl<'a, F: Field> Add<&'a LinearCombination<F>> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(self, other: &'a LinearCombination<F>) -> LinearCombination<F>
fn add(self, other: &'a LinearCombination<F>) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<F: Field> Add<(F, &LinearCombination<F>)> for &LinearCombination<F>
impl<F: Field> Add<(F, &LinearCombination<F>)> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(
self,
(mul_coeff, other): (F, &LinearCombination<F>),
) -> LinearCombination<F>
fn add( self, (mul_coeff, other): (F, &LinearCombination<F>), ) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<'a, F: Field> Add<(F, &'a LinearCombination<F>)> for LinearCombination<F>
impl<'a, F: Field> Add<(F, &'a LinearCombination<F>)> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(
self,
(mul_coeff, other): (F, &'a LinearCombination<F>),
) -> LinearCombination<F>
fn add( self, (mul_coeff, other): (F, &'a LinearCombination<F>), ) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<F: Field> Add<(F, LinearCombination<F>)> for &LinearCombination<F>
impl<F: Field> Add<(F, LinearCombination<F>)> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(
self,
(mul_coeff, other): (F, LinearCombination<F>),
) -> LinearCombination<F>
fn add( self, (mul_coeff, other): (F, LinearCombination<F>), ) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<F: Field> Add<(F, LinearCombination<F>)> for LinearCombination<F>
impl<F: Field> Add<(F, LinearCombination<F>)> for LinearCombination<F>
Source§impl<F: Field> Add<LinearCombination<F>> for &LinearCombination<F>
impl<F: Field> Add<LinearCombination<F>> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§fn add(self, other: LinearCombination<F>) -> LinearCombination<F>
fn add(self, other: LinearCombination<F>) -> LinearCombination<F>
Performs the
+
operation. Read moreSource§impl<F: Field> Add<Variable> for LinearCombination<F>
impl<F: Field> Add<Variable> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
+
operator.Source§impl<F: Field> Add for LinearCombination<F>
impl<F: Field> Add for LinearCombination<F>
Source§impl<F: Field> AddAssign<(F, Variable)> for LinearCombination<F>
impl<F: Field> AddAssign<(F, Variable)> for LinearCombination<F>
Source§fn add_assign(&mut self, (coeff, var): (F, Variable))
fn add_assign(&mut self, (coeff, var): (F, Variable))
Performs the
+=
operation. Read moreSource§impl<F: Clone + Field> Clone for LinearCombination<F>
impl<F: Clone + Field> Clone for LinearCombination<F>
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: Field> Mul<F> for LinearCombination<F>
impl<F: Field> Mul<F> for LinearCombination<F>
Source§impl<F: Field> MulAssign<F> for LinearCombination<F>
impl<F: Field> MulAssign<F> for LinearCombination<F>
Source§fn mul_assign(&mut self, scalar: F)
fn mul_assign(&mut self, scalar: F)
Performs the
*=
operation. Read moreSource§impl<F: Field> Neg for LinearCombination<F>
impl<F: Field> Neg for LinearCombination<F>
Source§impl<F: Field> Sub<&LinearCombination<F>> for &LinearCombination<F>
impl<F: Field> Sub<&LinearCombination<F>> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, other: &LinearCombination<F>) -> LinearCombination<F>
fn sub(self, other: &LinearCombination<F>) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<'a, F: Field> Sub<&'a LinearCombination<F>> for LinearCombination<F>
impl<'a, F: Field> Sub<&'a LinearCombination<F>> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, other: &'a LinearCombination<F>) -> LinearCombination<F>
fn sub(self, other: &'a LinearCombination<F>) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<F: Field> Sub<(F, &LinearCombination<F>)> for &LinearCombination<F>
impl<F: Field> Sub<(F, &LinearCombination<F>)> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, (coeff, other): (F, &LinearCombination<F>)) -> LinearCombination<F>
fn sub(self, (coeff, other): (F, &LinearCombination<F>)) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<'a, F: Field> Sub<(F, &'a LinearCombination<F>)> for LinearCombination<F>
impl<'a, F: Field> Sub<(F, &'a LinearCombination<F>)> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(
self,
(coeff, other): (F, &'a LinearCombination<F>),
) -> LinearCombination<F>
fn sub( self, (coeff, other): (F, &'a LinearCombination<F>), ) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<F: Field> Sub<(F, LinearCombination<F>)> for &LinearCombination<F>
impl<F: Field> Sub<(F, LinearCombination<F>)> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, (coeff, other): (F, LinearCombination<F>)) -> LinearCombination<F>
fn sub(self, (coeff, other): (F, LinearCombination<F>)) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<F: Field> Sub<(F, LinearCombination<F>)> for LinearCombination<F>
impl<F: Field> Sub<(F, LinearCombination<F>)> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, (coeff, other): (F, LinearCombination<F>)) -> LinearCombination<F>
fn sub(self, (coeff, other): (F, LinearCombination<F>)) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<F: Field> Sub<LinearCombination<F>> for &LinearCombination<F>
impl<F: Field> Sub<LinearCombination<F>> for &LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, other: LinearCombination<F>) -> LinearCombination<F>
fn sub(self, other: LinearCombination<F>) -> LinearCombination<F>
Performs the
-
operation. Read moreSource§impl<F: Field> Sub<Variable> for LinearCombination<F>
impl<F: Field> Sub<Variable> for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§impl<F: Field> Sub for LinearCombination<F>
impl<F: Field> Sub for LinearCombination<F>
Source§type Output = LinearCombination<F>
type Output = LinearCombination<F>
The resulting type after applying the
-
operator.Source§fn sub(self, other: LinearCombination<F>) -> LinearCombination<F>
fn sub(self, other: LinearCombination<F>) -> LinearCombination<F>
Performs the
-
operation. Read moreimpl<F: Eq + Field> Eq for LinearCombination<F>
impl<F: Field> StructuralPartialEq for LinearCombination<F>
Auto Trait Implementations§
impl<F> Freeze for LinearCombination<F>
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,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.