Skip to content

Commit a52495c

Browse files
authored
Fix monomials with unsorted variables (#125)
* Fix monomials with unsorted variables * CI change * Remove test
1 parent 19019d6 commit a52495c

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
shell: julia --project=@. {0}
4747
run: |
4848
using Pkg
49-
Pkg.add(PackageSpec(name="MultivariatePolynomials", rev="master"))
49+
Pkg.add(PackageSpec(name="MultivariatePolynomials", rev="bl/sort_vars_monomials"))
5050
- uses: julia-actions/julia-buildpkg@v1
5151
- uses: julia-actions/julia-runtest@v1
5252
with:

src/monovec.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function getZfordegs(n, degs::AbstractVector{Int}, ::Type{Val{C}}, filter::Funct
137137
end
138138

139139
function MonomialVector(vars::Vector{PolyVar{true}}, degs::AbstractVector{Int}, filter::Function = x->true)
140+
vars = unique!(sort(vars, rev=true))
140141
MonomialVector{true}(vars, getZfordegs(length(vars), degs, Val{true}, z -> filter(Monomial(vars, z))))
141142
end
142143

test/mono.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ using Test
7676
@testset "MonomialVector" begin
7777
@polyvar x y
7878
@test_throws AssertionError MonomialVector{true}([x], [[1], [1,0]])
79-
@test_throws AssertionError monomials([y, x], 1:2) # should be [x, y]
8079
X = MonomialVector([x, 1, x*y])
8180
@test variables(X) == [x, y]
8281
@test X.Z == [[0, 0], [1, 0], [1, 1]]

0 commit comments

Comments
 (0)