Trait ark_r1cs_std::alloc::AllocVar [−][src]
pub trait AllocVar<V, F: Field> where
Self: Sized,
V: ?Sized, { fn new_variable<T: Borrow<V>>(
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> { ... } fn new_input<T: Borrow<V>>(
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> { ... } }
Expand description
Specifies how variables of type Self
should be allocated in a
ConstraintSystem
.
Required methods
fn new_variable<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
fn new_variable<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
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
.
Provided methods
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>
Allocates a new constant of type Self
in the ConstraintSystem
cs
.
This should not allocate any new variables or constraints in cs
.
fn new_input<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
fn new_input<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
Allocates a new public input of type Self
in the ConstraintSystem
cs
.
fn new_witness<T: Borrow<V>>(
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>
Allocates a new private witness of type Self
in the ConstraintSystem
cs
.
Implementations on Foreign Types
This blanket implementation just allocates variables in Self
element by element.
fn new_variable<T: Borrow<[I]>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
Implementors
impl<BF, P> AllocVar<CubicExtField<P>, <P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
for<'a> &'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
P: CubicExtVarParams<BF>,
impl<BF, P> AllocVar<QuadExtField<P>, <P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
for<'b> &'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
P: QuadExtVarParams<BF>,
impl<P, F> AllocVar<GroupAffine<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> AllocVar<GroupProjective<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> AllocVar<GroupAffine<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
P: TEModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField> + TwoBitLookupGadget<<P::BaseField as Field>::BasePrimeField, TableConstant = P::BaseField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> AllocVar<GroupProjective<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
P: TEModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField> + TwoBitLookupGadget<<P::BaseField as Field>::BasePrimeField, TableConstant = P::BaseField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P: Bls12Parameters> AllocVar<G1Prepared<P>, <P as Bls12Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G1PreparedVar<P>
impl<P: Bls12Parameters> AllocVar<G2Prepared<P>, <P as Bls12Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G2PreparedVar<P>
impl<P: MNT4Parameters> AllocVar<G1Prepared<P>, <P as MNT4Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G1PreparedVar<P>
impl<P: MNT4Parameters> AllocVar<G2Prepared<P>, <P as MNT4Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G2PreparedVar<P>
impl<P: MNT6Parameters> AllocVar<G1Prepared<P>, <P as MNT6Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G1PreparedVar<P>
impl<P: MNT6Parameters> AllocVar<G2Prepared<P>, <P as MNT6Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G2PreparedVar<P>