Skip to content

Commit

Permalink
remove Comparable
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed May 2, 2024
1 parent ce2a672 commit 83ecdbc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/sparse_coeffs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ function __prealloc(X::SparseCoefficients, Y::SparseCoefficients, op)
return similar(X, T)
end

struct Comparable{F}
lt::F
end
@inline (cmp::Comparable)(a, b) = cmp.lt(a, b)

comparable(::Type) = Comparable(<)
comparable(::Type) = isless
function MA.operate!(::typeof(canonical), res::SparseCoefficients)
return MA.operate!(canonical, res, comparable(key_type(res)))
end

function MA.operate!(
::typeof(canonical),
res::SparseCoefficients,
cmp::Comparable,
cmp,
)
sorted = issorted(res.basis_elements; lt = cmp)
distinct = allunique(res.basis_elements)
Expand Down

0 comments on commit 83ecdbc

Please sign in to comment.