Struct boojum::gadgets::num::Num

source ·
pub struct Num<F: SmallField> { /* private fields */ }

Implementations§

source§

impl<F: SmallField> Num<F>

source

pub const fn get_variable(&self) -> Variable

source

pub const fn from_variable(var: Variable) -> Self

source

pub fn allocated_constant<CS: ConstraintSystem<F>>( cs: &mut CS, constant: F, ) -> Self

source

pub fn zero<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source

pub fn is_zero<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Boolean<F>

source

pub fn add<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self

source

pub fn sub<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self

source

pub fn mul<CS: ConstraintSystem<F>>(&self, cs: &mut CS, other: &Self) -> Self

source

pub fn spread_into_bits<CS: ConstraintSystem<F>, const LIMIT: usize>( &self, cs: &mut CS, ) -> [Boolean<F>; LIMIT]

source

pub fn enforce_equal<CS: ConstraintSystem<F>>(cs: &mut CS, a: &Self, b: &Self)

source

pub fn mask<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self

source

pub fn mask_negated<CS: ConstraintSystem<F>>( &self, cs: &mut CS, masking_bit: Boolean<F>, ) -> Self

source

pub fn constraint_bit_length_as_bytes<CS: ConstraintSystem<F>>( &self, cs: &mut CS, length: usize, ) -> ArrayVec<UInt8<F>, 8>

source

pub fn linear_combination<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], ) -> Self

source

pub fn enforce_zero_for_linear_combination<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], )

source

pub fn enforce_zero_for_linear_combination_ext<CS: ConstraintSystem<F>>( _cs: &mut CS, _input: &[(Variable, F)], _extra: Option<(Variable, F)>, )

source

pub fn enforce_linear_combination_converge_into<CS: ConstraintSystem<F>>( cs: &mut CS, input: &[(Variable, F)], extra: Option<(Variable, F)>, final_var: Variable, )

source

pub fn equals<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, ) -> Boolean<F>

source

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]

source

pub fn conditionally_enforce_equal<CS: ConstraintSystem<F>>( cs: &mut CS, should_enforce: Boolean<F>, a: &Self, b: &Self, )

source

pub fn fma<CS: ConstraintSystem<F>>( cs: &mut CS, a: &Self, b: &Self, quadratic_coeff: &F, c: &Self, linear_coeff: &F, ) -> Self

source

pub fn inverse_unchecked<CS: ConstraintSystem<F>>(&self, cs: &mut CS) -> Self

source

pub fn conditionally_swap<CS: ConstraintSystem<F>>( cs: &mut CS, should_swap: Boolean<F>, a: &Self, b: &Self, ) -> (Self, Self)

source

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>

source§

type Witness = F

source§

fn placeholder_witness() -> Self::Witness

source§

fn allocate_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source§

fn allocate<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self

source§

fn allocate_constant<CS: ConstraintSystem<F>>( cs: &mut CS, witness: Self::Witness, ) -> Self

source§

impl<F: SmallField> CSAllocatableExt<F> for Num<F>

source§

const INTERNAL_STRUCT_LEN: usize = 1usize

source§

fn witness_from_set_of_values(values: [F; 1]) -> Self::Witness

source§

fn create_without_value<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source§

fn flatten_as_variables(&self) -> [Variable; 1]
where [(); 1]:,

source§

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>

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>

source§

type CircuitOutput = [Num<F>; 4]

source§

fn new<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self

source§

fn placeholder_output<CS: ConstraintSystem<F>>( cs: &mut CS, ) -> Self::CircuitOutput

source§

fn accumulate_into_leaf<CS: ConstraintSystem<F>>( &mut self, cs: &mut CS, value: &Num<F>, )

source§

fn finalize_into_leaf_hash_and_reset<CS: ConstraintSystem<F>>( &mut self, cs: &mut CS, ) -> Self::CircuitOutput

source§

fn hash_into_leaf<'a, S: IntoIterator<Item = &'a Num<F>>, CS: ConstraintSystem<F>>( cs: &mut CS, source: S, ) -> Self::CircuitOutput
where Num<F>: 'a,

source§

fn hash_into_leaf_owned<S: IntoIterator<Item = Num<F>>, CS: ConstraintSystem<F>>( cs: &mut CS, source: S, ) -> Self::CircuitOutput

source§

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)

source§

fn hash_into_node<CS: ConstraintSystem<F>>( cs: &mut CS, left: &Self::CircuitOutput, right: &Self::CircuitOutput, _depth: usize, ) -> Self::CircuitOutput

source§

fn select_cap_node<CS: ConstraintSystem<F>>( cs: &mut CS, cap_bits: &[Boolean<F>], cap: &[Self::CircuitOutput], ) -> Self::CircuitOutput

source§

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>

source§

impl<F: SmallField> Clone for Num<F>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: SmallField> Debug for Num<F>

source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: SmallField, CS: ConstraintSystem<F>> From<Num<F>> for NumAsFieldWrapper<F, CS>

source§

fn from(value: Num<F>) -> Self

Converts to this type from the input type.
source§

impl<F: SmallField> Hash for Num<F>

source§

fn hash<__HF>(&self, __state: &mut __HF)
where __HF: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<F: SmallField> PartialEq for Num<F>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl RecursiveTreeHasher<GoldilocksField, Num<GoldilocksField>> for CircuitGoldilocksPoseidon2Sponge

source§

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

Selects a if flag is true, and b otherwise
source§

const 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]

Selects a if flag is true, and b otherwise
source§

fn 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>

source§

fn witness_hook<CS: ConstraintSystem<F>>( &self, cs: &CS, ) -> Box<dyn FnOnce() -> Option<Self::Witness>>

source§

impl<F: SmallField> WitnessVarLengthEncodable<F> for Num<F>

source§

fn witness_encoding_length(_witness: &Self::Witness) -> usize

source§

fn encode_witness_to_buffer(witness: &Self::Witness, dst: &mut Vec<F>)

source§

impl<F: SmallField> Copy for Num<F>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> PipeOp<T> for T

source§

fn to<F, U>(self, f: F) -> U
where F: FnOnce(T) -> U,

source§

fn op<F>(self, f: F) -> T
where F: FnOnce(&mut T),

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V