diff --git a/docs/src/types.md b/docs/src/types.md index e7bfb725..fdbe53fe 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -42,6 +42,18 @@ map_exponents multiplication_preserves_monomial_order ``` +### Ordering + +```@docs +AbstractMonomialOrdering +ordering +compare +LexOrder +InverseLexOrder +Graded +Reverse +``` + ## Terms ```@docs @@ -72,7 +84,6 @@ nterms coefficients coefficient(p::AbstractPolynomialLike, m::AbstractMonomialLike, vars) monomials -ordering mindegree maxdegree extdegree diff --git a/src/MultivariatePolynomials.jl b/src/MultivariatePolynomials.jl index f3bc5f34..9de4709e 100644 --- a/src/MultivariatePolynomials.jl +++ b/src/MultivariatePolynomials.jl @@ -67,7 +67,6 @@ include("monomial.jl") include("term.jl") include("polynomial.jl") include("monomial_vector.jl") -include("ordering.jl") include("rational.jl") diff --git a/src/comparison.jl b/src/comparison.jl index a0666e8b..6ca68979 100644 --- a/src/comparison.jl +++ b/src/comparison.jl @@ -309,3 +309,10 @@ struct Reverse{O<:AbstractMonomialOrdering} <: AbstractMonomialOrdering end compare(a, b, ::Type{Reverse{O}}) where {O} = compare(b, a, O) + +""" + ordering(p::AbstractPolynomialLike) + +Returns the [`AbstractMonomialOrdering`](@ref) used for the monomials of `p`. +""" +function ordering end diff --git a/src/ordering.jl b/src/ordering.jl deleted file mode 100644 index a0691f89..00000000 --- a/src/ordering.jl +++ /dev/null @@ -1,22 +0,0 @@ -""" - AbstractOrdering - -Abstract type for a monomial ordering. -""" -abstract type AbstractOrdering end - -""" - GradedLex - -Graded lexicographical monomial ordering. -Compares total monomial degree first, then breaks ties lexicographically. -Currently, a default option for all `AbstractPolynomialLike{T}`. -""" -struct GradedLex <: AbstractOrdering end - -""" - ordering(p::AbstractPolynomialLike) - -Returns the ordering of polynomial `p`. -""" -ordering(::AbstractPolynomialLike) = GradedLex() diff --git a/test/monomial.jl b/test/monomial.jl index 3c6fd407..86645347 100644 --- a/test/monomial.jl +++ b/test/monomial.jl @@ -38,7 +38,7 @@ end @test one(x^2) isa AbstractMonomial @test (@inferred one(typeof(x^2))) == 1 @test one(typeof(x^2)) isa AbstractMonomial - @test ordering(x) === GradedLex() + # @test ordering(x) === GradedLex #FIXME add it back once it's implemented Mod.@polyvar y[1:7] mono = y[1] * y[3] * y[5] * y[7] diff --git a/test/polynomial.jl b/test/polynomial.jl index 90434ba5..792b2153 100644 --- a/test/polynomial.jl +++ b/test/polynomial.jl @@ -184,7 +184,7 @@ const MP = MultivariatePolynomials @test collect(coefficients(f)) == [4, -5, 4, 7] @test collect(monomials(f)) == monomial_vector([x^2 * z^2, x * y^2 * z, x^3, z^2]) - @test ordering(f) === GradedLex() + #@test ordering(f) === GradedLex #FIXME end @testset "Convertion" begin