Struct decaf377::r1cs::element::ElementVar
source · pub struct ElementVar { /* private fields */ }
Expand description
Represents the R1CS equivalent of a decaf377::Element
Generally the suffix -Var
will indicate that the type or variable
represents in R1CS.
Implementations§
source§impl ElementVar
impl ElementVar
sourcepub fn compress_to_field(&self) -> Result<FqVar, SynthesisError>
pub fn compress_to_field(&self) -> Result<FqVar, SynthesisError>
R1CS equivalent of Element::vartime_compress_to_field
sourcepub fn decompress_from_field(s_var: FqVar) -> Result<ElementVar, SynthesisError>
pub fn decompress_from_field(s_var: FqVar) -> Result<ElementVar, SynthesisError>
R1CS equivalent of Encoding::vartime_decompress
sourcepub fn encode_to_curve(r_var: &FqVar) -> Result<ElementVar, SynthesisError>
pub fn encode_to_curve(r_var: &FqVar) -> Result<ElementVar, SynthesisError>
Maps a field element to a decaf377 ElementVar
suitable for CDH challenges.
Trait Implementations§
source§impl<'a> Add<&'a ElementVar> for ElementVar
impl<'a> Add<&'a ElementVar> for ElementVar
§type Output = ElementVar
type Output = ElementVar
The resulting type after applying the
+
operator.source§impl Add<Element> for ElementVar
impl Add<Element> for ElementVar
source§impl Add for ElementVar
impl Add for ElementVar
§type Output = ElementVar
type Output = ElementVar
The resulting type after applying the
+
operator.source§impl<'a> AddAssign<&'a ElementVar> for ElementVar
impl<'a> AddAssign<&'a ElementVar> for ElementVar
source§fn add_assign(&mut self, rhs: &'a ElementVar)
fn add_assign(&mut self, rhs: &'a ElementVar)
Performs the
+=
operation. Read moresource§impl AddAssign<Element> for ElementVar
impl AddAssign<Element> for ElementVar
source§fn add_assign(&mut self, rhs: Element)
fn add_assign(&mut self, rhs: Element)
Performs the
+=
operation. Read moresource§impl AddAssign for ElementVar
impl AddAssign for ElementVar
source§fn add_assign(&mut self, rhs: ElementVar)
fn add_assign(&mut self, rhs: ElementVar)
Performs the
+=
operation. Read moresource§impl AllocVar<AffineElement, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl AllocVar<AffineElement, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn new_variable<T: Borrow<AffineElement>>(
cs: impl Into<Namespace<Fq>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_variable<T: Borrow<AffineElement>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>
Allocates a new variable of type
Self
in the ConstraintSystem
cs
.
The mode of allocation is decided by mode
.§fn new_constant(
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>
fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>
source§impl AllocVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl AllocVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn new_variable<T: Borrow<Element>>(
cs: impl Into<Namespace<Fq>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_variable<T: Borrow<Element>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>
Allocates a new variable of type
Self
in the ConstraintSystem
cs
.
The mode of allocation is decided by mode
.§fn new_constant(
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>
fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>
source§impl AllocVar<Fp<MontBackend<FrConfig, 4>, 4>, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl AllocVar<Fp<MontBackend<FrConfig, 4>, 4>, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn new_variable<T: Borrow<Fq>>(
cs: impl Into<Namespace<Fq>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_variable<T: Borrow<Fq>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>
Allocates a new variable of type
Self
in the ConstraintSystem
cs
.
The mode of allocation is decided by mode
.§fn new_constant(
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>
fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>
source§impl Clone for ElementVar
impl Clone for ElementVar
source§fn clone(&self) -> ElementVar
fn clone(&self) -> ElementVar
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 CondSelectGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl CondSelectGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn conditionally_select(
cond: &Boolean<Fq>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>
fn conditionally_select( cond: &Boolean<Fq>, true_value: &Self, false_value: &Self ) -> Result<Self, SynthesisError>
§fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>
fn conditionally_select_power_of_two_vector( position: &[Boolean<ConstraintF>], values: &[Self] ) -> Result<Self, SynthesisError>
Returns an element of
values
whose index in represented by position
.
position
is an array of boolean that represents an unsigned integer in
big endian order. Read moresource§impl CurveVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl CurveVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn new_variable_omit_prime_order_check(
cs: impl Into<Namespace<Fq>>,
f: impl FnOnce() -> Result<Element, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_variable_omit_prime_order_check( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<Element, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>
Allocates a variable in the subgroup without checking if it’s in the
prime-order subgroup.
source§fn enforce_prime_order(&self) -> Result<(), SynthesisError>
fn enforce_prime_order(&self) -> Result<(), SynthesisError>
Enforce that
self
is in the prime-order subgroup.source§fn double_in_place(&mut self) -> Result<(), SynthesisError>
fn double_in_place(&mut self) -> Result<(), SynthesisError>
Sets
self = self + self
.§fn is_zero(&self) -> Result<Boolean<ConstraintF>, SynthesisError>
fn is_zero(&self) -> Result<Boolean<ConstraintF>, SynthesisError>
Returns a
Boolean
representing whether self == Self::zero()
.§fn scalar_mul_le<'a>(
&self,
bits: impl Iterator<Item = &'a Boolean<ConstraintF>>
) -> Result<Self, SynthesisError>
fn scalar_mul_le<'a>( &self, bits: impl Iterator<Item = &'a Boolean<ConstraintF>> ) -> Result<Self, SynthesisError>
Computes
bits * self
, where bits
is a little-endian
Boolean
representation of a scalar.§fn precomputed_base_scalar_mul_le<'a, I, B>(
&mut self,
scalar_bits_with_bases: I
) -> Result<(), SynthesisError>
fn precomputed_base_scalar_mul_le<'a, I, B>( &mut self, scalar_bits_with_bases: I ) -> Result<(), SynthesisError>
Computes a
I * self
in place, where I
is a Boolean
little-endian
representation of the scalar. Read more§fn precomputed_base_multiscalar_mul_le<'a, T, I, B>(
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError>
fn precomputed_base_multiscalar_mul_le<'a, T, I, B>( bases: &[B], scalars: I ) -> Result<Self, SynthesisError>
Computes
Σⱼ(scalarⱼ * baseⱼ)
for all j,
where scalarⱼ
is a Boolean
little-endian
representation of the j-th scalar.source§impl Debug for ElementVar
impl Debug for ElementVar
source§impl EqGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl EqGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn is_eq(&self, other: &Self) -> Result<Boolean<Fq>, SynthesisError>
fn is_eq(&self, other: &Self) -> Result<Boolean<Fq>, SynthesisError>
Output a
Boolean
value representing whether self.value() == other.value()
.source§fn conditional_enforce_equal(
&self,
other: &Self,
should_enforce: &Boolean<Fq>
) -> Result<(), SynthesisError>
fn conditional_enforce_equal( &self, other: &Self, should_enforce: &Boolean<Fq> ) -> Result<(), SynthesisError>
If
should_enforce == true
, enforce that self
and other
are equal;
else, enforce a vacuously true statement. Read moresource§fn conditional_enforce_not_equal(
&self,
other: &Self,
should_enforce: &Boolean<Fq>
) -> Result<(), SynthesisError>
fn conditional_enforce_not_equal( &self, other: &Self, should_enforce: &Boolean<Fq> ) -> Result<(), SynthesisError>
If
should_enforce == true
, enforce that self
and other
are not
equal; else, enforce a vacuously true statement. Read more§fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>
fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>
source§impl R1CSVar<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl R1CSVar<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§impl<'a> Sub<&'a ElementVar> for ElementVar
impl<'a> Sub<&'a ElementVar> for ElementVar
§type Output = ElementVar
type Output = ElementVar
The resulting type after applying the
-
operator.source§impl Sub<Element> for ElementVar
impl Sub<Element> for ElementVar
source§impl Sub for ElementVar
impl Sub for ElementVar
§type Output = ElementVar
type Output = ElementVar
The resulting type after applying the
-
operator.source§impl<'a> SubAssign<&'a ElementVar> for ElementVar
impl<'a> SubAssign<&'a ElementVar> for ElementVar
source§fn sub_assign(&mut self, rhs: &'a ElementVar)
fn sub_assign(&mut self, rhs: &'a ElementVar)
Performs the
-=
operation. Read moresource§impl SubAssign<Element> for ElementVar
impl SubAssign<Element> for ElementVar
source§fn sub_assign(&mut self, rhs: Element)
fn sub_assign(&mut self, rhs: Element)
Performs the
-=
operation. Read moresource§impl SubAssign for ElementVar
impl SubAssign for ElementVar
source§fn sub_assign(&mut self, rhs: ElementVar)
fn sub_assign(&mut self, rhs: ElementVar)
Performs the
-=
operation. Read moresource§impl ToBitsGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl ToBitsGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
source§fn to_bits_le(&self) -> Result<Vec<Boolean<Fq>>, SynthesisError>
fn to_bits_le(&self) -> Result<Vec<Boolean<Fq>>, SynthesisError>
Outputs the canonical little-endian bit-wise representation of
self
. Read more§fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
Outputs a possibly non-unique little-endian bit-wise representation of
self
. Read more§fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
Outputs the canonical big-endian bit-wise representation of
self
.§fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>
Outputs a possibly non-unique big-endian bit-wise representation of
self
.source§impl ToBytesGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl ToBytesGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar
impl<'a> GroupOpsBounds<'a, Element, ElementVar> for ElementVar
Auto Trait Implementations§
impl !Freeze for ElementVar
impl !RefUnwindSafe for ElementVar
impl !Send for ElementVar
impl !Sync for ElementVar
impl Unpin for ElementVar
impl !UnwindSafe for ElementVar
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