Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/comparison.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ function ordering end
ordering(::Type{<:AbstractMonomial}) = Graded{LexOrder}
ordering(::Type{P}) where {P} = ordering(monomial_type(P))
ordering(p::AbstractPolynomialLike) = ordering(typeof(p))
# Useful for instance to ask ordering given the list
# of variables
ordering(::AbstractVector{T}) where {T} = ordering(T)
ordering(t::Tuple) = ordering(first(t))

# We reverse the order of comparisons here so that the result
# of x < y is equal to the result of Monomial(x) < Monomial(y)
Expand Down
4 changes: 4 additions & 0 deletions test/commutative/comparison.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@testset "Comparison" begin
@testset "Graded Lex Order" begin
Mod.@polyvar x y z
O = Graded{LexOrder}
@test ordering(x) == O
@test ordering(x * y) == O
@test ordering(variables(x * y)) == O
@test x > y > z
@test x^2 * y > y^3 > z
@test y^2 >= x
Expand Down
Loading