Struct MultivariatePolyRingImplBase

Source
pub struct MultivariatePolyRingImplBase<R, A = Global>
where R: RingStore, A: Clone + Allocator + Send,
{ /* private fields */ }
Expand description

Implementation of multivariate polynomial rings.

Implementations§

Source§

impl<R, A> MultivariatePolyRingImplBase<R, A>
where R: RingStore, A: Clone + Allocator + Send,

Source

pub fn allocator(&self) -> &A

§Availability

This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl<P, R, A> CanHomFrom<P> for MultivariatePolyRingImplBase<R, A>

Source§

type Homomorphism = <<R as RingStore>::Type as CanHomFrom<<<P as RingExtension>::BaseRing as RingStore>::Type>>::Homomorphism

Source§

fn has_canonical_hom(&self, from: &P) -> Option<Self::Homomorphism>

Source§

fn map_in( &self, from: &P, el: <P as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element

Source§

fn map_in_ref( &self, from: &P, el: &<P as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element

Source§

fn mul_assign_map_in( &self, from: &S, lhs: &mut Self::Element, rhs: S::Element, hom: &Self::Homomorphism, )

Source§

fn mul_assign_map_in_ref( &self, from: &S, lhs: &mut Self::Element, rhs: &S::Element, hom: &Self::Homomorphism, )

Source§

impl<P, R, A> CanIsoFromTo<P> for MultivariatePolyRingImplBase<R, A>

Source§

type Isomorphism = <<R as RingStore>::Type as CanIsoFromTo<<<P as RingExtension>::BaseRing as RingStore>::Type>>::Isomorphism

Source§

fn has_canonical_iso(&self, from: &P) -> Option<Self::Isomorphism>

Source§

fn map_out( &self, from: &P, el: Self::Element, iso: &Self::Isomorphism, ) -> <P as RingBase>::Element

Source§

impl<R, A> MultivariatePolyRing for MultivariatePolyRingImplBase<R, A>
where R: RingStore, A: Clone + Allocator + Send,

Source§

type Monomial = MonomialIdentifier

Source§

type TermIter<'a> = TermIterImpl<'a, R> where Self: 'a

Source§

fn indeterminate_count(&self) -> usize

Returns the number of variables of this polynomial ring, i.e. the transcendence degree of the base ring.
Source§

fn create_monomial<I>(&self, exponents: I) -> Self::Monomial

Creates a monomial with the given exponents. Read more
Source§

fn clone_monomial(&self, mon: &Self::Monomial) -> Self::Monomial

Source§

fn add_assign_from_terms<I>(&self, lhs: &mut Self::Element, terms: I)
where I: IntoIterator<Item = (El<Self::BaseRing>, Self::Monomial)>,

Source§

fn mul_assign_monomial(&self, f: &mut Self::Element, rhs: Self::Monomial)

Multiplies the given polynomial with the given monomial.
Source§

fn coefficient_at<'a>( &'a self, f: &'a Self::Element, m: &Self::Monomial, ) -> &'a El<Self::BaseRing>

Returns the coefficient corresponding to the given monomial in the given polynomial. If the polynomial does not contain a term with that monomial, zero is returned.
Source§

fn expand_monomial_to(&self, m: &Self::Monomial, out: &mut [usize])

Writes the powers of each variable in the given monomial into the given output slice. Read more
Source§

fn exponent_at(&self, m: &Self::Monomial, var_index: usize) -> usize

Returns the power of the var_index-th variable in the given monomial. In other words, this maps X1^i1 ... Xm^im to i(var_index).
Source§

fn terms<'a>(&'a self, f: &'a Self::Element) -> Self::TermIter<'a>

Returns an iterator over all nonzero terms of the given polynomial.
Source§

fn monomial_deg(&self, mon: &Self::Monomial) -> usize

Returns the degree of a monomial, i.e. the sum of the exponents of all variables.
Source§

fn LT<'a, O: MonomialOrder>( &'a self, f: &'a Self::Element, order: O, ) -> Option<(&'a El<Self::BaseRing>, &'a Self::Monomial)>

Returns the Leading Term of f, i.e. the term whose monomial is largest w.r.t. the given order.
Source§

fn largest_term_lt<'a, O: MonomialOrder>( &'a self, f: &'a Self::Element, order: O, lt_than: &Self::Monomial, ) -> Option<(&'a El<Self::BaseRing>, &'a Self::Monomial)>

Returns the term of f whose monomial is largest (w.r.t. the given order) among all monomials smaller than lt_than.
Source§

fn monomial_mul( &self, lhs: Self::Monomial, rhs: &Self::Monomial, ) -> Self::Monomial

Multiplies two monomials.
Source§

fn monomial_lcm( &self, lhs: Self::Monomial, rhs: &Self::Monomial, ) -> Self::Monomial

Returns the least common multiple of two monomials.
Source§

fn monomial_div( &self, lhs: Self::Monomial, rhs: &Self::Monomial, ) -> Result<Self::Monomial, Self::Monomial>

Computes the quotient of two monomials. Read more
Source§

fn evaluate<S, V, H>(&self, f: &Self::Element, values: V, hom: H) -> S::Element
where S: ?Sized + RingBase, H: Homomorphism<<Self::BaseRing as RingStore>::Type, S>, V: VectorFn<S::Element>,

Evaluates the given polynomial at the given values. Read more
Source§

fn indeterminate(&self, i: usize) -> Self::Monomial

Returns the monomial Xi, where Xi is the i-th generator of this ring.
Source§

fn create_term( &self, coeff: El<Self::BaseRing>, monomial: Self::Monomial, ) -> Self::Element

Creates a new single-term polynomial.
Source§

fn map_terms<P, H>(&self, from: &P, el: &P::Element, hom: H) -> Self::Element

Applies the given homomorphism R -> S to each coefficient of the given polynomial in R[X1, ..., Xm] to produce a monomial in S[X1, ..., Xm].
Source§

fn appearing_indeterminates(&self, f: &Self::Element) -> Vec<(usize, usize)>

Returns a list of all variables appearing in the given polynomial. Associated with each variable is the highest degree in which it appears in some term. Read more
Source§

fn specialize( &self, f: &Self::Element, var: usize, val: &Self::Element, ) -> Self::Element

Replaces the given indeterminate in the given polynomial by the value val. Read more
Source§

impl<R, A> PartialEq for MultivariatePolyRingImplBase<R, A>
where R: RingStore, A: Clone + Allocator + Send,

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<R, A> RingBase for MultivariatePolyRingImplBase<R, A>
where R: RingStore, A: Clone + Allocator + Send,

Source§

type Element = MultivariatePolyRingEl<R, A>

Type of elements of the ring
Source§

fn clone_el(&self, val: &Self::Element) -> Self::Element

Source§

fn add_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element

Source§

fn add_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)

Source§

fn add_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)

Source§

fn sub_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)

Source§

fn negate_inplace(&self, lhs: &mut Self::Element)

Source§

fn mul_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)

Source§

fn mul_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)

Source§

fn mul_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element

Source§

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

Source§

fn from_int(&self, value: i32) -> Self::Element

Source§

fn eq_el(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool

Source§

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

Source§

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

Source§

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

Source§

fn is_commutative(&self) -> bool

Returns whether the ring is commutative, i.e. a * b = b * a for all elements a, b. Note that addition is assumed to be always commutative.
Source§

fn is_noetherian(&self) -> bool

Returns whether the ring is noetherian, i.e. every ideal is finitely generated. Read more
Source§

fn dbg(&self, value: &Self::Element, out: &mut Formatter<'_>) -> Result

Writes a human-readable representation of value to out. Read more
Source§

fn dbg_within<'a>( &self, value: &Self::Element, out: &mut Formatter<'a>, env: EnvBindingStrength, ) -> Result

Writes a human-readable representation of value to out, taking into account the possible context to place parenthesis as needed. Read more
Source§

fn characteristic<I: IntegerRingStore + Copy>(&self, ZZ: I) -> Option<El<I>>
where I::Type: IntegerRing,

Returns the characteristic of this ring as an element of the given implementation of ZZ. Read more
Source§

fn is_approximate(&self) -> bool

Returns whether this ring computes with approximations to elements. This would usually be the case for rings that are based on f32 or f64, to represent real or complex numbers. Read more
Source§

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

Source§

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

Source§

fn square(&self, value: &mut Self::Element)

Source§

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

Source§

fn sub_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)

Source§

fn mul_assign_int(&self, lhs: &mut Self::Element, rhs: i32)

Source§

fn mul_int(&self, lhs: Self::Element, rhs: i32) -> Self::Element

Source§

fn mul_int_ref(&self, lhs: &Self::Element, rhs: i32) -> Self::Element

Source§

fn sub_self_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)

Computes lhs := rhs - lhs.
Source§

fn sub_self_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)

Computes lhs := rhs - lhs.
Source§

fn add_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn add_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element

Source§

fn add(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn sub_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element

Source§

fn sub_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn sub_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element

Source§

fn sub(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn mul_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn mul_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element

Source§

fn mul(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element

Source§

fn pow_gen<R: RingStore>( &self, x: Self::Element, power: &El<R>, integers: R, ) -> Self::Element
where R::Type: IntegerRing,

Raises x to the power of an arbitrary, nonnegative integer given by a custom integer ring implementation. Read more
Source§

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

Sums the elements given by the iterator. Read more
Source§

fn prod<I>(&self, els: I) -> Self::Element
where I: IntoIterator<Item = Self::Element>,

Computes the product of the elements given by the iterator. Read more
Source§

impl<R, A> RingExtension for MultivariatePolyRingImplBase<R, A>
where R: RingStore, A: Clone + Allocator + Send,

Source§

type BaseRing = R

Type of the base ring; Read more
Source§

fn base_ring<'b>(&'b self) -> &'b Self::BaseRing

Returns a reference to the base ring.
Source§

fn from(&self, x: El<Self::BaseRing>) -> Self::Element

Maps an element of the base ring into this ring. Read more
Source§

fn mul_assign_base(&self, lhs: &mut Self::Element, rhs: &El<Self::BaseRing>)

Computes lhs := lhs * rhs, where rhs is mapped into this ring via RingExtension::from_ref(). Note that this may be faster than self.mul_assign(lhs, self.from_ref(rhs)).
Source§

fn from_ref(&self, x: &El<Self::BaseRing>) -> Self::Element

Maps an element of the base ring (given as reference) into this ring.

Auto Trait Implementations§

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<R> ComputeInnerProduct for R
where R: RingBase + ?Sized,

Source§

default fn inner_product_ref_fst<'a, I>( &self, els: I, ) -> <R as RingBase>::Element
where I: Iterator<Item = (&'a <R as RingBase>::Element, <R as RingBase>::Element)>, <R as RingBase>::Element: 'a,

Computes the inner product sum_i lhs[i] * rhs[i].
Source§

default fn inner_product_ref<'a, I>(&self, els: I) -> <R as RingBase>::Element
where I: Iterator<Item = (&'a <R as RingBase>::Element, &'a <R as RingBase>::Element)>, <R as RingBase>::Element: 'a,

Computes the inner product sum_i lhs[i] * rhs[i].
Source§

default fn inner_product<I>(&self, els: I) -> <R as RingBase>::Element
where I: Iterator<Item = (<R as RingBase>::Element, <R as RingBase>::Element)>,

Computes the inner product sum_i lhs[i] * rhs[i].
Source§

impl<R, S> CooleyTuckeyButterfly<S> for R
where S: RingBase + ?Sized, R: RingBase + ?Sized,

Source§

default fn butterfly<V, H>( &self, hom: H, values: &mut V, twiddle: &<S as RingBase>::Element, i1: usize, i2: usize, )
where V: VectorViewMut<<R as RingBase>::Element>, H: Homomorphism<S, R>,

Should compute (values[i1], values[i2]) := (values[i1] + twiddle * values[i2], values[i1] - twiddle * values[i2])
Source§

default fn inv_butterfly<V, H>( &self, hom: H, values: &mut V, twiddle: &<S as RingBase>::Element, i1: usize, i2: usize, )
where V: VectorViewMut<<R as RingBase>::Element>, H: Homomorphism<S, R>,

Should compute (values[i1], values[i2]) := (values[i1] + values[i2], (values[i1] - values[i2]) * twiddle)
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<R> KaratsubaHint for R
where R: RingBase + ?Sized,

Source§

default fn karatsuba_threshold(&self) -> usize

Define a threshold from which on KaratsubaAlgorithm will use the Karatsuba algorithm. Read more
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<R> StrassenHint for R
where R: RingBase + ?Sized,

Source§

default fn strassen_threshold(&self) -> usize

Define a threshold from which on StrassenAlgorithm will use the Strassen algorithm. 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<R> SelfIso for R
where R: CanIsoFromTo<R> + ?Sized,