Skip to content

Commit f443719

Browse files
authored
Fix in staircase dependence (#60)
* Fix in staircase dependence * Fix format
1 parent 89b3dfe commit f443719

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

src/dependence.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function StaircaseDependence(
161161
border = shift * mono
162162
if isnothing(_monomial_index(standard, border)) &&
163163
isnothing(_monomial_index(corners, border))
164-
i = _index(basis, mono)
164+
i = _index(basis, border)
165165
if isnothing(i) || !is_dependent(i)
166166
push!(independent_border, border)
167167
else

test/extract.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ end
2424

2525
Mod.@polyvar x
2626

27-
function testelements(X, Y, atol)
28-
@test length(X) == length(Y)
29-
for y in Y
30-
@test any(x -> isapprox(x, y, atol = atol), X)
31-
end
32-
end
27+
include("utils.jl")
3328

3429
function _atoms(atoms, rank_check, solver)
3530
Mod.@polyvar x[1:2]

test/null.jl

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,31 @@ import MultivariateMoments as MM
77

88
b(x) = MB.MonomialBasis(x)
99

10-
function test_univariate_infinity(x)
10+
include("utils.jl")
11+
12+
function test_dreesen1(x, y)
13+
matrix = Float64[
14+
1 0 0 0
15+
0 1 0 0
16+
0 0 1 0
17+
0 0 0 1
18+
0 0 1 0
19+
1 0 0 0
20+
]
21+
basis = MB.MonomialBasis([1, y, x, y^2, x * y, x^2])
22+
null = MM.MacaulayNullspace(matrix, basis, 1e-8)
23+
@testset "$D" for D in [MM.AnyDependence, MM.StaircaseDependence]
24+
@testset "$name" for (solver, name) in [
25+
(MM.ShiftNullspace{D}(), "shift"),
26+
#(MM.Echelon{D}(fallback = false), "echelon no fallback"),
27+
#(MM.Echelon{D}(fallback = true), "echelon fallback"),
28+
]
29+
@test isnothing(MM.solve(null, solver))
30+
end
31+
end
32+
end
33+
34+
function _test_univariate_infinity(x, y)
1135
Z = Float64[
1236
1 0
1337
2 0
@@ -51,12 +75,12 @@ using Test
5175

5276
import DynamicPolynomials
5377
@testset "DynamicPolynomials" begin
54-
DynamicPolynomials.@polyvar x
55-
TestNull.runtests(x)
78+
DynamicPolynomials.@polyvar x y
79+
TestNull.runtests(x, y)
5680
end
5781

5882
import TypedPolynomials
5983
@testset "TypedPolynomials" begin
60-
TypedPolynomials.@polyvar x
61-
TestNull.runtests(x)
84+
TypedPolynomials.@polyvar x y
85+
TestNull.runtests(x, y)
6286
end

test/utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function testelements(X, Y, atol)
2+
@test length(X) == length(Y)
3+
for y in Y
4+
@show y
5+
@test any(x -> isapprox(x, y, atol = atol), X)
6+
end
7+
end

0 commit comments

Comments
 (0)