Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha Demin committed Sep 21, 2024
1 parent 668d8ff commit ba70fc1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/monomials/orderings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,20 @@ function map_variables(vars, varmap)
# Fallback to string representation
varmap_str = Dict(string(k) => v for (k, v) in varmap)
vars_str = map(string, vars)
!isempty(setdiff(vars_str, collect(keys(varmap_str)))) && throw(DomainError("Invalid monomial ordering."))
!isempty(setdiff(vars_str, collect(keys(varmap_str)))) &&
throw(DomainError("Invalid monomial ordering."))
return map(v -> varmap_str[v], vars_str)
end
map(v -> varmap[v], vars)
end

ordering_transform(ord::InputOrdering, varmap::AbstractDict) = InputOrdering()
ordering_transform(ord::Lex, varmap::AbstractDict) = Lex(map_variables(ordering_variables(ord), varmap))
ordering_transform(ord::DegLex, varmap::AbstractDict) = DegLex(map_variables(ordering_variables(ord), varmap))
ordering_transform(ord::DegRevLex, varmap::AbstractDict) = DegRevLex(map_variables(ordering_variables(ord), varmap))
ordering_transform(ord::Lex, varmap::AbstractDict) =
Lex(map_variables(ordering_variables(ord), varmap))
ordering_transform(ord::DegLex, varmap::AbstractDict) =
DegLex(map_variables(ordering_variables(ord), varmap))
ordering_transform(ord::DegRevLex, varmap::AbstractDict) =
DegRevLex(map_variables(ordering_variables(ord), varmap))

function ordering_transform(ord::WeightedOrdering, varmap::AbstractDict)
WeightedOrdering(Dict(map_variables(ordering_variables(ord), varmap) .=> ord.weights))
Expand Down

0 comments on commit ba70fc1

Please sign in to comment.