Skip to content

Commit 55d0253

Browse files
committed
Fix
1 parent 2cecd59 commit 55d0253

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/comparison.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ Springer Science & Business Media, **2013**.
188188
"""
189189
abstract type AbstractMonomialOrdering end
190190

191+
# We can't write this with a type instead of an instance so this motivates
192+
# why we work with instances and not types even if they don't have any data
193+
# that's not already in the type.
194+
# This is also to be consistent with `StarAlgebras.MultiplicativeStructure`
191195
(ordering::AbstractMonomialOrdering)(i, j) = cmp(ordering, i, j) < 0
192196

193197
"""
@@ -286,6 +290,7 @@ function Base.cmp(ordering::Reverse, a::_TupleOrVector, b::_TupleOrVector)
286290
return cmp(ordering.reverse_ordering, b, a)
287291
end
288292

293+
#TODO(breaking) Return an instance, not a type
289294
"""
290295
ordering(p::AbstractPolynomialLike)::Type{<:AbstractMonomialOrdering}
291296
@@ -310,13 +315,13 @@ Base.@pure function Base.cmp(
310315
return -cmp(name(v1), name(v2))
311316
end
312317

313-
function Base.cmp(
314-
::Type{O},
318+
function compare(
315319
m1::AbstractMonomial,
316320
m2::AbstractMonomial,
321+
::Type{O},
317322
) where {O<:AbstractMonomialOrdering}
318323
s1, s2 = promote_variables(m1, m2)
319-
return compare(exponents(s1), exponents(s2), O)
324+
return cmp(O(), exponents(s1), exponents(s2))
320325
end
321326

322327
# Implement this to make coefficients be compared with terms.

0 commit comments

Comments
 (0)