Try uniformly distributed hyperplane orientations

Unit normals are uniformly distributed over the sphere.
This commit is contained in:
Aaron Fenyes 2024-02-10 15:02:26 -05:00
parent b3b7c2026d
commit 621c4c5776

View File

@ -75,26 +75,29 @@ trivial_soln[sph_z_ind] .= 1
println("trivial solutions: $trivial_soln") println("trivial solutions: $trivial_soln")
norm2 = vec -> real(dot(conj.(vec), vec)) norm2 = vec -> real(dot(conj.(vec), vec))
is_nontrivial = soln -> norm2(abs.(real.(soln)) - trivial_soln) > 1e-4*length(gens(coordring)) is_nontrivial = soln -> norm2(abs.(real.(soln)) - trivial_soln) > 1e-4*length(gens(coordring))
max_slope = 5 ##max_slope = 5
binom = Binomial(2max_slope, 1/2) ##binom = Binomial(2max_slope, 1/2)
Random.seed!(6071) Random.seed!(6071)
n_planes = 3 n_planes = 3
for through_trivial in [false, true] for through_trivial in [false, true]
samples = [] samples = []
for _ in 1:n_planes for _ in 1:n_planes
cut_matrix = rand(binom, freedom, length(gens(coordring))) .- max_slope cut_matrix = transpose(hcat(
(normalize(randn(length(gens(coordring)))) for _ in 1:freedom)...
))
##cut_matrix = rand(binom, freedom, length(gens(coordring))) .- max_slope
##cut_matrix = [ ##cut_matrix = [
## 1 1 1 1 0 1 1 0 1 1 0; ## 1 1 1 1 0 1 1 0 1 1 0;
## 1 2 1 2 0 1 1 0 1 1 0; ## 1 2 1 2 0 1 1 0 1 1 0;
## 1 1 0 1 0 1 2 0 2 0 0 ## 1 1 0 1 0 1 2 0 2 0 0
##] ##]
## [verbose] display(cut_matrix) display(cut_matrix) ## [verbose]
if through_trivial if through_trivial
cut_offset = [sum(cf[sph_z_ind]) for cf in eachrow(cut_matrix)] cut_offset = [sum(cf[sph_z_ind]) for cf in eachrow(cut_matrix)]
## [verbose] display(cut_offset) display(cut_offset) ## [verbose]
cut_subspace = LinearSubspace(cut_matrix, cut_offset) cut_subspace = LinearSubspace(cut_matrix, cut_offset)
else else
cut_subspace = LinearSubspace(cut_matrix, fill(0, freedom)) cut_subspace = LinearSubspace(cut_matrix, fill(0., freedom))
end end
wtns = witness_set(system, cut_subspace) wtns = witness_set(system, cut_subspace)
real_solns = solution.(filter(isreal, results(wtns))) real_solns = solution.(filter(isreal, results(wtns)))