pub struct AllocatedNonNativeFieldVar<TargetField: PrimeField, BaseField: PrimeField> {
    pub cs: ConstraintSystemRef<BaseField>,
    pub limbs: Vec<FpVar<BaseField>>,
    pub num_of_additions_over_normal_form: BaseField,
    pub is_in_the_normal_form: bool,
    /* private fields */
}
Expand description

The allocated version of NonNativeFieldVar (introduced below)

Fields§

§cs: ConstraintSystemRef<BaseField>

Constraint system reference

§limbs: Vec<FpVar<BaseField>>

The limbs, each of which is a BaseField gadget.

§num_of_additions_over_normal_form: BaseField

Number of additions done over this gadget, using which the gadget decides when to reduce.

§is_in_the_normal_form: bool

Whether the limb representation is the normal form (using only the bits specified in the parameters, and the representation is strictly within the range of TargetField).

Implementations§

Return cs

Obtain the value of limbs

Obtain the value of a nonnative field element

Obtain the nonnative field element of a constant value

Obtain the nonnative field element of one

Obtain the nonnative field element of zero

Add a nonnative field element

Add a constant

Subtract a nonnative field element, without the final reduction step

Subtract a nonnative field element

Subtract a constant

Multiply a nonnative field element

Multiply a constant

Compute the negate of a nonnative field element

Compute the inverse of a nonnative field element

Convert a TargetField element into limbs (not constraints) This is an internal function that would be reused by a number of other functions

Obtain the limbs directly from a big int

for advanced use, multiply and output the intermediate representations (without reduction) This intermediate representations can be added with each other, and they can later be reduced back to the NonNativeFieldVar.

Allocates a new non-native field witness with value given by the function f. Enforces that the field element has value in [0, modulus), and returns the bits of its binary representation. The bits are in little-endian (i.e., the bit at index 0 is the LSB) and the bit-vector is empty in non-witness allocation modes.

Trait Implementations§

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
Allocates a new constant of type Self in the ConstraintSystem cs. Read more
Allocates a new public input of type Self in the ConstraintSystem cs.
Allocates a new private witness of type Self in the ConstraintSystem cs.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
If cond == &Boolean::TRUE, then this returns true_value; else, returns false_value. Read more
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 more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
The type of values being looked up.
Interprets the slice bits as a two-bit integer b = bits[0] + (bits[1] << 1), and then outputs constants[b] * c, where c = if bits[2] { -1 } else { 1 };. Read more
Outputs the canonical little-endian bit-wise representation of self. Read more
Outputs a possibly non-unique little-endian bit-wise representation of self. Read more
Outputs the canonical big-endian bit-wise representation of self.
Outputs a possibly non-unique big-endian bit-wise representation of self.
Outputs a canonical, little-endian, byte decomposition of self. Read more
Outputs a possibly non-unique byte decomposition of self. Read more
Converts self to FpVar<ConstraintF> variables.
The type of values being looked up.
Interprets the slice bits as a two-bit integer b = bits[0] + (bits[1] << 1), and then outputs constants[b]. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more