pub struct PolyElement {
coeffs: [u32; 17],
curve: Curve,
}Expand description
A field element in redundant polynomial form.
Each coefficient c[i] holds up to COEFF_BITS bits.
The integer value is sum(c[i] * 2^(i * WORD_BITS)) for i in 0..NUM_COEFFS.
Fields§
§coeffs: [u32; 17]§curve: CurveImplementations§
Source§impl PolyElement
impl PolyElement
Sourcepub fn from_coeffs(coeffs: [u32; 17], curve: Curve) -> Result<Self, Error>
pub fn from_coeffs(coeffs: [u32; 17], curve: Curve) -> Result<Self, Error>
Constructs a polynomial element from an array of coefficients.
Each coefficient must fit in COEFF_BITS bits.
§Errors
Returns Error::OutOfRange if any coefficient exceeds the bit width.
Sourcepub fn from_field(fe: FieldElement) -> Self
pub fn from_field(fe: FieldElement) -> Self
Converts a FieldElement into polynomial form.
Extracts WORD_BITS-wide chunks from the integer representation.
Sourcepub fn to_field(self) -> Result<FieldElement, Error>
pub fn to_field(self) -> Result<FieldElement, Error>
Converts back to a FieldElement.
Performs carry propagation and modular reduction.
§Errors
Returns Error::OutOfRange if the polynomial’s value exceeds the modulus.
Sourcepub fn add_no_reduce(self, rhs: Self) -> Self
pub fn add_no_reduce(self, rhs: Self) -> Self
Coefficient-wise addition without carry propagation.
This is the hardware-friendly operation: coefficients may
temporarily exceed WORD_BITS, using the redundant bit.
Trait Implementations§
Source§impl Clone for PolyElement
impl Clone for PolyElement
Source§fn clone(&self) -> PolyElement
fn clone(&self) -> PolyElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more