pub struct GroebnerBasis<D: Domain, O: MonomialOrder> {
pub basis: Vec<SparseMultivariatePolynomial<D, O>>,
}Expand description
A Gröbner basis for a polynomial ideal.
Fields§
§basis: Vec<SparseMultivariatePolynomial<D, O>>The polynomials forming the basis.
Implementations§
Source§impl<D: Domain, O: MonomialOrder> GroebnerBasis<D, O>
impl<D: Domain, O: MonomialOrder> GroebnerBasis<D, O>
Sourcepub fn buchberger(ideal: &[SparseMultivariatePolynomial<D, O>]) -> Self
pub fn buchberger(ideal: &[SparseMultivariatePolynomial<D, O>]) -> Self
Compute a Gröbner basis from a set of generators using Buchberger’s algorithm.
Requires that the coefficient domain supports exact division (i.e., is effectively a field). The algorithm will panic if division fails.
§Example
use ocas_domain::{RationalDomain, Rational};
use ocas_poly::sparse::Lex;
use ocas_poly::GroebnerBasis;
use ocas_poly::SparseMultivariatePolynomial;
let d = RationalDomain;
// ideal: x + y, x - y
let f1 = SparseMultivariatePolynomial::<_, Lex>::from_terms(d, 2, vec![
(vec![1, 0], Rational::new(1, 1)),
(vec![0, 1], Rational::new(1, 1)),
]);
let f2 = SparseMultivariatePolynomial::<_, Lex>::from_terms(d, 2, vec![
(vec![1, 0], Rational::new(1, 1)),
(vec![0, 1], Rational::new(-1, 1)),
]);
let gb = GroebnerBasis::buchberger(&[f1, f2]);
assert!(gb.basis.len() >= 2);Sourcepub fn minimize(self) -> Self
pub fn minimize(self) -> Self
Minimize the basis: remove polynomials whose leading monomial is divisible by another element’s leading monomial.
Sourcepub fn auto_reduce(self) -> Self
pub fn auto_reduce(self) -> Self
Inter-reduce the basis: reduce each element by the others and make each polynomial monic.
The algorithm processes elements in ascending order of leading monomial. Each element is reduced by all elements with strictly smaller leading monomials (those already in the result set). This ensures the standard reduced Gröbner basis property: no monomial of any basis element is divisible by the leading monomial of any other basis element.
Sourcepub fn is_groebner_basis(&self) -> bool
pub fn is_groebner_basis(&self) -> bool
Verify that this is indeed a Gröbner basis by checking that all S-polynomials reduce to zero.
Trait Implementations§
Source§impl<D: Clone + Domain, O: Clone + MonomialOrder> Clone for GroebnerBasis<D, O>
impl<D: Clone + Domain, O: Clone + MonomialOrder> Clone for GroebnerBasis<D, O>
Source§fn clone(&self) -> GroebnerBasis<D, O>
fn clone(&self) -> GroebnerBasis<D, O>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D: Debug + Domain, O: Debug + MonomialOrder> Debug for GroebnerBasis<D, O>
impl<D: Debug + Domain, O: Debug + MonomialOrder> Debug for GroebnerBasis<D, O>
impl<D: Eq + Domain, O: Eq + MonomialOrder> Eq for GroebnerBasis<D, O>
Source§impl<D: PartialEq + Domain, O: PartialEq + MonomialOrder> PartialEq for GroebnerBasis<D, O>
impl<D: PartialEq + Domain, O: PartialEq + MonomialOrder> PartialEq for GroebnerBasis<D, O>
Source§fn eq(&self, other: &GroebnerBasis<D, O>) -> bool
fn eq(&self, other: &GroebnerBasis<D, O>) -> bool
self and other values to be equal, and is used by ==.