pub trait MultivariatePolyRingStore: RingStorewhere
Self::Type: MultivariatePolyRing,{
Show 25 methods
// Provided methods
fn indeterminate_count(&self) -> usize { ... }
fn indeterminate(
&self,
i: usize,
) -> <Self::Type as MultivariatePolyRing>::Monomial { ... }
fn create_term(
&self,
coeff: PolyCoeff<Self>,
monomial: PolyMonomial<Self>,
) -> El<Self> { ... }
fn exponent_at(&self, m: &PolyMonomial<Self>, var_index: usize) -> usize { ... }
fn expand_monomial_to(&self, m: &PolyMonomial<Self>, out: &mut [usize]) { ... }
fn monomial_mul(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> PolyMonomial<Self> { ... }
fn monomial_lcm(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> PolyMonomial<Self> { ... }
fn monomial_div(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> Result<PolyMonomial<Self>, PolyMonomial<Self>> { ... }
fn monomial_deg(&self, val: &PolyMonomial<Self>) -> usize { ... }
fn mul_assign_monomial(
&self,
f: &mut El<Self>,
monomial: PolyMonomial<Self>,
) { ... }
fn appearing_indeterminates(&self, f: &El<Self>) -> Vec<(usize, usize)> { ... }
fn specialize(&self, f: &El<Self>, var: usize, val: &El<Self>) -> El<Self> { ... }
fn expand_monomial(&self, m: &PolyMonomial<Self>) -> Vec<usize> { ... }
fn largest_term_lt<'a, O: MonomialOrder>(
&'a self,
f: &'a El<Self>,
order: O,
lt_than: &PolyMonomial<Self>,
) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)> { ... }
fn LT<'a, O: MonomialOrder>(
&'a self,
f: &'a El<Self>,
order: O,
) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)> { ... }
fn create_monomial<I>(&self, exponents: I) -> PolyMonomial<Self>
where I: IntoIterator<Item = usize>,
I::IntoIter: ExactSizeIterator { ... }
fn clone_monomial(&self, mon: &PolyMonomial<Self>) -> PolyMonomial<Self> { ... }
fn coefficient_at<'a>(
&'a self,
f: &'a El<Self>,
m: &PolyMonomial<Self>,
) -> &'a PolyCoeff<Self> { ... }
fn terms<'a>(
&'a self,
f: &'a El<Self>,
) -> <Self::Type as MultivariatePolyRing>::TermIter<'a> { ... }
fn from_terms<I>(&self, terms: I) -> El<Self>
where I: IntoIterator<Item = (PolyCoeff<Self>, PolyMonomial<Self>)> { ... }
fn evaluate<R, V, H>(&self, f: &El<Self>, value: V, hom: H) -> R::Element
where R: ?Sized + RingBase,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, R>,
V: VectorFn<R::Element> { ... }
fn into_lifted_hom<P, H>(
self,
from: P,
hom: H,
) -> CoefficientHom<P, Self, H>
where P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type> { ... }
fn lifted_hom<'a, P, H>(
&'a self,
from: P,
hom: H,
) -> CoefficientHom<P, &'a Self, H>
where P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type> { ... }
fn with_wrapped_indeterminates_dyn<'a, F, T, const N: usize>(
&'a self,
f: F,
) -> Vec<El<Self>>
where F: FnOnce([&RingElementWrapper<&'a Self>; N]) -> T,
T: IntoIterator<Item = RingElementWrapper<&'a Self>> { ... }
fn with_wrapped_indeterminates<'a, F, const N: usize, const M: usize>(
&'a self,
f: F,
) -> [El<Self>; M]
where F: FnOnce([&RingElementWrapper<&'a Self>; N]) -> [RingElementWrapper<&'a Self>; M] { ... }
}Expand description
Provided Methods§
Sourcefn indeterminate(
&self,
i: usize,
) -> <Self::Type as MultivariatePolyRing>::Monomial
fn indeterminate( &self, i: usize, ) -> <Self::Type as MultivariatePolyRing>::Monomial
Sourcefn create_term(
&self,
coeff: PolyCoeff<Self>,
monomial: PolyMonomial<Self>,
) -> El<Self>
fn create_term( &self, coeff: PolyCoeff<Self>, monomial: PolyMonomial<Self>, ) -> El<Self>
Sourcefn exponent_at(&self, m: &PolyMonomial<Self>, var_index: usize) -> usize
fn exponent_at(&self, m: &PolyMonomial<Self>, var_index: usize) -> usize
Sourcefn expand_monomial_to(&self, m: &PolyMonomial<Self>, out: &mut [usize])
fn expand_monomial_to(&self, m: &PolyMonomial<Self>, out: &mut [usize])
Sourcefn monomial_mul(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> PolyMonomial<Self>
fn monomial_mul( &self, lhs: PolyMonomial<Self>, rhs: &PolyMonomial<Self>, ) -> PolyMonomial<Self>
Sourcefn monomial_lcm(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> PolyMonomial<Self>
fn monomial_lcm( &self, lhs: PolyMonomial<Self>, rhs: &PolyMonomial<Self>, ) -> PolyMonomial<Self>
Sourcefn monomial_div(
&self,
lhs: PolyMonomial<Self>,
rhs: &PolyMonomial<Self>,
) -> Result<PolyMonomial<Self>, PolyMonomial<Self>>
fn monomial_div( &self, lhs: PolyMonomial<Self>, rhs: &PolyMonomial<Self>, ) -> Result<PolyMonomial<Self>, PolyMonomial<Self>>
Sourcefn monomial_deg(&self, val: &PolyMonomial<Self>) -> usize
fn monomial_deg(&self, val: &PolyMonomial<Self>) -> usize
Sourcefn mul_assign_monomial(&self, f: &mut El<Self>, monomial: PolyMonomial<Self>)
fn mul_assign_monomial(&self, f: &mut El<Self>, monomial: PolyMonomial<Self>)
fn expand_monomial(&self, m: &PolyMonomial<Self>) -> Vec<usize>
Sourcefn largest_term_lt<'a, O: MonomialOrder>(
&'a self,
f: &'a El<Self>,
order: O,
lt_than: &PolyMonomial<Self>,
) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)>
fn largest_term_lt<'a, O: MonomialOrder>( &'a self, f: &'a El<Self>, order: O, lt_than: &PolyMonomial<Self>, ) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)>
Returns the term of f whose monomial is largest (w.r.t. the given order) among all monomials smaller than lt_than.
Sourcefn LT<'a, O: MonomialOrder>(
&'a self,
f: &'a El<Self>,
order: O,
) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)>
fn LT<'a, O: MonomialOrder>( &'a self, f: &'a El<Self>, order: O, ) -> Option<(&'a PolyCoeff<Self>, &'a PolyMonomial<Self>)>
Returns the Leading Term of f, i.e. the term whose monomial is largest w.r.t. the given order.
Sourcefn create_monomial<I>(&self, exponents: I) -> PolyMonomial<Self>
fn create_monomial<I>(&self, exponents: I) -> PolyMonomial<Self>
Creates a new monomial with given exponents.
For details, see MultivariatePolyRing::create_monomial().
fn clone_monomial(&self, mon: &PolyMonomial<Self>) -> PolyMonomial<Self>
Sourcefn coefficient_at<'a>(
&'a self,
f: &'a El<Self>,
m: &PolyMonomial<Self>,
) -> &'a PolyCoeff<Self>
fn coefficient_at<'a>( &'a self, f: &'a El<Self>, m: &PolyMonomial<Self>, ) -> &'a PolyCoeff<Self>
Returns the coefficient of a polynomial corresponding to a monomial.
For details, see MultivariatePolyRing::coefficient_at().
Sourcefn terms<'a>(
&'a self,
f: &'a El<Self>,
) -> <Self::Type as MultivariatePolyRing>::TermIter<'a>
fn terms<'a>( &'a self, f: &'a El<Self>, ) -> <Self::Type as MultivariatePolyRing>::TermIter<'a>
Returns an iterator over all nonzero terms of the polynomial.
For details, see MultivariatePolyRing::terms().
Sourcefn from_terms<I>(&self, terms: I) -> El<Self>
fn from_terms<I>(&self, terms: I) -> El<Self>
Creates a new polynomial by summing up all the given terms.
Sourcefn evaluate<R, V, H>(&self, f: &El<Self>, value: V, hom: H) -> R::Elementwhere
R: ?Sized + RingBase,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, R>,
V: VectorFn<R::Element>,
fn evaluate<R, V, H>(&self, f: &El<Self>, value: V, hom: H) -> R::Elementwhere
R: ?Sized + RingBase,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, R>,
V: VectorFn<R::Element>,
Evaluates the polynomial at the given values.
For details, see MultivariatePolyRing::evaluate().
Sourcefn into_lifted_hom<P, H>(self, from: P, hom: H) -> CoefficientHom<P, Self, H>where
P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type>,
fn into_lifted_hom<P, H>(self, from: P, hom: H) -> CoefficientHom<P, Self, H>where
P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type>,
Returns the homomorphism R[X1, ..., Xm] -> S[X1, ..., Xm] that is induced by
applying the given homomorphism R -> S coefficient-wise.
Sourcefn lifted_hom<'a, P, H>(
&'a self,
from: P,
hom: H,
) -> CoefficientHom<P, &'a Self, H>where
P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type>,
fn lifted_hom<'a, P, H>(
&'a self,
from: P,
hom: H,
) -> CoefficientHom<P, &'a Self, H>where
P: RingStore,
P::Type: MultivariatePolyRing,
H: Homomorphism<<<P::Type as RingExtension>::BaseRing as RingStore>::Type, <<Self::Type as RingExtension>::BaseRing as RingStore>::Type>,
Returns the homomorphism R[X1, ..., Xm] -> S[X1, ..., Xm] that is induced by
applying the given homomorphism R -> S coefficient-wise.
If the ownership of this ring should be transferred to the homomorphism, consider
using MultivariatePolyRingStore::into_lifted_hom().
Sourcefn with_wrapped_indeterminates_dyn<'a, F, T, const N: usize>(
&'a self,
f: F,
) -> Vec<El<Self>>where
F: FnOnce([&RingElementWrapper<&'a Self>; N]) -> T,
T: IntoIterator<Item = RingElementWrapper<&'a Self>>,
fn with_wrapped_indeterminates_dyn<'a, F, T, const N: usize>(
&'a self,
f: F,
) -> Vec<El<Self>>where
F: FnOnce([&RingElementWrapper<&'a Self>; N]) -> T,
T: IntoIterator<Item = RingElementWrapper<&'a Self>>,
Invokes the function with a wrapped version of the indeterminates of this poly ring. Use for convenient creation of polynomials.
Note however that MultivariatePolyRingStore::from_terms() might be more performant.
§Example
use feanor_math::assert_el_eq;
use feanor_math::homomorphism::*;
use feanor_math::ring::*;
use feanor_math::rings::multivariate::*;
use feanor_math::rings::zn::zn_64::*;
use feanor_math::rings::multivariate::multivariate_impl::*;
let base_ring = Zn::new(7);
let poly_ring = MultivariatePolyRingImpl::new(base_ring, 3);
let f_version1 = poly_ring.from_terms([(base_ring.int_hom().map(3), poly_ring.create_monomial([0, 0, 0])), (base_ring.int_hom().map(2), poly_ring.create_monomial([0, 1, 1])), (base_ring.one(), poly_ring.create_monomial([2, 0, 0]))].into_iter());
let f_version2 = poly_ring.with_wrapped_indeterminates_dyn(|[x, y, z]| [3 + 2 * y * z + x.pow_ref(2)]).into_iter().next().unwrap();
let [f_version3] = poly_ring.with_wrapped_indeterminates(|[x, y, z]| [3 + 2 * y * z + x.pow_ref(2)]);
assert_el_eq!(poly_ring, f_version1, f_version2);Sourcefn with_wrapped_indeterminates<'a, F, const N: usize, const M: usize>(
&'a self,
f: F,
) -> [El<Self>; M]
fn with_wrapped_indeterminates<'a, F, const N: usize, const M: usize>( &'a self, f: F, ) -> [El<Self>; M]
Same as MultivariatePolyRingStore::with_wrapped_indeterminates_dyn(), but returns result
as an array to allow pattern matching.
§Example
use feanor_math::assert_el_eq;
use feanor_math::homomorphism::*;
use feanor_math::ring::*;
use feanor_math::rings::multivariate::*;
use feanor_math::rings::zn::zn_64::*;
use feanor_math::rings::multivariate::multivariate_impl::*;
let base_ring = Zn::new(7);
let poly_ring = MultivariatePolyRingImpl::new(base_ring, 3);
let f_version1 = poly_ring.from_terms([(base_ring.int_hom().map(3), poly_ring.create_monomial([0, 0, 0])), (base_ring.int_hom().map(2), poly_ring.create_monomial([0, 1, 1])), (base_ring.one(), poly_ring.create_monomial([2, 0, 0]))].into_iter());
let f_version2 = poly_ring.with_wrapped_indeterminates_dyn(|[x, y, z]| [3 + 2 * y * z + x.pow_ref(2)]).into_iter().next().unwrap();
let [f_version3] = poly_ring.with_wrapped_indeterminates(|[x, y, z]| [3 + 2 * y * z + x.pow_ref(2)]);
assert_el_eq!(poly_ring, f_version1, f_version2);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.