Skip to content

Commit

Permalink
Fix in staircase dependence (#60)
Browse files Browse the repository at this point in the history
* Fix in staircase dependence

* Fix format
  • Loading branch information
blegat authored Jul 25, 2023
1 parent 89b3dfe commit f443719
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/dependence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function StaircaseDependence(
border = shift * mono
if isnothing(_monomial_index(standard, border)) &&
isnothing(_monomial_index(corners, border))
i = _index(basis, mono)
i = _index(basis, border)
if isnothing(i) || !is_dependent(i)
push!(independent_border, border)
else
Expand Down
7 changes: 1 addition & 6 deletions test/extract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ end

Mod.@polyvar x

function testelements(X, Y, atol)
@test length(X) == length(Y)
for y in Y
@test any(x -> isapprox(x, y, atol = atol), X)
end
end
include("utils.jl")

function _atoms(atoms, rank_check, solver)
Mod.@polyvar x[1:2]
Expand Down
34 changes: 29 additions & 5 deletions test/null.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,31 @@ import MultivariateMoments as MM

b(x) = MB.MonomialBasis(x)

function test_univariate_infinity(x)
include("utils.jl")

function test_dreesen1(x, y)
matrix = Float64[
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
0 0 1 0
1 0 0 0
]
basis = MB.MonomialBasis([1, y, x, y^2, x * y, x^2])
null = MM.MacaulayNullspace(matrix, basis, 1e-8)
@testset "$D" for D in [MM.AnyDependence, MM.StaircaseDependence]
@testset "$name" for (solver, name) in [
(MM.ShiftNullspace{D}(), "shift"),
#(MM.Echelon{D}(fallback = false), "echelon no fallback"),
#(MM.Echelon{D}(fallback = true), "echelon fallback"),
]
@test isnothing(MM.solve(null, solver))
end
end
end

function _test_univariate_infinity(x, y)
Z = Float64[
1 0
2 0
Expand Down Expand Up @@ -51,12 +75,12 @@ using Test

import DynamicPolynomials
@testset "DynamicPolynomials" begin
DynamicPolynomials.@polyvar x
TestNull.runtests(x)
DynamicPolynomials.@polyvar x y
TestNull.runtests(x, y)
end

import TypedPolynomials
@testset "TypedPolynomials" begin
TypedPolynomials.@polyvar x
TestNull.runtests(x)
TypedPolynomials.@polyvar x y
TestNull.runtests(x, y)
end
7 changes: 7 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function testelements(X, Y, atol)
@test length(X) == length(Y)
for y in Y
@show y
@test any(x -> isapprox(x, y, atol = atol), X)
end
end

2 comments on commit f443719

@blegat
Copy link
Member Author

@blegat blegat commented on f443719 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.4.3 already exists and points to a different commit"

Please sign in to comment.