Skip to content

Commit c465e4d

Browse files
authored
Update for MultivariatePolynomials#master (#33)
* Update for MultivariatePolynomials#master * Fix show tests * Fix test
1 parent 4ce5303 commit c465e4d

File tree

5 files changed

+32
-17
lines changed

5 files changed

+32
-17
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ jobs:
4242
${{ runner.os }}-test-${{ env.cache-name }}-
4343
${{ runner.os }}-test-
4444
${{ runner.os }}-
45+
- name: MultivariatePolynomials#master
46+
shell: julia --project=@. {0}
47+
run: |
48+
using Pkg
49+
Pkg.add(PackageSpec(name="MultivariatePolynomials", rev="master"))
50+
- name: DynamicPolynomials#master
51+
shell: julia --project=@. {0}
52+
run: |
53+
using Pkg
54+
Pkg.add(PackageSpec(name="DynamicPolynomials", rev="master"))
55+
- name: TypedPolynomials#master
56+
shell: julia --project=@. {0}
57+
run: |
58+
using Pkg
59+
Pkg.add(PackageSpec(name="TypedPolynomials", rev="master"))
4560
- uses: julia-actions/julia-buildpkg@v1
4661
- uses: julia-actions/julia-runtest@v1
4762
with:

src/groebner.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function spolynomial(p::APL, q::APL)
1515
ltp = leadingterm(p)
1616
# `MA.operate` ensures that the returned value can be mutated without
1717
# affecting either `a` or `p`.
18-
a = MA.operate(*, MP._div(m, monomial(ltp)), p)
18+
a = MA.operate(*, MP.div_multiple(m, monomial(ltp)), p)
1919
ad = MA.operate!!(/, a, MP.coefficient(ltp))
2020
ltq = leadingterm(q)
21-
b = MA.operate(*, MP._div(m, monomial(ltq)), q)
21+
b = MA.operate(*, MP.div_multiple(m, monomial(ltq)), q)
2222
bd = MA.operate!!(/, b, MP.coefficient(ltq))
2323
return MA.operate!!(-, ad, bd)
2424
end

src/schur.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function _clusterordschur(M::AbstractMatrix{<:Real}, ɛ)
6767
σ = sortperm(λ)
6868

6969
# For eigenvalues not clustered yet, their eigenvalues is quite large.
70-
# Therefore, if we cluster all i, j close enough at once we migth cluster too much
70+
# Therefore, if we cluster all i, j close enough at once we might cluster too much
7171
# The technique used here is to cluster only the closest pair.
7272
# Once they are matched, a new atol is computed and if the cluster is complete,
7373
# this atol will be small which will avoid addition of new eigenvalues.

test/macro.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ struct DummySolver <: SemialgebraicSets.AbstractAlgebraicSolver end
1313
# Algebraic set forces `Rational{BigInt}`
1414
@test S isa BasicSemialgebraicSet{Rational{BigInt}}
1515
@test S == basicsemialgebraicset(S.V, S.p)
16-
@test sprint(show, S) == "{ (x, y) | x - y = 0, x^2 - y = 0, x^2*y - 1//1 ≥ 0, x + y - 1//1 ≥ 0 }"
17-
@test sprint(show, MIME"text/plain"(), S) == "Basic semialgebraic Set defined by 2 equalities\n x - y = 0\n x^2 - y = 0\n2 inequalities\n x^2*y - 1//1 ≥ 0\n x + y - 1//1 ≥ 0\n"
16+
@test sprint(show, S) == "{ (x, y) | -y + x = 0, -y + x^2 = 0, -1//1 + x^2*y ≥ 0, -1//1 + y + x ≥ 0 }"
17+
@test sprint(show, MIME"text/plain"(), S) == "Basic semialgebraic Set defined by 2 equalities\n -y + x = 0\n -y + x^2 = 0\n2 inequalities\n -1//1 + x^2*y ≥ 0\n -1//1 + y + x ≥ 0\n"
1818
@test S.V isa AlgebraicSet{Rational{BigInt}}
19-
@test sprint(show, S.V) == "{ (x, y) | x - y = 0, x^2 - y = 0 }"
20-
@test sprint(show, MIME"text/plain"(), S.V) == "Algebraic Set defined by 2 equalities\n x - y = 0\n x^2 - y = 0\n"
19+
@test sprint(show, S.V) == "{ (x, y) | -y + x = 0, -y + x^2 = 0 }"
20+
@test sprint(show, MIME"text/plain"(), S.V) == "Algebraic Set defined by 2 equalities\n -y + x = 0\n -y + x^2 = 0\n"
2121
@test S === MultivariatePolynomials.changecoefficienttype(S, Rational{BigInt})
2222
@test S.V === MultivariatePolynomials.changecoefficienttype(S.V, Rational{BigInt})
2323
@test S.V.I === convert(typeof(S.V.I), S.V.I)
@@ -45,18 +45,18 @@ struct DummySolver <: SemialgebraicSets.AbstractAlgebraicSolver end
4545

4646
@testset "Different variables" begin
4747
T = (@set x == x^2 && y <= y^2)
48-
@test sprint(show, T) == "{ (x, y) | -x^2 + x = 0, y^2 - y ≥ 0 }"
49-
@test sprint(show, MIME"text/plain"(), T) == "Basic semialgebraic Set defined by 1 equalitty\n -x^2 + x = 0\n1 inequalitty\n y^2 - y ≥ 0\n"
48+
@test sprint(show, T) == "{ (x, y) | x - x^2 = 0, -y + y^2 ≥ 0 }"
49+
@test sprint(show, MIME"text/plain"(), T) == "Basic semialgebraic Set defined by 1 equalitty\n x - x^2 = 0\n1 inequalitty\n -y + y^2 ≥ 0\n"
5050
end
5151
end
5252
@testset "Basic with no equality" begin
5353
S = @set x + y 1 && x y
54-
@test sprint(show, S) == "{ (x, y) | x + y - 1 ≥ 0, -x + y ≥ 0 }"
54+
@test sprint(show, S) == "{ (x, y) | -1 + y + x ≥ 0, y - x ≥ 0 }"
5555
@test sprint(show, MIME"text/plain"(), S) == """
5656
Basic semialgebraic Set defined by no equality
5757
2 inequalities
58-
x + y - 1 ≥ 0
59-
-x + y ≥ 0
58+
-1 + y + x ≥ 0
59+
y - x ≥ 0
6060
"""
6161
@test sprint(show, S.V) == "R^n"
6262
@test sprint(show, MIME"text/plain"(), S.V) == """
@@ -77,10 +77,10 @@ Algebraic Set defined by no equality
7777
end
7878
@testset "Basic with fixed variables" begin
7979
S = @set x == 1 && x x^2
80-
@test sprint(show, S) == "{ (x) | x - 1 = 0, x^2 - x ≥ 0 }"
81-
@test sprint(show, MIME"text/plain"(), S) == "Basic semialgebraic Set defined by 1 equalitty\n x - 1 = 0\n1 inequalitty\n x^2 - x ≥ 0\n"
82-
@test sprint(show, S.V) == "{ (x) | x - 1 = 0 }"
83-
@test sprint(show, MIME"text/plain"(), S.V) == "Algebraic Set defined by 1 equalitty\n x - 1 = 0\n"
80+
@test sprint(show, S) == "{ (x) | -1 + x = 0, -x + x^2 ≥ 0 }"
81+
@test sprint(show, MIME"text/plain"(), S) == "Basic semialgebraic Set defined by 1 equalitty\n -1 + x = 0\n1 inequalitty\n -x + x^2 ≥ 0\n"
82+
@test sprint(show, S.V) == "{ (x) | -1 + x = 0 }"
83+
@test sprint(show, MIME"text/plain"(), S.V) == "Algebraic Set defined by 1 equalitty\n -1 + x = 0\n"
8484

8585
S = @set x == 1 && x y && 2 == y
8686
@test S isa BasicSemialgebraicSet{Int}

test/solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ end
134134
@test iszerodimensional(V)
135135
iszd, B = monomialbasis(V.I)
136136
@test iszd
137-
@test B == [y^3*z, x*y*z, y^3, y^2*z, x*y, x*z, y^2, y*z, x, y, z, 1]
137+
@test B == [1, z, y, x, y*z, y^2, x*z, x*y, y^2*z, y^3, x*y*z, y^3*z]
138138
testelements(V, [[0, 1, 2], [0, 1, -√2], [1, 0, -√2], [1, 0, 2], [-√2/2, -√2/2, 2], [2/2, 2/2, -√2]])
139139
end
140140

0 commit comments

Comments
 (0)