Struct ark_r1cs_std::fields::fp::AllocatedFp [−][src]
Represents a variable in the constraint system whose value can be an arbitrary field element.
Fields
variable: VariableThe allocated variable corresponding to self in self.cs.
cs: ConstraintSystemRef<F>The constraint system that self was allocated in.
Implementations
impl<F: PrimeField> AllocatedFp<F>[src]
pub fn new(
value: Option<F>,
variable: Variable,
cs: ConstraintSystemRef<F>
) -> Self[src]
value: Option<F>,
variable: Variable,
cs: ConstraintSystemRef<F>
) -> Self
Constructs a new AllocatedFp from a (optional) value, a low-level
Variable, and a ConstraintSystemRef.
impl<F: PrimeField> AllocatedFp<F>[src]
pub fn from(other: Boolean<F>) -> Self[src]
Constructs Self from a Boolean: if other is false, this outputs
zero, else it outputs one.
pub fn value(&self) -> Result<F, SynthesisError>[src]
Returns the value assigned to self in the underlying constraint system
(if a value was assigned).
pub fn add(&self, other: &Self) -> Self[src]
Outputs self + other.
This does not create any constraints.
pub fn sub(&self, other: &Self) -> Self[src]
Outputs self - other.
This does not create any constraints.
pub fn mul(&self, other: &Self) -> Self[src]
Outputs self * other.
This requires one constraint.
pub fn add_constant(&self, other: F) -> Self[src]
Output self + other
This does not create any constraints.
pub fn sub_constant(&self, other: F) -> Self[src]
Output self - other
This does not create any constraints.
pub fn mul_constant(&self, other: F) -> Self[src]
Output self * other
This does not create any constraints.
pub fn double(&self) -> Result<Self, SynthesisError>[src]
Output self + self
This does not create any constraints.
pub fn negate(&self) -> Self[src]
Output -self
This does not create any constraints.
pub fn negate_in_place(&mut self) -> &mut Self[src]
Sets self = -self
This does not create any constraints.
pub fn square(&self) -> Result<Self, SynthesisError>[src]
Outputs self * self
This requires one constraint.
pub fn inverse(&self) -> Result<Self, SynthesisError>[src]
Outputs result such that result * self = 1.
This requires one constraint.
pub fn frobenius_map(&self, _: usize) -> Result<Self, SynthesisError>[src]
This is a no-op for prime fields.
pub fn mul_equals(
&self,
other: &Self,
result: &Self
) -> Result<(), SynthesisError>[src]
&self,
other: &Self,
result: &Self
) -> Result<(), SynthesisError>
Enforces that self * other = result.
This requires one constraint.
pub fn square_equals(&self, result: &Self) -> Result<(), SynthesisError>[src]
Enforces that self * self = result.
This requires one constraint.
pub fn is_eq(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>[src]
Outputs the bit self == other.
This requires three constraints.
pub fn is_neq(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>[src]
Outputs the bit self != other.
This requires three constraints.
pub fn conditional_enforce_equal(
&self,
other: &Self,
should_enforce: &Boolean<F>
) -> Result<(), SynthesisError>[src]
&self,
other: &Self,
should_enforce: &Boolean<F>
) -> Result<(), SynthesisError>
Enforces that self == other if should_enforce.is_eq(&Boolean::TRUE).
This requires one constraint.
pub fn conditional_enforce_not_equal(
&self,
other: &Self,
should_enforce: &Boolean<F>
) -> Result<(), SynthesisError>[src]
&self,
other: &Self,
should_enforce: &Boolean<F>
) -> Result<(), SynthesisError>
Enforces that self != other if should_enforce.is_eq(&Boolean::TRUE).
This requires one constraint.
Trait Implementations
impl<F: PrimeField> AllocVar<F, F> for AllocatedFp<F>[src]
fn new_variable<T: Borrow<F>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_constant(
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>
fn new_input<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
fn new_witness<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
impl<F: Clone + PrimeField> Clone for AllocatedFp<F>[src]
fn clone(&self) -> AllocatedFp<F>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<F: PrimeField> CondSelectGadget<F> for AllocatedFp<F>[src]
fn conditionally_select(
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>[src]
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>
fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>[src]
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>
impl<F: Debug + PrimeField> Debug for AllocatedFp<F>[src]
impl<F: PrimeField> From<AllocatedFp<F>> for FpVar<F>[src]
fn from(other: AllocatedFp<F>) -> Self[src]
impl<F: PrimeField> ThreeBitCondNegLookupGadget<F> for AllocatedFp<F>[src]
type TableConstant = F
The type of values being looked up.
fn three_bit_cond_neg_lookup(
b: &[Boolean<F>],
b0b1: &Boolean<F>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]
b: &[Boolean<F>],
b0b1: &Boolean<F>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>
impl<F: PrimeField> ToBitsGadget<F> for AllocatedFp<F>[src]
fn to_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>[src]
Outputs the unique bit-wise decomposition of self in little-endian
form.
This method enforces that the output is in the field, i.e.
it invokes Boolean::enforce_in_field_le on the bit decomposition.
fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>[src]
fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>[src]
fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>[src]
impl<F: PrimeField> ToBytesGadget<F> for AllocatedFp<F>[src]
fn to_bytes(&self) -> Result<Vec<UInt8<F>>, SynthesisError>[src]
Outputs the unique byte decomposition of self in little-endian
form.
This method enforces that the decomposition represents
an integer that is less than F::MODULUS.
fn to_non_unique_bytes(&self) -> Result<Vec<UInt8<F>>, SynthesisError>[src]
impl<F: PrimeField> ToConstraintFieldGadget<F> for AllocatedFp<F>[src]
fn to_constraint_field(&self) -> Result<Vec<FpVar<F>>, SynthesisError>[src]
impl<F: PrimeField> TwoBitLookupGadget<F> for AllocatedFp<F>[src]
Uses two bits to perform a lookup into a table
b is little-endian: b[0] is LSB.
type TableConstant = F
The type of values being looked up.
fn two_bit_lookup(
b: &[Boolean<F>],
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]
b: &[Boolean<F>],
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>
Auto Trait Implementations
impl<F> !RefUnwindSafe for AllocatedFp<F>
impl<F> !Send for AllocatedFp<F>
impl<F> !Sync for AllocatedFp<F>
impl<F> Unpin for AllocatedFp<F> where
F: Unpin,
F: Unpin,
impl<F> !UnwindSafe for AllocatedFp<F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,