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 SImplementations§
Source§impl<'a, S: SemiringConfig> DynamicPolynomialConfig<'a, S>
impl<'a, S: SemiringConfig> DynamicPolynomialConfig<'a, S>
Sourcepub fn new_trimmed(
&self,
coeffs: impl AsRef<[S::Element]>,
) -> DynamicPolynomial<S::Element>
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.
pub fn degree(&self, poly: &DynamicPolynomial<S::Element>) -> Option<usize>
pub fn trim(&self, poly: &mut DynamicPolynomial<S::Element>)
Sourcepub fn evaluate_at_point(
&self,
poly: &DynamicPolynomial<S::Element>,
point: &S::Element,
) -> Result<S::Element, EvaluationError>
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.
Sourcepub fn checked_evaluate_at_point(
&self,
poly: &DynamicPolynomial<S::Element>,
point: &S::Element,
) -> Result<S::Element, EvaluationError>
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.
Sourcepub fn rotate_right<const D: usize>(
&self,
poly: &DynamicPolynomial<S::Element>,
c: usize,
) -> DynamicPolynomial<S::Element>
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.
Sourcepub fn shr<const D: usize>(
&self,
poly: &DynamicPolynomial<S::Element>,
c: usize,
) -> DynamicPolynomial<S::Element>
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>
impl<'a, S: Clone + SemiringConfig> Clone for DynamicPolynomialConfig<'a, S>
Source§fn clone(&self) -> DynamicPolynomialConfig<'a, S>
fn clone(&self) -> DynamicPolynomialConfig<'a, S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, S: Debug + SemiringConfig> Debug for DynamicPolynomialConfig<'a, S>
impl<'a, S: Debug + SemiringConfig> Debug for DynamicPolynomialConfig<'a, S>
Source§impl<'a, S: PartialEq + SemiringConfig> PartialEq for DynamicPolynomialConfig<'a, S>
impl<'a, S: PartialEq + SemiringConfig> PartialEq for DynamicPolynomialConfig<'a, S>
Source§fn eq(&self, other: &DynamicPolynomialConfig<'a, S>) -> bool
fn eq(&self, other: &DynamicPolynomialConfig<'a, S>) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a, S: RingConfig> RingConfig for DynamicPolynomialConfig<'a, S>
impl<'a, S: RingConfig> RingConfig for DynamicPolynomialConfig<'a, S>
Source§fn checked_neg(&self, x: &Self::Element) -> Option<Self::Element>
fn checked_neg(&self, x: &Self::Element) -> Option<Self::Element>
§fn neg_assign(&self, x: &mut Self::Element)
fn neg_assign(&self, x: &mut Self::Element)
Source§impl<'a, S: SemiringConfig> SemiringConfig for DynamicPolynomialConfig<'a, S>
impl<'a, S: SemiringConfig> SemiringConfig for DynamicPolynomialConfig<'a, S>
fn is_zero(&self, value: &Self::Element) -> bool
fn zero(&self) -> Self::Element
fn one(&self) -> Self::Element
Source§fn checked_add(
&self,
x: &Self::Element,
y: &Self::Element,
) -> Option<Self::Element>
fn checked_add( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>
Source§fn checked_sub(
&self,
x: &Self::Element,
y: &Self::Element,
) -> Option<Self::Element>
fn checked_sub( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>
Source§fn checked_mul(
&self,
x: &Self::Element,
y: &Self::Element,
) -> Option<Self::Element>
fn checked_mul( &self, x: &Self::Element, y: &Self::Element, ) -> Option<Self::Element>
Source§fn checked_pow_u32(&self, x: &Self::Element, y: u32) -> Option<Self::Element>
fn checked_pow_u32(&self, x: &Self::Element, y: u32) -> Option<Self::Element>
Source§fn add_assign(&self, x: &mut Self::Element, y: &Self::Element)
fn add_assign(&self, x: &mut Self::Element, y: &Self::Element)
Source§fn sub_assign(&self, x: &mut Self::Element, y: &Self::Element)
fn sub_assign(&self, x: &mut Self::Element, y: &Self::Element)
§fn mul_assign(&self, x: &mut Self::Element, y: &Self::Element)
fn mul_assign(&self, x: &mut Self::Element, y: &Self::Element)
§fn pow_u32_assign(&self, x: &mut Self::Element, y: u32)
fn pow_u32_assign(&self, x: &mut Self::Element, y: u32)
fn sum<I>(&self, iter: I) -> Self::Elementwhere
I: Iterator<Item = Self::Element>,
fn sum_refs<'a, I>(&self, iter: I) -> Self::Elementwhere
I: Iterator<Item = &'a Self::Element> + 'a,
fn product<I>(&self, iter: I) -> Self::Elementwhere
I: Iterator<Item = Self::Element>,
fn product_refs<'a, I>(&self, iter: I) -> Self::Elementwhere
I: Iterator<Item = &'a Self::Element>,
Source§impl<'a, S: SemiringConfig> SetConfig for DynamicPolynomialConfig<'a, S>
impl<'a, S: SemiringConfig> SetConfig for DynamicPolynomialConfig<'a, S>
type Element = DynamicPolynomial<<S as SetConfig>::Element>
impl<'a, S: Copy + SemiringConfig> Copy for DynamicPolynomialConfig<'a, S>
impl<'a, S: Eq + SemiringConfig> Eq for DynamicPolynomialConfig<'a, S>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> HasDensePolynomialConfig for Swhere
S: SemiringConfig,
impl<S> HasDensePolynomialConfig for Swhere
S: SemiringConfig,
fn dense_poly_cfg<const DEGREE_PLUS_ONE: usize>( &self, ) -> DensePolynomialConfig<'_, Self, DEGREE_PLUS_ONE>
Source§impl<S> HasDynamicPolynomialConfig for Swhere
S: SemiringConfig,
impl<S> HasDynamicPolynomialConfig for Swhere
S: SemiringConfig,
fn dyn_poly_cfg(&self) -> DynamicPolynomialConfig<'_, Self>
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>
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>
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