Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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_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)
# py2c_syscon_write_dobldobl_system()
result = load_dobldobl_system()
# print result
py2c_celcon_dobldobl_polyhedral_homotopy()
nbcells = py2c_celcon_number_of_cells()
py2c_solcon_clear_dobldobl_solutions()
for cell in range(1, nbcells+1):
mixvol = py2c_celcon_solve_dobldobl_start_system(cell)
if not silent:
print 'system %d has %d solutions' % (cell, mixvol)
for j in range(1, mixvol+1):
if not silent:
print '-> tracking path %d out of %d' % (j, mixvol)
py2c_celcon_track_dobldobl_solution_path(cell, j, 0)
py2c_celcon_copy_target_dobldobl_solution_to_container(cell, j)
sols = load_dobldobl_solutions()
# print sols
# newton_step(result, sols)
return (result, sols)
def dobldobl_scale_solutions(nvar, sols, cffs):
"""
Scales the solutions in the list sols using the coefficients in cffs,
using double double precision arithmetic.
The number of variables is given in the parameter nvar.
If the sols are the solution of the polynomials in the output of
dobldobl_scale_system(pols), then the solutions on return will be
solutions of the original polynomials in the list pols.
"""
from interface import store_dobldobl_solutions, load_dobldobl_solutions
from phcpy2c import py2c_scale_dobldobl_solutions
store_dobldobl_solutions(nvar, sols)
py2c_scale_dobldobl_solutions(len(cffs), str(cffs))
return load_dobldobl_solutions()
# py2c_syscon_write_dobldobl_system()
result = load_dobldobl_system()
# print result
py2c_celcon_dobldobl_polyhedral_homotopy()
nbcells = py2c_celcon_number_of_cells()
py2c_solcon_clear_dobldobl_solutions()
for cell in range(1, nbcells+1):
mixvol = py2c_celcon_solve_dobldobl_start_system(cell)
if not silent:
print 'system %d has %d solutions' % (cell, mixvol)
for j in range(1, mixvol+1):
if not silent:
print '-> tracking path %d out of %d' % (j, mixvol)
py2c_celcon_track_dobldobl_solution_path(cell, j, 0)
py2c_celcon_copy_target_dobldobl_solution_to_container(cell, j)
sols = load_dobldobl_solutions()
# print sols
# newton_step(result, sols)
return (result, sols)