Skip to main content

DynamicPolynomialConfig

Struct DynamicPolynomialConfig 

Source
pub struct DynamicPolynomialConfig<'a, S: SemiringConfig> {
    pub cfg: &'a S,
}
Expand description

Configuration of the polynomial semiring $S[X]$ over the (semi)ring configured by S, with DynamicPolynomial as its element.

Implements exactly the layer its coefficients provide: [SemiringConfig] over a semiring, additionally [RingConfig] over a ring. The polynomial ring is never a field, hence no [FieldConfig].

Checked operations delegate to the coefficient config’s checked operations, so overflow behavior follows the coefficients (e.g. Int coefficients can overflow, field coefficients cannot).

Fields§

§cfg: &'a S

Implementations§

Source§

impl<'a, S: SemiringConfig> DynamicPolynomialConfig<'a, S>

Source

pub fn new_trimmed( &self, coeffs: impl AsRef<[S::Element]>, ) -> DynamicPolynomial<S::Element>

Create a new polynomial with the given coefficients, trimming the leading zeros.

Source

pub fn degree(&self, poly: &DynamicPolynomial<S::Element>) -> Option<usize>

Source

pub fn trim(&self, poly: &mut DynamicPolynomial<S::Element>)

Source

pub fn evaluate_at_point( &self, poly: &DynamicPolynomial<S::Element>, point: &S::Element, ) -> Result<S::Element, EvaluationError>

Evaluate the polynomial at the given point using Horner’s method.

Source

pub fn checked_evaluate_at_point( &self, poly: &DynamicPolynomial<S::Element>, point: &S::Element, ) -> Result<S::Element, EvaluationError>

Evaluate the polynomial at the given point using Horner’s method, with overflow-checked coefficient operations.

Source

pub fn rotate_right<const D: usize>( &self, poly: &DynamicPolynomial<S::Element>, c: usize, ) -> DynamicPolynomial<S::Element>

Right-rotate the coefficient vector by c positions within width D.

The output coefficient at position i is the input coefficient at (i + c) mod D. Missing coefficients are padded with zero before the rotation.

Source

pub fn shr<const D: usize>( &self, poly: &DynamicPolynomial<S::Element>, c: usize, ) -> DynamicPolynomial<S::Element>

Right-shift the coefficient vector by c positions within width D.

The output coefficient at position i is the input coefficient at i + c, or zero when that index is outside width D. Missing coefficients are padded with zero before the shift.

Trait Implementations§

Source§

impl<'a, S: Clone + SemiringConfig> Clone for DynamicPolynomialConfig<'a, S>

Source§

fn clone(&self) -> DynamicPolynomialConfig<'a, S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, S: Debug + SemiringConfig> Debug for DynamicPolynomialConfig<'a, S>

Source§

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

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

impl<'a, S: PartialEq + SemiringConfig> PartialEq for DynamicPolynomialConfig<'a, S>

Source§

fn eq(&self, other: &DynamicPolynomialConfig<'a, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<'a, S: RingConfig> RingConfig for DynamicPolynomialConfig<'a, S>

Source§

fn neg(&self, x: &Self::Element) -> Self::Element

-x
Source§

fn checked_neg(&self, x: &Self::Element) -> Option<Self::Element>

-x;
§

fn neg_assign(&self, x: &mut Self::Element)

x = -x;
Source§

impl<'a, S: SemiringConfig> SemiringConfig for DynamicPolynomialConfig<'a, S>

Source§

fn is_zero(&self, value: &Self::Element) -> bool

Source§

fn zero(&self) -> Self::Element

Source§

fn one(&self) -> Self::Element

Source§

fn add(&self, x: &Self::Element, y: &Self::Element) -> Self::Element

x + y
Source§

fn sub(&self, x: &Self::Element, y: &Self::Element) -> Self::Element

x - y
Source§

fn mul(&self, x: &Self::Element, y: &Self::Element) -> Self::Element

x * y
Source§

fn pow_u32(&self, x: &Self::Element, y: u32) -> Self::Element

x ** y
Source§

fn checked_add( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>

x + y
Source§

fn checked_sub( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>

x - y
Source§

fn checked_mul( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>

x * y
Source§

fn checked_pow_u32(&self, x: &Self::Element, y: u32) -> Option<Self::Element>

x ** y
Source§

fn add_assign(&self, x: &mut Self::Element, y: &Self::Element)

x += y
Source§

fn sub_assign(&self, x: &mut Self::Element, y: &Self::Element)

x -= y
§

fn mul_assign(&self, x: &mut Self::Element, y: &Self::Element)

x *= y
§

fn pow_u32_assign(&self, x: &mut Self::Element, y: u32)

x **= y
§

fn sum<I>(&self, iter: I) -> Self::Element
where I: Iterator<Item = Self::Element>,

§

fn sum_refs<'a, I>(&self, iter: I) -> Self::Element
where I: Iterator<Item = &'a Self::Element> + 'a,

§

fn product<I>(&self, iter: I) -> Self::Element
where I: Iterator<Item = Self::Element>,

§

fn product_refs<'a, I>(&self, iter: I) -> Self::Element
where I: Iterator<Item = &'a Self::Element>,

Source§

impl<'a, S: SemiringConfig> SetConfig for DynamicPolynomialConfig<'a, S>

Source§

type Element = DynamicPolynomial<<S as SetConfig>::Element>

Source§

impl<'a, S: Copy + SemiringConfig> Copy for DynamicPolynomialConfig<'a, S>

Source§

impl<'a, S: Eq + SemiringConfig> Eq for DynamicPolynomialConfig<'a, S>

Source§

impl<'a, S: SemiringConfig> StructuralPartialEq for DynamicPolynomialConfig<'a, S>

Auto Trait Implementations§

§

impl<'a, S> Freeze for DynamicPolynomialConfig<'a, S>

§

impl<'a, S> RefUnwindSafe for DynamicPolynomialConfig<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for DynamicPolynomialConfig<'a, S>

§

impl<'a, S> Sync for DynamicPolynomialConfig<'a, S>

§

impl<'a, S> Unpin for DynamicPolynomialConfig<'a, S>

§

impl<'a, S> UnsafeUnpin for DynamicPolynomialConfig<'a, S>

§

impl<'a, S> UnwindSafe for DynamicPolynomialConfig<'a, S>
where S: RefUnwindSafe,

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> HasDensePolynomialConfig for S
where S: SemiringConfig,

Source§

fn dense_poly_cfg<const DEGREE_PLUS_ONE: usize>( &self, ) -> DensePolynomialConfig<'_, Self, DEGREE_PLUS_ONE>

Source§

impl<S> HasDynamicPolynomialConfig for S
where S: SemiringConfig,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<T> SetElement for T
where T: Debug + Clone + Eq + Send + Sync + 'static,