pub enum MulResultVar<TargetF: PrimeField, BaseF: PrimeField> {
Constant(TargetF),
Var(AllocatedMulResultVar<TargetF, BaseF>),
}
Expand description
An intermediate representation especially for the result of a multiplication, containing more limbs. It is intended for advanced usage to improve the efficiency.
That is, instead of calling mul
, one can call mul_without_reduce
to
obtain this intermediate representation, which can still be added.
Then, one can call reduce
to reduce it back to EmulatedFpVar
.
This may help cut the number of reduce operations.
Variants§
Implementations§
Source§impl<TargetF: PrimeField, BaseF: PrimeField> MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> MulResultVar<TargetF, BaseF>
Sourcepub fn reduce(&self) -> R1CSResult<EmulatedFpVar<TargetF, BaseF>>
pub fn reduce(&self) -> R1CSResult<EmulatedFpVar<TargetF, BaseF>>
Reduce the MulResultVar
back to EmulatedFpVar
Trait Implementations§
Source§impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<&'a MulResultVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<&'a MulResultVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
Source§type Output = MulResultVar<TargetF, BaseF>
type Output = MulResultVar<TargetF, BaseF>
The resulting type after applying the
+
operator.Source§impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<MulResultVar<TargetF, BaseF>> for &'a MulResultVar<TargetF, BaseF>
impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<MulResultVar<TargetF, BaseF>> for &'a MulResultVar<TargetF, BaseF>
Source§type Output = MulResultVar<TargetF, BaseF>
type Output = MulResultVar<TargetF, BaseF>
The resulting type after applying the
+
operator.Source§impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<TargetF> for &'a MulResultVar<TargetF, BaseF>
impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add<TargetF> for &'a MulResultVar<TargetF, BaseF>
Source§impl<TargetF: PrimeField, BaseF: PrimeField> Add<TargetF> for MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> Add<TargetF> for MulResultVar<TargetF, BaseF>
Source§impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add for &'a MulResultVar<TargetF, BaseF>
impl<'a, TargetF: PrimeField, BaseF: PrimeField> Add for &'a MulResultVar<TargetF, BaseF>
Source§type Output = MulResultVar<TargetF, BaseF>
type Output = MulResultVar<TargetF, BaseF>
The resulting type after applying the
+
operator.Source§impl<TargetF: PrimeField, BaseF: PrimeField> Add for MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> Add for MulResultVar<TargetF, BaseF>
Source§type Output = MulResultVar<TargetF, BaseF>
type Output = MulResultVar<TargetF, BaseF>
The resulting type after applying the
+
operator.Source§impl<'a, TargetF: PrimeField, BaseF: PrimeField> AddAssign<&'a MulResultVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
impl<'a, TargetF: PrimeField, BaseF: PrimeField> AddAssign<&'a MulResultVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
Source§fn add_assign(&mut self, other: &'a MulResultVar<TargetF, BaseF>)
fn add_assign(&mut self, other: &'a MulResultVar<TargetF, BaseF>)
Performs the
+=
operation. Read moreSource§impl<TargetF: PrimeField, BaseF: PrimeField> AddAssign<TargetF> for MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> AddAssign<TargetF> for MulResultVar<TargetF, BaseF>
Source§fn add_assign(&mut self, other: TargetF)
fn add_assign(&mut self, other: TargetF)
Performs the
+=
operation. Read moreSource§impl<TargetF: PrimeField, BaseF: PrimeField> AddAssign for MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> AddAssign for MulResultVar<TargetF, BaseF>
Source§fn add_assign(&mut self, other: MulResultVar<TargetF, BaseF>)
fn add_assign(&mut self, other: MulResultVar<TargetF, BaseF>)
Performs the
+=
operation. Read moreSource§impl<TargetF: Debug + PrimeField, BaseF: Debug + PrimeField> Debug for MulResultVar<TargetF, BaseF>
impl<TargetF: Debug + PrimeField, BaseF: Debug + PrimeField> Debug for MulResultVar<TargetF, BaseF>
Source§impl<TargetF: PrimeField, BaseF: PrimeField> From<&EmulatedFpVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
impl<TargetF: PrimeField, BaseF: PrimeField> From<&EmulatedFpVar<TargetF, BaseF>> for MulResultVar<TargetF, BaseF>
Source§fn from(src: &EmulatedFpVar<TargetF, BaseF>) -> Self
fn from(src: &EmulatedFpVar<TargetF, BaseF>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<TargetF, BaseF> Freeze for MulResultVar<TargetF, BaseF>
impl<TargetF, BaseF> !RefUnwindSafe for MulResultVar<TargetF, BaseF>
impl<TargetF, BaseF> !Send for MulResultVar<TargetF, BaseF>
impl<TargetF, BaseF> !Sync for MulResultVar<TargetF, BaseF>
impl<TargetF, BaseF> Unpin for MulResultVar<TargetF, BaseF>
impl<TargetF, BaseF> !UnwindSafe for MulResultVar<TargetF, BaseF>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more