def store_multprec_solutions(nvar, sols): """ Stores the solutions in the list sols, represented as strings in PHCpack format into the solution container for processing with complex multiprecision arithmetic. The number n equals the number of variables. """ from phcpy.phcpy2c3 import py2c_solcon_clear_multprec_solutions from phcpy.phcpy2c3 import py2c_solcon_append_multprec_solution_string py2c_solcon_clear_multprec_solutions() for ind in range(0, len(sols)): fail = py2c_solcon_append_multprec_solution_string\ (nvar, len(sols[ind]), sols[ind]) if(fail != 0): break return fail
def store_multprec_solutions(nvar, sols): r""" Stores the solutions in the list *sols*, represented as strings in PHCpack format into the solution container for processing with complex multiprecision arithmetic. The number *nvar* equals the number of variables. """ from phcpy.phcpy2c3 import py2c_solcon_clear_multprec_solutions from phcpy.phcpy2c3 import py2c_solcon_append_multprec_solution_string py2c_solcon_clear_multprec_solutions() for ind in range(0, len(sols)): fail = py2c_solcon_append_multprec_solution_string\ (nvar, len(sols[ind]), sols[ind]) if(fail != 0): break return fail
def store_multprec_solutions(nvar, sols): r""" Stores the solutions in the list *sols*, represented as strings in PHCpack format into the solution container for processing with complex multiprecision arithmetic. The number *nvar* equals the number of variables. """ from phcpy.phcpy2c3 import py2c_solcon_clear_multprec_solutions from phcpy.phcpy2c3 import py2c_solcon_append_multprec_solution_string py2c_solcon_clear_multprec_solutions() fail = 0 for ind in range(0, len(sols)): fail = py2c_solcon_append_multprec_solution_string\ (nvar, len(sols[ind]), sols[ind]) if (fail != 0): # break print('Solution at position', ind, 'is not appended.') return fail
def multiprecision_track(target, start, sols, gamma=0, decimals=80): """ Does path tracking with multiprecision. On input are a target system, a start system with solutions, and optionally a (random) gamma constant. The target is a list of strings representing the polynomials of the target system (which has to be solved). The start is a list of strings representing the polynomials of the start system with known solutions in sols. The sols is a list of strings representing start solutions. By default, a random gamma constant is generated, otherwise gamma must be a nonzero complex constant. The number of decimal places in the working precision is given by the value of decimals. On return are the string representations of the solutions computed at the end of the paths. """ from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_target_system from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_start_system from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_start_solutions from phcpy.phcpy2c3 import py2c_create_multprec_homotopy from phcpy.phcpy2c3 import py2c_create_multprec_homotopy_with_gamma from phcpy.phcpy2c3 import py2c_solve_by_multprec_homotopy_continuation from phcpy.phcpy2c3 import py2c_solcon_clear_multprec_solutions from phcpy.phcpy2c3 import py2c_copy_multprec_target_solutions_to_container from phcpy.interface import store_multprec_system from phcpy.interface import store_multprec_solutions from phcpy.interface import load_multprec_solutions store_multprec_system(target, decimals) py2c_copy_multprec_container_to_target_system() store_multprec_system(start, decimals) py2c_copy_multprec_container_to_start_system() # py2c_clear_multprec_homotopy() if (gamma == 0): py2c_create_multprec_homotopy() else: py2c_create_multprec_homotopy_with_gamma(gamma.real, gamma.imag) dim = len(start) store_multprec_solutions(dim, sols) py2c_copy_multprec_container_to_start_solutions() py2c_solve_by_multprec_homotopy_continuation(decimals) py2c_solcon_clear_multprec_solutions() py2c_copy_multprec_target_solutions_to_container() return load_multprec_solutions()
def multiprecision_track(target, start, sols, gamma=0, decimals=80): r""" Does path tracking with multiprecision. On input are a target system, a start system with solutions, and optionally a (random) *gamma* constant. The *target* is a list of strings representing the polynomials of the target system (which has to be solved). The *start* is a list of strings representing the polynomials of the start system with known solutions in sols. The *sols* is a list of strings representing start solutions. By default, a random *gamma* constant is generated, otherwise *gamma* must be a nonzero complex constant. The number of decimal places in the working precision is given by the value of *decimals*. On return are the string representations of the solutions computed at the end of the paths. """ from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_target_system from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_start_system from phcpy.phcpy2c3 import py2c_copy_multprec_container_to_start_solutions from phcpy.phcpy2c3 import py2c_create_multprec_homotopy from phcpy.phcpy2c3 import py2c_create_multprec_homotopy_with_gamma from phcpy.phcpy2c3 import py2c_solve_by_multprec_homotopy_continuation from phcpy.phcpy2c3 import py2c_solcon_clear_multprec_solutions from phcpy.phcpy2c3 import py2c_copy_multprec_target_solutions_to_container from phcpy.interface import store_multprec_system from phcpy.interface import store_multprec_solutions from phcpy.interface import load_multprec_solutions store_multprec_system(target, decimals) py2c_copy_multprec_container_to_target_system() store_multprec_system(start, decimals) py2c_copy_multprec_container_to_start_system() # py2c_clear_multprec_homotopy() if(gamma == 0): py2c_create_multprec_homotopy() else: py2c_create_multprec_homotopy_with_gamma(gamma.real, gamma.imag) dim = len(start) store_multprec_solutions(dim, sols) py2c_copy_multprec_container_to_start_solutions() py2c_solve_by_multprec_homotopy_continuation(decimals) py2c_solcon_clear_multprec_solutions() py2c_copy_multprec_target_solutions_to_container() return load_multprec_solutions()