pub struct MultivariatePolyRingImplBase<R, O, M, const N: usize>{ /* private fields */ }Expand description
Represents the multivariate polynomial ring R[X1, ..., XN] in N unknowns.
Polynomials are stored as lists of their terms, ordered by the given monomial
ordering.
Note that the specific ordering does not matter in principle, but when frequently
accessing the leading monomial (as e.g. done by Groebner basis algorithms, see
crate::algorithms::f4::f4()), choosing the ordering to match the ordering
used for the GB algorithm can significantly improve performance.
Note that there is currently no implementation of multivariate polynomial rings with a number of unknowns chosen at runtime.
Trait Implementations§
source§impl<R1, O1, M1, R2, O2, M2, const N1: usize, const N2: usize> CanHomFrom<MultivariatePolyRingImplBase<R2, O2, M2, N2>> for MultivariatePolyRingImplBase<R1, O1, M1, N1>where
R1: RingStore,
O1: MonomialOrder,
M1: GrowableMemoryProvider<(El<R1>, Monomial<[u16; N1]>)>,
R2: RingStore,
O2: MonomialOrder,
M2: GrowableMemoryProvider<(El<R2>, Monomial<[u16; N2]>)>,
R1::Type: CanHomFrom<R2::Type>,
impl<R1, O1, M1, R2, O2, M2, const N1: usize, const N2: usize> CanHomFrom<MultivariatePolyRingImplBase<R2, O2, M2, N2>> for MultivariatePolyRingImplBase<R1, O1, M1, N1>where
R1: RingStore,
O1: MonomialOrder,
M1: GrowableMemoryProvider<(El<R1>, Monomial<[u16; N1]>)>,
R2: RingStore,
O2: MonomialOrder,
M2: GrowableMemoryProvider<(El<R2>, Monomial<[u16; N2]>)>,
R1::Type: CanHomFrom<R2::Type>,
type Homomorphism = <<R1 as RingStore>::Type as CanHomFrom<<R2 as RingStore>::Type>>::Homomorphism
fn has_canonical_hom( &self, from: &MultivariatePolyRingImplBase<R2, O2, M2, N2>, ) -> Option<Self::Homomorphism>
fn map_in_ref( &self, from: &MultivariatePolyRingImplBase<R2, O2, M2, N2>, el: &<MultivariatePolyRingImplBase<R2, O2, M2, N2> as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn map_in( &self, from: &MultivariatePolyRingImplBase<R2, O2, M2, N2>, el: <MultivariatePolyRingImplBase<R2, O2, M2, N2> as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn mul_assign_map_in( &self, from: &S, lhs: &mut Self::Element, rhs: S::Element, hom: &Self::Homomorphism, )
fn mul_assign_map_in_ref( &self, from: &S, lhs: &mut Self::Element, rhs: &S::Element, hom: &Self::Homomorphism, )
source§impl<R1, O1, M1, R2, O2, M2, const N1: usize, const N2: usize> CanIsoFromTo<MultivariatePolyRingImplBase<R2, O2, M2, N2>> for MultivariatePolyRingImplBase<R1, O1, M1, N1>where
R1: RingStore,
O1: MonomialOrder,
M1: GrowableMemoryProvider<(El<R1>, Monomial<[u16; N1]>)>,
R2: RingStore,
O2: MonomialOrder,
M2: GrowableMemoryProvider<(El<R2>, Monomial<[u16; N2]>)>,
R1::Type: CanIsoFromTo<R2::Type>,
impl<R1, O1, M1, R2, O2, M2, const N1: usize, const N2: usize> CanIsoFromTo<MultivariatePolyRingImplBase<R2, O2, M2, N2>> for MultivariatePolyRingImplBase<R1, O1, M1, N1>where
R1: RingStore,
O1: MonomialOrder,
M1: GrowableMemoryProvider<(El<R1>, Monomial<[u16; N1]>)>,
R2: RingStore,
O2: MonomialOrder,
M2: GrowableMemoryProvider<(El<R2>, Monomial<[u16; N2]>)>,
R1::Type: CanIsoFromTo<R2::Type>,
type Isomorphism = <<R1 as RingStore>::Type as CanIsoFromTo<<R2 as RingStore>::Type>>::Isomorphism
fn has_canonical_iso( &self, from: &MultivariatePolyRingImplBase<R2, O2, M2, N2>, ) -> Option<Self::Isomorphism>
fn map_out( &self, from: &MultivariatePolyRingImplBase<R2, O2, M2, N2>, el: Self::Element, iso: &Self::Isomorphism, ) -> <MultivariatePolyRingImplBase<R2, O2, M2, N2> as RingBase>::Element
source§impl<R, O, M, const N: usize> Clone for MultivariatePolyRingImplBase<R, O, M, N>where
R: RingStore + Clone,
O: MonomialOrder + Clone,
M: GrowableMemoryProvider<(El<R>, Monomial<[u16; N]>)> + Clone,
impl<R, O, M, const N: usize> Clone for MultivariatePolyRingImplBase<R, O, M, N>where
R: RingStore + Clone,
O: MonomialOrder + Clone,
M: GrowableMemoryProvider<(El<R>, Monomial<[u16; N]>)> + Clone,
source§impl<R, O, M, const N: usize> MultivariatePolyRing for MultivariatePolyRingImplBase<R, O, M, N>
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
source§fn terms<'a>(&'a self, f: &'a Self::Element) -> Self::TermsIterator<'a>
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 coefficient_at<'a>(
&'a self,
f: &'a Self::Element,
m: &Monomial<Self::MonomialVector>,
) -> &'a El<Self::BaseRing>
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 indeterminate_len(&self) -> usize
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
fn indeterminate(&self, i: usize) -> Self::Element
Returns the i-th indeterminate/variable/unknown as a ring element
source§fn mul_monomial(
&self,
el: &mut Self::Element,
m: &Monomial<Self::MonomialVector>,
)
fn mul_monomial( &self, el: &mut Self::Element, m: &Monomial<Self::MonomialVector>, )
Multiplies the given polynomial with a monomial.
source§fn lm<'a, O2>(
&'a self,
f: &'a Self::Element,
order: O2,
) -> Option<&'a Monomial<Self::MonomialVector>>where
O2: MonomialOrder,
fn lm<'a, O2>(
&'a self,
f: &'a Self::Element,
order: O2,
) -> Option<&'a Monomial<Self::MonomialVector>>where
O2: MonomialOrder,
Returns the leading monomial of the given polynomial. Read more
fn create_monomial<I: ExactSizeIterator<Item = u16>>( &self, exponents: I, ) -> Monomial<Self::MonomialVector>
fn evaluate<S, V, H>(&self, f: &Self::Element, values: V, hom: &H) -> S::Element
source§fn add_assign_from_terms<I>(&self, lhs: &mut Self::Element, rhs: I)
fn add_assign_from_terms<I>(&self, lhs: &mut Self::Element, rhs: I)
Add-assigns to the given polynomial the polynomial implicitly given by the
iterator over terms.
source§fn monomial(&self, m: &Monomial<Self::MonomialVector>) -> Self::Element
fn monomial(&self, m: &Monomial<Self::MonomialVector>) -> Self::Element
Returns the given monomial as a ring element
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
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>
fn appearing_variables(&self, f: &Self::Element) -> BTreeMap<usize, u16>
Returns all variables appearing in the given polynomial, together
with their respective degrees. Read more
source§fn map_terms<P, H>(&self, from: &P, el: &P::Element, hom: &H) -> Self::Elementwhere
P: ?Sized + MultivariatePolyRing,
H: Homomorphism<<P::BaseRing as RingStore>::Type, <Self::BaseRing as RingStore>::Type>,
fn map_terms<P, H>(&self, from: &P, el: &P::Element, hom: &H) -> Self::Elementwhere
P: ?Sized + MultivariatePolyRing,
H: Homomorphism<<P::BaseRing as RingStore>::Type, <Self::BaseRing as RingStore>::Type>,
Computes the polynomial that results from applying
hom to each coefficient of the input
polynomial. This is used to implement MultivariatePolyRingStore::lifted_hom().source§impl<R, O, M, const N: usize> PartialEq for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> PartialEq for MultivariatePolyRingImplBase<R, O, M, N>
source§impl<R, O, M, const N: usize> RingBase for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> RingBase for MultivariatePolyRingImplBase<R, O, M, N>
type Element = <M as MemoryProvider<(<<R as RingStore>::Type as RingBase>::Element, Monomial<[u16; N]>)>>::Object
fn clone_el(&self, val: &Self::Element) -> Self::Element
fn add_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn mul_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn add_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn add_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
fn negate_inplace(&self, lhs: &mut Self::Element)
fn mul_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
fn mul_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn from_int(&self, value: i32) -> Self::Element
fn eq_el(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool
fn is_zero(&self, value: &Self::Element) -> bool
fn is_one(&self, value: &Self::Element) -> bool
fn is_neg_one(&self, value: &Self::Element) -> bool
fn is_commutative(&self) -> bool
fn is_noetherian(&self) -> bool
fn dbg<'a>(&self, value: &Self::Element, out: &mut Formatter<'a>) -> Result
source§fn characteristic<I: IntegerRingStore>(&self, ZZ: &I) -> Option<El<I>>where
I::Type: IntegerRing,
fn characteristic<I: IntegerRingStore>(&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 morefn sub_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn zero(&self) -> Self::Element
fn one(&self) -> Self::Element
fn neg_one(&self) -> Self::Element
source§fn is_approximate(&self) -> bool
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 morefn square(&self, value: &mut Self::Element)
fn negate(&self, value: Self::Element) -> Self::Element
fn sub_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
fn mul_assign_int(&self, lhs: &mut Self::Element, rhs: i32)
fn mul_int(&self, lhs: Self::Element, rhs: i32) -> Self::Element
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)
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)
fn sub_self_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
Computes
lhs := rhs - lhs.fn add_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn add_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn add(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
fn sub_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn sub_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn sub_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn sub(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
fn mul_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn mul_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn mul(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
source§fn pow_gen<R: IntegerRingStore>(
&self,
x: Self::Element,
power: &El<R>,
integers: R,
) -> Self::Elementwhere
R::Type: IntegerRing,
fn pow_gen<R: IntegerRingStore>(
&self,
x: Self::Element,
power: &El<R>,
integers: R,
) -> Self::Elementwhere
R::Type: IntegerRing,
Raises
x to the power of an arbitrary, nonnegative integer given by
a custom integer ring implementation. Read morefn sum<I>(&self, els: I) -> Self::Element
fn prod<I>(&self, els: I) -> Self::Element
source§impl<R, O, M, const N: usize> RingExtension for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> RingExtension for MultivariatePolyRingImplBase<R, O, M, N>
type BaseRing = R
fn base_ring<'a>(&'a self) -> &'a Self::BaseRing
fn from(&self, x: El<Self::BaseRing>) -> Self::Element
source§fn mul_assign_base(&self, lhs: &mut Self::Element, rhs: &El<Self::BaseRing>)
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)).fn from_ref(&self, x: &El<Self::BaseRing>) -> Self::Element
Auto Trait Implementations§
impl<R, O, M, const N: usize> Freeze for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> RefUnwindSafe for MultivariatePolyRingImplBase<R, O, M, N>where
R: RefUnwindSafe,
M: RefUnwindSafe,
O: RefUnwindSafe,
<<R as RingStore>::Type as RingBase>::Element: RefUnwindSafe,
impl<R, O, M, const N: usize> Send for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> Sync for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> Unpin for MultivariatePolyRingImplBase<R, O, M, N>
impl<R, O, M, const N: usize> UnwindSafe for MultivariatePolyRingImplBase<R, O, M, N>where
R: UnwindSafe,
M: UnwindSafe,
O: UnwindSafe,
<<R as RingStore>::Type as RingBase>::Element: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<R> ConvMulComputation for R
impl<R> ConvMulComputation for R
source§default fn karatsuba_threshold(&self) -> usize
default fn karatsuba_threshold(&self) -> usize
Define a threshold from which on the default implementation of
ConvMulComputation::add_assign_conv_mul()
will use the Karatsuba algorithm. Read moresource§impl<R, S> CooleyTuckeyButterfly<S> for R
impl<R, S> CooleyTuckeyButterfly<S> for R
source§default fn butterfly<V, H>(
&self,
hom: &H,
values: &mut V,
twiddle: &<S as RingBase>::Element,
i1: usize,
i2: usize,
)
default fn butterfly<V, H>( &self, hom: &H, values: &mut V, twiddle: &<S as RingBase>::Element, i1: usize, i2: usize, )
Should compute
(values[i1], values[i2]) := (values[i1] + twiddle * values[i2], values[i1] - twiddle * values[i2])source§impl<R> InnerProductComputation for R
impl<R> InnerProductComputation for R
source§default fn inner_product_ref_fst<'a, I>(
&self,
els: I,
) -> <R as RingBase>::Element
default fn inner_product_ref_fst<'a, I>( &self, els: I, ) -> <R as RingBase>::Element
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
default fn inner_product_ref<'a, I>(&self, els: I) -> <R as RingBase>::Element
Computes the inner product
sum_i lhs[i] * rhs[i].