|
30 | 30 | @test sort(sort.(clusters); by = first) == [[1, 5, 6], [2]] |
31 | 31 | end |
32 | 32 |
|
33 | | -function testelements(X, Y; atol = Base.rtoldefault(Float64), kwargs...) |
34 | | - @test length(X) == length(Y) |
35 | | - for y in Y |
36 | | - @test any(x -> isapprox(x, y; atol = atol, kwargs...), X) |
37 | | - end |
38 | | -end |
39 | | -function testelementstypes(X, Y; kwargs...) |
40 | | - testelements(X, Y; kwargs...) |
41 | | - for T in [Rational{Int}, Float64] |
42 | | - if X isa FixedVariablesSet |
43 | | - U = T |
44 | | - else |
45 | | - U = float(T) |
46 | | - end |
47 | | - V = similar(X, T) |
48 | | - testelements(V, Y; kwargs...) |
49 | | - @test eltype(V) == Vector{U} |
50 | | - @test collect(V) isa Vector{Vector{U}} |
51 | | - end |
52 | | -end |
53 | | - |
54 | | -# We use a fixed RNG in the tests to decrease nondeterminism. There is still nondeterminism in LAPACK though |
55 | | -using Random |
56 | | -schur_solver = ReorderedSchurMultiplicationMatricesSolver( |
57 | | - sqrt(eps(Float64)), |
58 | | - MersenneTwister(0), |
59 | | -) |
60 | | -newton_solver = NewtonTypeDiagonalization() |
| 33 | +include("utils.jl") |
61 | 34 |
|
62 | 35 | function zero_dimensional_ideal(solver) |
63 | 36 | Mod.@polyvar x y z |
|
141 | 114 | projective_zero_dimensional_ideal(newton_solver) |
142 | 115 | end |
143 | 116 |
|
144 | | -function cgt96_e51(solver) |
145 | | - ɛ = 1e-4 |
146 | | - Iɛ = [ |
147 | | - 1-ɛ 0 |
148 | | - 0 1+ɛ |
149 | | - ] |
150 | | - J = [ |
151 | | - 0 1 |
152 | | - 1 0 |
153 | | - ] |
154 | | - Z = zeros(2, 2) |
155 | | - A = [ |
156 | | - Iɛ Z |
157 | | - Z J |
158 | | - ] |
159 | | - B = [ |
160 | | - J Z |
161 | | - Z Iɛ |
162 | | - ] |
163 | | - α = 0.219 |
164 | | - return testelements( |
165 | | - SemialgebraicSets._solve_multiplication_matrices( |
166 | | - [A, B], |
167 | | - [α, 1 - α], |
168 | | - solver, |
169 | | - ), |
170 | | - [[1.0, -1.0], [1.0, 1.0], [-1.0, 1.0]]; |
171 | | - rtol = 1e-7, |
172 | | - ) |
173 | | -end |
174 | | - |
175 | | -@testset "Example 5.1 of CGT97" begin |
176 | | - @testset "Schur" begin |
177 | | - cgt96_e51(schur_solver) |
178 | | - end |
179 | | - # @testset "Newton" begin |
180 | | - # cgt96_e51(newton_solver) |
181 | | - # end |
182 | | -end |
183 | | - |
184 | 117 | function md95_e43(solver) |
185 | 118 | Mod.@polyvar x y |
186 | 119 | V = @set x^2 + 4y^4 == 4y^2 && 3x^4 + y^2 == 5x^3 solver |
|
0 commit comments