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: <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element,
monomial: <Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as RingBase>::Element { ... }
fn exponent_at(
&self,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
var_index: usize,
) -> usize { ... }
fn expand_monomial_to(
&self,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
out: &mut [usize],
) { ... }
fn monomial_mul(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as MultivariatePolyRing>::Monomial { ... }
fn monomial_lcm(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as MultivariatePolyRing>::Monomial { ... }
fn monomial_div(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Result<<Self::Type as MultivariatePolyRing>::Monomial, <Self::Type as MultivariatePolyRing>::Monomial> { ... }
fn monomial_deg(
&self,
val: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> usize { ... }
fn mul_assign_monomial(
&self,
f: &mut <Self::Type as RingBase>::Element,
monomial: <Self::Type as MultivariatePolyRing>::Monomial,
) { ... }
fn appearing_indeterminates(
&self,
f: &<Self::Type as RingBase>::Element,
) -> Vec<(usize, usize)> { ... }
fn specialize(
&self,
f: &<Self::Type as RingBase>::Element,
var: usize,
val: &<Self::Type as RingBase>::Element,
) -> <Self::Type as RingBase>::Element { ... }
fn expand_monomial(
&self,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Vec<usize> { ... }
fn largest_term_lt<'a, O>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
lt_than: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>
where O: MonomialOrder { ... }
fn LT<'a, O>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>
where O: MonomialOrder { ... }
fn create_monomial<I>(
&self,
exponents: I,
) -> <Self::Type as MultivariatePolyRing>::Monomial
where I: IntoIterator<Item = usize>,
<I as IntoIterator>::IntoIter: ExactSizeIterator { ... }
fn clone_monomial(
&self,
mon: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as MultivariatePolyRing>::Monomial { ... }
fn coefficient_at<'a>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> &'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element { ... }
fn terms<'a>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
) -> <Self::Type as MultivariatePolyRing>::TermIter<'a> { ... }
fn from_terms<I>(&self, terms: I) -> <Self::Type as RingBase>::Element
where I: IntoIterator<Item = (<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, <Self::Type as MultivariatePolyRing>::Monomial)> { ... }
fn evaluate<R, V, H>(
&self,
f: &<Self::Type as RingBase>::Element,
value: V,
hom: H,
) -> <R as RingBase>::Element
where R: RingBase + ?Sized,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, R>,
V: VectorFn<<R as RingBase>::Element> { ... }
fn into_lifted_hom<P, H>(
self,
from: P,
hom: H,
) -> CoefficientHom<P, Self, H>
where P: RingStore,
<P as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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 as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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<<Self::Type as RingBase>::Element>
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,
) -> [<Self::Type as RingBase>::Element; 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: <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element,
monomial: <Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as RingBase>::Element
fn create_term( &self, coeff: <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, monomial: <Self::Type as MultivariatePolyRing>::Monomial, ) -> <Self::Type as RingBase>::Element
Sourcefn exponent_at(
&self,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
var_index: usize,
) -> usize
fn exponent_at( &self, m: &<Self::Type as MultivariatePolyRing>::Monomial, var_index: usize, ) -> usize
Sourcefn expand_monomial_to(
&self,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
out: &mut [usize],
)
fn expand_monomial_to( &self, m: &<Self::Type as MultivariatePolyRing>::Monomial, out: &mut [usize], )
Sourcefn monomial_mul(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as MultivariatePolyRing>::Monomial
fn monomial_mul( &self, lhs: <Self::Type as MultivariatePolyRing>::Monomial, rhs: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> <Self::Type as MultivariatePolyRing>::Monomial
Sourcefn monomial_lcm(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> <Self::Type as MultivariatePolyRing>::Monomial
fn monomial_lcm( &self, lhs: <Self::Type as MultivariatePolyRing>::Monomial, rhs: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> <Self::Type as MultivariatePolyRing>::Monomial
Sourcefn monomial_div(
&self,
lhs: <Self::Type as MultivariatePolyRing>::Monomial,
rhs: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Result<<Self::Type as MultivariatePolyRing>::Monomial, <Self::Type as MultivariatePolyRing>::Monomial>
fn monomial_div( &self, lhs: <Self::Type as MultivariatePolyRing>::Monomial, rhs: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> Result<<Self::Type as MultivariatePolyRing>::Monomial, <Self::Type as MultivariatePolyRing>::Monomial>
Sourcefn monomial_deg(
&self,
val: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> usize
fn monomial_deg( &self, val: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> usize
Sourcefn mul_assign_monomial(
&self,
f: &mut <Self::Type as RingBase>::Element,
monomial: <Self::Type as MultivariatePolyRing>::Monomial,
)
fn mul_assign_monomial( &self, f: &mut <Self::Type as RingBase>::Element, monomial: <Self::Type as MultivariatePolyRing>::Monomial, )
Sourcefn appearing_indeterminates(
&self,
f: &<Self::Type as RingBase>::Element,
) -> Vec<(usize, usize)>
fn appearing_indeterminates( &self, f: &<Self::Type as RingBase>::Element, ) -> Vec<(usize, usize)>
Sourcefn specialize(
&self,
f: &<Self::Type as RingBase>::Element,
var: usize,
val: &<Self::Type as RingBase>::Element,
) -> <Self::Type as RingBase>::Element
fn specialize( &self, f: &<Self::Type as RingBase>::Element, var: usize, val: &<Self::Type as RingBase>::Element, ) -> <Self::Type as RingBase>::Element
fn expand_monomial( &self, m: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> Vec<usize>
Sourcefn largest_term_lt<'a, O>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
lt_than: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>where
O: MonomialOrder,
fn largest_term_lt<'a, O>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
lt_than: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>where
O: MonomialOrder,
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>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>where
O: MonomialOrder,
fn LT<'a, O>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
order: O,
) -> Option<(&'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, &'a <Self::Type as MultivariatePolyRing>::Monomial)>where
O: MonomialOrder,
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,
) -> <Self::Type as MultivariatePolyRing>::Monomial
fn create_monomial<I>( &self, exponents: I, ) -> <Self::Type as MultivariatePolyRing>::Monomial
Creates a new monomial with given exponents.
For details, see MultivariatePolyRing::create_monomial().
fn clone_monomial( &self, mon: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> <Self::Type as MultivariatePolyRing>::Monomial
Sourcefn coefficient_at<'a>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
m: &<Self::Type as MultivariatePolyRing>::Monomial,
) -> &'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element
fn coefficient_at<'a>( &'a self, f: &'a <Self::Type as RingBase>::Element, m: &<Self::Type as MultivariatePolyRing>::Monomial, ) -> &'a <<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element
Returns the coefficient of a polynomial corresponding to a monomial.
For details, see MultivariatePolyRing::coefficient_at().
Sourcefn terms<'a>(
&'a self,
f: &'a <Self::Type as RingBase>::Element,
) -> <Self::Type as MultivariatePolyRing>::TermIter<'a>
fn terms<'a>( &'a self, f: &'a <Self::Type as RingBase>::Element, ) -> <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) -> <Self::Type as RingBase>::Elementwhere
I: IntoIterator<Item = (<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, <Self::Type as MultivariatePolyRing>::Monomial)>,
fn from_terms<I>(&self, terms: I) -> <Self::Type as RingBase>::Elementwhere
I: IntoIterator<Item = (<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type as RingBase>::Element, <Self::Type as MultivariatePolyRing>::Monomial)>,
Creates a new polynomial by summing up all the given terms.
Sourcefn evaluate<R, V, H>(
&self,
f: &<Self::Type as RingBase>::Element,
value: V,
hom: H,
) -> <R as RingBase>::Element
fn evaluate<R, V, H>( &self, f: &<Self::Type as RingBase>::Element, value: V, hom: H, ) -> <R as RingBase>::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 as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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 as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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 as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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 as RingStore>::Type: MultivariatePolyRing,
H: Homomorphism<<<<P as RingStore>::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<<Self::Type as RingBase>::Element>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<<Self::Type as RingBase>::Element>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,
) -> [<Self::Type as RingBase>::Element; M]
fn with_wrapped_indeterminates<'a, F, const N: usize, const M: usize>( &'a self, f: F, ) -> [<Self::Type as RingBase>::Element; 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.