Crate groebner

Crate groebner 

Source
Expand description

Groebner Basis

This library computes Groebner bases of polynomial ideals, using the Buchberger and F4 algorithms.

§Example

use groebner::is_groebner_basis;
use groebner::{groebner_basis, Monomial, MonomialOrder, Polynomial, Term};
use num_rational::BigRational;
// x^2 - y, xy - 1
let f1 = Polynomial::new(
    vec![
        Term::new(
            BigRational::new(1.into(), 1.into()),
            Monomial::new(vec![2, 0]),
        ),
        Term::new(
            BigRational::new((-1).into(), 1.into()),
            Monomial::new(vec![0, 1]),
        ),
    ],
    2,
    MonomialOrder::Lex,
);
let f2 = Polynomial::new(
    vec![
        Term::new(
            BigRational::new(1.into(), 1.into()),
            Monomial::new(vec![1, 1]),
        ),
        Term::new(
            BigRational::new((-1).into(), 1.into()),
            Monomial::new(vec![0, 0]),
        ),
    ],
    2,
    MonomialOrder::Lex,
);
let basis_result = groebner_basis(vec![f1, f2], MonomialOrder::Lex, true);
match basis_result {
    Ok(basis) => {
        assert!(!basis.is_empty());
        match is_groebner_basis(&basis) {
            Ok(true) => {}
            Ok(false) => panic!("Basis is not a Groebner basis!"),
            Err(e) => panic!("Groebner basis check failed: {}", e),
        }
    }
    Err(e) => panic!("Groebner basis computation failed: {}", e),
}

Re-exports§

pub use field::Field;
pub use grebauer_moller::filter_gm_pairs;
pub use groebner::groebner_basis;
pub use groebner::groebner_basis_with_strategy;
pub use groebner::is_groebner_basis;
pub use groebner::GroebnerError;
pub use groebner::SelectionStrategy;
pub use monomial::Monomial;
pub use monomial::MonomialOrder;
pub use polynomial::Polynomial;
pub use polynomial::Term;

Modules§

field
Field trait and Rational number implementation
grebauer_moller
groebner
Groebner basis algorithms.
monomial
Monomial types and orderings for Groebner basis computations
polynomial
Multivariate polynomial types and operations.
sugar