Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
On return are the string representations of the solutions
computed at the end of the paths.
"""
from phcpy2c import py2c_copy_dobldobl_container_to_target_system
from phcpy2c import py2c_copy_dobldobl_container_to_start_system
from phcpy2c import py2c_copy_dobldobl_container_to_start_solutions
from phcpy2c import py2c_create_dobldobl_homotopy
from phcpy2c import py2c_create_dobldobl_homotopy_with_gamma
from phcpy2c import py2c_solve_by_dobldobl_homotopy_continuation
from phcpy2c import py2c_solcon_clear_dobldobl_solutions
from phcpy2c import py2c_copy_dobldobl_target_solutions_to_container
from interface import store_dobldobl_system
from interface import store_dobldobl_solutions, load_dobldobl_solutions
store_dobldobl_system(target)
py2c_copy_dobldobl_container_to_target_system()
store_dobldobl_system(start)
py2c_copy_dobldobl_container_to_start_system()
# py2c_clear_dobldobl_homotopy()
if(gamma == 0):
py2c_create_dobldobl_homotopy()
else:
py2c_create_dobldobl_homotopy_with_gamma(gamma.real, gamma.imag)
dim = len(start)
store_dobldobl_solutions(dim, sols)
py2c_copy_dobldobl_container_to_start_solutions()
py2c_solve_by_dobldobl_homotopy_continuation(tasks)
py2c_solcon_clear_dobldobl_solutions()
py2c_copy_dobldobl_target_solutions_to_container()
return load_dobldobl_solutions()
By default, a random gamma constant is generated,
otherwise gamma must be a nonzero complex constant.
On return are the string representations of the solutions
computed at the end of the paths.
"""
from phcpy2c import py2c_copy_dobldobl_container_to_target_system
from phcpy2c import py2c_copy_dobldobl_container_to_start_system
from phcpy2c import py2c_copy_dobldobl_container_to_start_solutions
from phcpy2c import py2c_create_dobldobl_homotopy
from phcpy2c import py2c_create_dobldobl_homotopy_with_gamma
from phcpy2c import py2c_solve_by_dobldobl_homotopy_continuation
from phcpy2c import py2c_solcon_clear_dobldobl_solutions
from phcpy2c import py2c_copy_dobldobl_target_solutions_to_container
from interface import store_dobldobl_system
from interface import store_dobldobl_solutions, load_dobldobl_solutions
store_dobldobl_system(target)
py2c_copy_dobldobl_container_to_target_system()
store_dobldobl_system(start)
py2c_copy_dobldobl_container_to_start_system()
# py2c_clear_dobldobl_homotopy()
if(gamma == 0):
py2c_create_dobldobl_homotopy()
else:
py2c_create_dobldobl_homotopy_with_gamma(gamma.real, gamma.imag)
dim = len(start)
store_dobldobl_solutions(dim, sols)
py2c_copy_dobldobl_container_to_start_solutions()
py2c_solve_by_dobldobl_homotopy_continuation(tasks)
py2c_solcon_clear_dobldobl_solutions()
py2c_copy_dobldobl_target_solutions_to_container()
return load_dobldobl_solutions()
def dobldobl_deflate(system, solutions):
"""
The deflation method augments the given system with
derivatives to restore the quadratic convergence of
Newton's method at isolated singular solutions,
in double double precision.
After application of deflation with default settings,
the new approximate solutions are returned.
"""
from phcpy2c import py2c_dobldobl_deflate
from interface import store_dobldobl_system
from interface import store_dobldobl_solutions, load_dobldobl_solutions
store_dobldobl_system(system)
store_dobldobl_solutions(len(system), solutions)
py2c_dobldobl_deflate()
result = load_dobldobl_solutions()
return result
Given in embsys an embedded polynomial system and
solutions with nonzero slace variables in esols,
does one step in the homotopy cascade,
with double double precision arithmetic.
The list on return contains witness points on
lower dimensional solution components.
"""
from phcpy2c import py2c_copy_dobldobl_container_to_start_system
from phcpy2c import py2c_copy_dobldobl_container_to_start_solutions
from phcpy2c import py2c_dobldobl_cascade_homotopy
from phcpy2c import py2c_solve_by_dobldobl_homotopy_continuation
from phcpy2c import py2c_solcon_clear_dobldobl_solutions
from phcpy2c import py2c_copy_dobldobl_target_solutions_to_container
from interface import store_dobldobl_system
from interface import store_dobldobl_solutions, load_dobldobl_solutions
store_dobldobl_system(embsys)
py2c_copy_dobldobl_container_to_start_system()
store_dobldobl_solutions(len(embsys), esols)
py2c_copy_dobldobl_container_to_start_solutions()
py2c_dobldobl_cascade_homotopy()
py2c_solve_by_dobldobl_homotopy_continuation()
py2c_solcon_clear_dobldobl_solutions()
py2c_copy_dobldobl_target_solutions_to_container()
return load_dobldobl_solutions()
def dobldobl_usolve(pol, mxi, eps):
"""
Applies the method of Durand-Kerner (aka Weierstrass)
to the polynomial in the string pol, in double double precision
The maximum number of iterations is in mxi,
the requirement on the accuracy in eps.
"""
from phcpy2c import py2c_usolve_dobldobl
from interface import store_dobldobl_system, load_dobldobl_solutions
store_dobldobl_system([pol])
nit = py2c_usolve_dobldobl(mxi, eps)
rts = load_dobldobl_solutions()
return (nit, rts)
def permute_dobldobl_system(pols):
"""
Permutes the equations in the list of polynomials in pols
with coefficients in double double precision,
along the permutation used in the mixed volume computation.
"""
from phcpy2c import py2c_celcon_permute_dobldobl_system
from interface import store_dobldobl_system, load_dobldobl_system
store_dobldobl_system(pols)
py2c_celcon_permute_dobldobl_system()
return load_dobldobl_system()
def dobldobl_usolve(pol, mxi, eps):
"""
Applies the method of Durand-Kerner (aka Weierstrass)
to the polynomial in the string pol, in double double precision
The maximum number of iterations is in mxi,
the requirement on the accuracy in eps.
"""
from phcpy2c import py2c_usolve_dobldobl
from interface import store_dobldobl_system, load_dobldobl_solutions
store_dobldobl_system([pol])
nit = py2c_usolve_dobldobl(mxi, eps)
rts = load_dobldobl_solutions()
return (nit, rts)