pub struct Num<F: SmallField> { /* private fields */ }
Implementations§
source§impl<F: SmallField> Num<F>
impl<F: SmallField> Num<F>
pub const fn get_variable(&self) -> Variable
pub const fn from_variable(var: Variable) -> Self
pub fn allocated_constant<CS: ConstraintSystem<F>>( cs: &mut CS, constant: F, ) -> Self
pub fn zero<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
pub fn is_zero<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Boolean<F>
pub fn add<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self
pub fn sub<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self
pub fn mul<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self
pub fn spread_into_bits<CS: ConstraintSystem<F>, const LIMIT: usize>( &self, cs: &mut CS, ) -> [Boolean<F>; LIMIT]
pub fn enforce_equal<CS: ConstraintSystem<F>>(cs: &mut CS, a: &Self, b: &Self)
pub fn mask<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self
pub fn mask_negated<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self
pub fn constraint_bit_length_as_bytes<CS: ConstraintSystem<F>>( &self, cs: &mut CS, length: usize, ) -> ArrayVec<UInt8<F>, 8>
pub fn linear_combination<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], ) -> Self
pub fn enforce_zero_for_linear_combination<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], )
pub fn enforce_zero_for_linear_combination_ext<CS: ConstraintSystem<F>>( _cs: &mut CS, _input: &[(Variable, F)], _extra: Option<(Variable, F)>, )
pub fn enforce_linear_combination_converge_into<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], extra: Option<(Variable, F)>, final_var: Variable, )
pub fn equals<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, ) -> Boolean<F>
pub fn allocate_multiple_from_closure_and_dependencies<CS: ConstraintSystem<F>, const N: usize, FN: FnOnce(&[F]) -> [F; N] + 'static + Send + Sync>( cs: &mut CS, witness_closure: FN, dependencies: &[Place], ) -> [Self; N]
pub fn conditionally_enforce_equal<CS: ConstraintSystem<F>>( cs: &mut CS, should_enforce: Boolean<F>, a: &Self, b: &Self, )
pub fn fma<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, quadratic_coeff: &F, c: &Self, linear_coeff: &F, ) -> Self
pub fn inverse_unchecked<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Self
pub fn conditionally_swap<CS: ConstraintSystem<F>>( cs: &mut CS, should_swap: Boolean<F>, a: &Self, b: &Self, ) -> (Self, Self)
pub fn conditionally_swap_multiple<CS: ConstraintSystem<F>, const N: usize>( cs: &mut CS, should_swap: Boolean<F>, a: &[Self; N], b: &[Self; N], ) -> ([Self; N], [Self; N])
Trait Implementations§
source§impl<F: SmallField> CSAllocatable<F> for Num<F>
impl<F: SmallField> CSAllocatable<F> for Num<F>
type Witness = F
fn placeholder_witness() -> Self::Witness
fn allocate_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
fn allocate<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self
fn allocate_constant<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self
source§impl<F: SmallField> CSAllocatableExt<F> for Num<F>
impl<F: SmallField> CSAllocatableExt<F> for Num<F>
const INTERNAL_STRUCT_LEN: usize = 1usize
fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness
fn create_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
fn flatten_as_variables(&self) -> [Variable; 1]
source§fn set_internal_variables_values(
witness: Self::Witness,
dst: &mut DstBuffer<'_, '_, F>,
)
fn set_internal_variables_values( witness: Self::Witness, dst: &mut DstBuffer<'_, '_, F>, )
NOTE: implementations SHOULD EXTEND/PUSH to buffer, so recursive composition is available
source§impl<F: SmallField> CSWitnessable<F, 1> for Num<F>
impl<F: SmallField> CSWitnessable<F, 1> for Num<F>
type ConversionFunction = Convertor<F, [F; 1], F>
fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness
fn as_variables_set(&self) -> [Variable; 1]
fn get_witness<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> WitnessValue<F, Self::Witness, N, CS::WitnessSource, Self::ConversionFunction>
source§impl<F: SmallField, const AW: usize, const SW: usize, const CW: usize, R: CircuitRoundFunction<F, AW, SW, CW>, const ABSORB_BY_REPLACEMENT: bool> CircuitTreeHasher<F, Num<F>> for CircuitSimpleAlgebraicSponge<F, AW, SW, CW, R, ABSORB_BY_REPLACEMENT>
impl<F: SmallField, const AW: usize, const SW: usize, const CW: usize, R: CircuitRoundFunction<F, AW, SW, CW>, const ABSORB_BY_REPLACEMENT: bool> CircuitTreeHasher<F, Num<F>> for CircuitSimpleAlgebraicSponge<F, AW, SW, CW, R, ABSORB_BY_REPLACEMENT>
type CircuitOutput = [Num<F>; 4]
fn new<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self
fn placeholder_output<CS: ConstraintSystem<F>>( cs: &mut CS, ) -> Self::CircuitOutput
fn accumulate_into_leaf<CS: ConstraintSystem<F>>( &mut self, cs: &mut CS, value: &Num<F>, )
fn finalize_into_leaf_hash_and_reset<CS: ConstraintSystem<F>>( &mut self, cs: &mut CS, ) -> Self::CircuitOutput
fn hash_into_leaf<'a, S: IntoIterator<Item = &'a Num<F>>, CS: ConstraintSystem<F>>(
cs: &mut CS,
source: S,
) -> Self::CircuitOutputwhere
Num<F>: 'a,
fn hash_into_leaf_owned<S: IntoIterator<Item = Num<F>>, CS: ConstraintSystem<F>>( cs: &mut CS, source: S, ) -> Self::CircuitOutput
fn swap_nodes<CS: ConstraintSystem<F>>( cs: &mut CS, should_swap: Boolean<F>, left: &Self::CircuitOutput, right: &Self::CircuitOutput, _depth: usize, ) -> (Self::CircuitOutput, Self::CircuitOutput)
fn hash_into_node<CS: ConstraintSystem<F>>( cs: &mut CS, left: &Self::CircuitOutput, right: &Self::CircuitOutput, _depth: usize, ) -> Self::CircuitOutput
fn select_cap_node<CS: ConstraintSystem<F>>( cs: &mut CS, cap_bits: &[Boolean<F>], cap: &[Self::CircuitOutput], ) -> Self::CircuitOutput
fn compare_output<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self::CircuitOutput, b: &Self::CircuitOutput, ) -> Boolean<F>
source§impl<F: SmallField> CircuitVarLengthEncodable<F> for Num<F>
impl<F: SmallField> CircuitVarLengthEncodable<F> for Num<F>
fn encoding_length(&self) -> usize
fn encode_to_buffer<CS: ConstraintSystem<F>>( &self, _cs: &mut CS, dst: &mut Vec<Variable>, )
source§impl<F: SmallField> Clone for Num<F>
impl<F: SmallField> Clone for Num<F>
source§impl<F: SmallField> Debug for Num<F>
impl<F: SmallField> Debug for Num<F>
source§impl<F: SmallField, CS: ConstraintSystem<F>> From<Num<F>> for NumAsFieldWrapper<F, CS>
impl<F: SmallField, CS: ConstraintSystem<F>> From<Num<F>> for NumAsFieldWrapper<F, CS>
source§impl<F: SmallField> Hash for Num<F>
impl<F: SmallField> Hash for Num<F>
source§impl<F: SmallField> PartialEq for Num<F>
impl<F: SmallField> PartialEq for Num<F>
source§impl RecursiveTreeHasher<GoldilocksField, Num<GoldilocksField>> for CircuitGoldilocksPoseidon2Sponge
impl RecursiveTreeHasher<GoldilocksField, Num<GoldilocksField>> for CircuitGoldilocksPoseidon2Sponge
source§impl<F: SmallField> Selectable<F> for Num<F>
impl<F: SmallField> Selectable<F> for Num<F>
source§fn conditionally_select<CS: ConstraintSystem<F>>(
cs: &mut CS,
flag: Boolean<F>,
a: &Self,
b: &Self,
) -> Self
fn conditionally_select<CS: ConstraintSystem<F>>( cs: &mut CS, flag: Boolean<F>, a: &Self, b: &Self, ) -> Self
Selects
a
if flag
is true
, and b
otherwiseconst SUPPORTS_PARALLEL_SELECT: bool = true
source§fn parallel_select<CS: ConstraintSystem<F>, const N: usize>(
cs: &mut CS,
flag: Boolean<F>,
a: &[Self; N],
b: &[Self; N],
) -> [Self; N]
fn parallel_select<CS: ConstraintSystem<F>, const N: usize>( cs: &mut CS, flag: Boolean<F>, a: &[Self; N], b: &[Self; N], ) -> [Self; N]
Selects
a
if flag
is true
, and b
otherwisefn select_from_chain<CS: ConstraintSystem<F>>( cs: &mut CS, baseline: &Self, candidates: impl Iterator<Item = (Boolean<F>, Self)>, length: usize, ) -> Self
source§impl<F: SmallField> WitnessHookable<F> for Num<F>
impl<F: SmallField> WitnessHookable<F> for Num<F>
fn witness_hook<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> Box<dyn FnOnce() -> Option<Self::Witness>>
source§impl<F: SmallField> WitnessVarLengthEncodable<F> for Num<F>
impl<F: SmallField> WitnessVarLengthEncodable<F> for Num<F>
fn witness_encoding_length(_witness: &Self::Witness) -> usize
fn encode_witness_to_buffer(witness: &Self::Witness, dst: &mut Vec<F>)
impl<F: SmallField> Copy for Num<F>
impl<F: SmallField> Eq for Num<F>
Auto Trait Implementations§
impl<F> Freeze for Num<F>
impl<F> RefUnwindSafe for Num<F>where
F: RefUnwindSafe,
impl<F> Send for Num<F>
impl<F> Sync for Num<F>
impl<F> Unpin for Num<F>where
F: Unpin,
impl<F> UnwindSafe for Num<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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