mirror of
https://github.com/BachoSeven/homotopy-continuation.git
synced 2026-10-06 22:55:15 +00:00
minor
This commit is contained in:
@@ -19,9 +19,7 @@ module RandomPoly
|
||||
# of degree d_i randomly chosen between 1 and max_degree
|
||||
function random_system(m, max_degree)
|
||||
d = rand(1:max_degree, m)
|
||||
println("generating system")
|
||||
random_polys = [random_poly(d[i], m) for i in 1:m]
|
||||
println("done generating system")
|
||||
|
||||
return random_polys
|
||||
end
|
||||
|
||||
@@ -41,10 +41,9 @@ end
|
||||
end
|
||||
|
||||
# Main homotopy continuation loop
|
||||
function solve(F, (G, roots)=start_system(F))
|
||||
function solve(F, G, roots)
|
||||
H = homotopy(F, G)
|
||||
|
||||
println("Number of roots: ", length(roots))
|
||||
result = Array{Future}(undef, length(roots))
|
||||
for i in eachindex(roots)
|
||||
result[i] = @spawn compute_root(H, roots[i])
|
||||
@@ -69,11 +68,13 @@ end
|
||||
|
||||
R = random_system(3, 5)
|
||||
println("System: ", R)
|
||||
(G, roots)=start_system(F)
|
||||
println("Number of roots: ", length(roots))
|
||||
|
||||
# Parallel execution
|
||||
println("Parallel")
|
||||
println("PARALLEL")
|
||||
@time begin
|
||||
(sol, steps) = solve(R)
|
||||
(sol, steps) = solve(R, G, roots)
|
||||
end
|
||||
println("Number of steps: ", steps)
|
||||
# converting sR to array of arrays instead of a matrix
|
||||
@@ -84,11 +85,11 @@ vars = variables(R)
|
||||
println("Solutions: ", sol)
|
||||
println("Norms (lower = better): ", [norm([f(vars => s) for f in R]) for s in sol])
|
||||
|
||||
# Single process execution
|
||||
println("Single process")
|
||||
# Single execution
|
||||
println("SINGLE")
|
||||
rmprocs(workers())
|
||||
@time begin
|
||||
(sol, steps) = solve(R)
|
||||
(sol, steps) = solve(R, G, roots)
|
||||
end
|
||||
println("Number of steps: ", steps)
|
||||
# converting sR to array of arrays instead of a matrix
|
||||
|
||||
Reference in New Issue
Block a user