Make results reproducible
This commit is contained in:
parent
8d8bc9162c
commit
ae5db0f9ea
2 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
module Numerical
|
||||
|
||||
using Random: default_rng
|
||||
using LinearAlgebra
|
||||
using AbstractAlgebra
|
||||
using HomotopyContinuation:
|
||||
|
@ -28,16 +29,16 @@ end
|
|||
|
||||
# --- sampling ---
|
||||
|
||||
function real_samples(F::AbstractSystem, dim)
|
||||
function real_samples(F::AbstractSystem, dim; rng = default_rng())
|
||||
# choose a random real hyperplane of codimension `dim` by intersecting
|
||||
# hyperplanes whose normal vectors are uniformly distributed over the unit
|
||||
# sphere
|
||||
# [to do] guard against the unlikely event that one of the normals is zero
|
||||
normals = transpose(hcat(
|
||||
(normalize(randn(nvariables(F))) for _ in 1:dim)...
|
||||
(normalize(randn(rng, nvariables(F))) for _ in 1:dim)...
|
||||
))
|
||||
cut = LinearSubspace(normals, fill(0., dim))
|
||||
filter(isreal, results(witness_set(F, cut)))
|
||||
filter(isreal, results(witness_set(F, cut, seed = 0x1974abba)))
|
||||
end
|
||||
|
||||
AbstractAlgebra.evaluate(pt::Point, vals::Vector{<:RingElement}) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue