pub trait MultivariatePolyRing: RingExtension {
    type MonomialVector: VectorViewMut<u16>;
    type TermsIterator<'a>: Iterator<Item = (&'a El<Self::BaseRing>, &'a Monomial<Self::MonomialVector>)>
       where Self: 'a;

Show 14 methods // Required methods fn indeterminate_len(&self) -> usize; fn indeterminate(&self, i: usize) -> Self::Element; fn terms<'a>(&'a self, f: &'a Self::Element) -> Self::TermsIterator<'a>; fn mul_monomial( &self, el: &mut Self::Element, m: &Monomial<Self::MonomialVector>, ); fn coefficient_at<'a>( &'a self, f: &'a Self::Element, m: &Monomial<Self::MonomialVector>, ) -> &'a El<Self::BaseRing>; fn lm<'a, O>( &'a self, f: &'a Self::Element, order: O, ) -> Option<&'a Monomial<Self::MonomialVector>> where O: MonomialOrder; fn create_monomial<I: ExactSizeIterator<Item = u16>>( &self, exponents: I, ) -> Monomial<Self::MonomialVector>; fn evaluate<R, V, H>( &self, f: &Self::Element, values: V, hom: &H, ) -> R::Element where R: ?Sized + RingBase, H: Homomorphism<<Self::BaseRing as RingStore>::Type, R>, V: VectorView<R::Element>; // Provided methods fn monomial(&self, m: &Monomial<Self::MonomialVector>) -> Self::Element { ... } fn add_assign_from_terms<I>(&self, lhs: &mut Self::Element, rhs: I) where I: Iterator<Item = (El<Self::BaseRing>, Monomial<Self::MonomialVector>)> { ... } fn lt<'a, O>( &'a self, f: &'a Self::Element, order: O, ) -> Option<(&'a El<Self::BaseRing>, &'a Monomial<Self::MonomialVector>)> where O: MonomialOrder { ... } fn specialize( &self, f: &Self::Element, var: usize, val: &Self::Element, ) -> Self::Element { ... } fn appearing_variables(&self, f: &Self::Element) -> BTreeMap<usize, u16> { ... } fn map_terms<P, H>( &self, from: &P, el: &P::Element, hom: &H, ) -> Self::Element where P: ?Sized + MultivariatePolyRing, H: Homomorphism<<P::BaseRing as RingStore>::Type, <Self::BaseRing as RingStore>::Type> { ... }
}
Expand description

Trait for rings that are multivariate polynomial rings in finitely many indeterminates over a base ring, i.e. R[X0, X1, X2, ..., XN].

Currently, the only implementation of such rings is ordered::MultivariatePolyRingImpl, which is stores all monomials in an ordered vector.

Required Associated Types§

source

type MonomialVector: VectorViewMut<u16>

source

type TermsIterator<'a>: Iterator<Item = (&'a El<Self::BaseRing>, &'a Monomial<Self::MonomialVector>)> where Self: 'a

Required Methods§

source

fn indeterminate_len(&self) -> usize

Returns the number of indeterminates, i.e. the transcendence degree of this ring over its base ring.

source

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

Returns the i-th indeterminate/variable/unknown as a ring element

source

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

Returns all terms of the given polynomial. A term is a product c * m with a nonzero coefficient c (i.e. element of the base ring) and a monomial m.

source

fn mul_monomial( &self, el: &mut Self::Element, m: &Monomial<Self::MonomialVector>, )

Multiplies the given polynomial with a monomial.

source

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

Returns the coefficient of the polynomial of the given monomial. If the monomial does not appear in the polynomial, this returns zero.

source

fn lm<'a, O>( &'a self, f: &'a Self::Element, order: O, ) -> Option<&'a Monomial<Self::MonomialVector>>
where O: MonomialOrder,

Returns the leading monomial of the given polynomial.

The leading monomial is the monomial with nonzero coefficient that is largest w.r.t. the given monomial ordering.

source

fn create_monomial<I: ExactSizeIterator<Item = u16>>( &self, exponents: I, ) -> Monomial<Self::MonomialVector>

source

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

Provided Methods§

source

fn monomial(&self, m: &Monomial<Self::MonomialVector>) -> Self::Element

Returns the given monomial as a ring element

source

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

Add-assigns to the given polynomial the polynomial implicitly given by the iterator over terms.

source

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

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. The implementation is optimized using the facts that only one indeterminate is replaced, and the new value is in the same ring (it can be a polynomial however).

source

fn appearing_variables(&self, f: &Self::Element) -> BTreeMap<usize, u16>

Returns all variables appearing in the given polynomial, together with their respective degrees.

§Example
 
let ring = ordered::MultivariatePolyRingImpl::<_, _, _, 3>::new(StaticRing::<i32>::RING, DegRevLex, default_memory_provider!());
let x = ring.indeterminate(0);
let y = ring.indeterminate(1);
let z = ring.indeterminate(2);
let poly = ring.add(x, ring.pow(z, 2));
assert_eq!([(0, 1), (2, 2)].into_iter().collect::<BTreeMap<_, _>>(), ring.appearing_variables(&poly));
source

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

Computes the polynomial that results from applying hom to each coefficient of the input polynomial. This is used to implement MultivariatePolyRingStore::lifted_hom().

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<R, O, M, const N: usize> MultivariatePolyRing for MultivariatePolyRingImplBase<R, O, M, N>

§

type MonomialVector = [u16; N]

§

type TermsIterator<'a> = MultivariatePolyRingBaseTermsIter<'a, R, O, M, N> where Self: 'a