def double_double_laurent_cascade_step(embsys, esols, tasks=0): r""" Given in *embsys* an embedded Laurent polynomial system and solutions with nonzero slack variables in *esols*, does one step in the homotopy cascade, with double double precision arithmetic. The dimension of the solution set represented by *embsys* and *esols* is the value of *dim*. The number of tasks in multithreaded path tracking is given by *tasks*. The default zero value of *tasks* indicates no multithreading. The list on return contains witness points on lower dimensional solution components. """ from phcpy.phcpy2c2 \ import py2c_copy_dobldobl_Laurent_container_to_start_system from phcpy.phcpy2c2 import py2c_copy_dobldobl_container_to_start_solutions from phcpy.phcpy2c2 import py2c_dobldobl_Laurent_cascade_homotopy from phcpy.phcpy2c2 \ import py2c_solve_by_dobldobl_Laurent_homotopy_continuation from phcpy.phcpy2c2 import py2c_solcon_clear_dobldobl_solutions from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_solutions_to_container from phcpy.interface import store_dobldobl_laurent_witness_set from phcpy.interface import load_dobldobl_solutions store_dobldobl_laurent_witness_set(len(embsys), dim, embsys, esols) py2c_copy_dobldobl_Laurent_container_to_start_system() py2c_copy_dobldobl_container_to_start_solutions() py2c_dobldobl_Laurent_cascade_homotopy() py2c_solve_by_dobldobl_Laurent_homotopy_continuation(tasks) py2c_solcon_clear_dobldobl_solutions() py2c_copy_dobldobl_target_solutions_to_container() return load_dobldobl_solutions()
def double_double_laurent_cascade_step(embsys, esols, tasks=0): r""" Given in *embsys* an embedded Laurent polynomial system and solutions with nonzero slack variables in *esols*, does one step in the homotopy cascade, with double double precision arithmetic. The dimension of the solution set represented by *embsys* and *esols* is the value of *dim*. The number of tasks in multithreaded path tracking is given by *tasks*. The default zero value of *tasks* indicates no multithreading. The list on return contains witness points on lower dimensional solution components. """ from phcpy.phcpy2c2 \ import py2c_copy_dobldobl_Laurent_container_to_start_system from phcpy.phcpy2c2 import py2c_copy_dobldobl_container_to_start_solutions from phcpy.phcpy2c2 import py2c_dobldobl_Laurent_cascade_homotopy from phcpy.phcpy2c2 \ import py2c_solve_by_dobldobl_Laurent_homotopy_continuation from phcpy.phcpy2c2 import py2c_solcon_clear_dobldobl_solutions from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_solutions_to_container from phcpy.interface import store_dobldobl_laurent_witness_set from phcpy.interface import load_dobldobl_solutions store_dobldobl_laurent_witness_set(len(embsys), dim, embsys, esols) py2c_copy_dobldobl_Laurent_container_to_start_system() py2c_copy_dobldobl_container_to_start_solutions() py2c_dobldobl_Laurent_cascade_homotopy() py2c_solve_by_dobldobl_Laurent_homotopy_continuation(tasks) py2c_solcon_clear_dobldobl_solutions() py2c_copy_dobldobl_target_solutions_to_container() return load_dobldobl_solutions()
def dobldobl_monodromy_breakup(embsys, esols, dim, \ islaurent=0, verbose=True, nbloops=0): r""" Applies the monodromy breakup algorithm in double double precision to factor the d-dimensional algebraic set represented by the embedded system *embsys* and its solutions *esols*. If the embedded polynomial system is a Laurent system, then islaurent must equal one, the default is zero. If *verbose* is False, then no output is written. If *nbloops* equals zero, then the user is prompted to give the maximum number of loops. """ from phcpy.phcpy2c2 import py2c_factor_set_dobldobl_to_mute from phcpy.phcpy2c2 import py2c_factor_set_dobldobl_to_verbose from phcpy.phcpy2c2 import py2c_factor_dobldobl_assign_labels from phcpy.phcpy2c2 import py2c_factor_initialize_dobldobl_monodromy from phcpy.phcpy2c2 import py2c_factor_initialize_dobldobl_sampler from phcpy.phcpy2c2 import py2c_factor_initialize_dobldobl_Laurent_sampler from phcpy.phcpy2c2 import py2c_factor_dobldobl_trace_grid_diagnostics from phcpy.phcpy2c2 import py2c_factor_set_dobldobl_trace_slice from phcpy.phcpy2c2 import py2c_factor_store_dobldobl_gammas from phcpy.phcpy2c2 import py2c_factor_dobldobl_track_paths from phcpy.phcpy2c2 import py2c_factor_store_dobldobl_solutions from phcpy.phcpy2c2 import py2c_factor_restore_dobldobl_solutions from phcpy.phcpy2c2 import py2c_factor_new_dobldobl_slices from phcpy.phcpy2c2 import py2c_factor_swap_dobldobl_slices from phcpy.phcpy2c2 import py2c_factor_permutation_after_dobldobl_loop from phcpy.phcpy2c2 import py2c_factor_number_of_dobldobl_components from phcpy.phcpy2c2 import py2c_factor_update_dobldobl_decomposition from phcpy.phcpy2c2 import py2c_solcon_write_dobldobl_solutions from phcpy.phcpy2c2 import py2c_solcon_clear_dobldobl_solutions from phcpy.interface import store_dobldobl_witness_set from phcpy.interface import store_dobldobl_laurent_witness_set if (verbose): print '... applying monodromy factorization with double doubles ...' py2c_factor_set_dobldobl_to_verbose() else: py2c_factor_set_dobldobl_to_mute() deg = len(esols) nvar = len(embsys) if (verbose): print 'nvar =', nvar, 'dim =', dim, 'deg =', deg if (islaurent == 1): store_dobldobl_laurent_witness_set(nvar, dim, embsys, esols) py2c_factor_dobldobl_assign_labels(nvar, deg) py2c_factor_initialize_dobldobl_Laurent_sampler(dim) else: store_dobldobl_witness_set(nvar, dim, embsys, esols) py2c_factor_dobldobl_assign_labels(nvar, deg) py2c_factor_initialize_dobldobl_sampler(dim) if (verbose): py2c_solcon_write_dobldobl_solutions() if (nbloops == 0): strnbloops = raw_input('give the maximum number of loops : ') nbloops = int(strnbloops) py2c_factor_initialize_dobldobl_monodromy(nbloops, deg, dim) py2c_factor_store_dobldobl_solutions() if (verbose): print '... initializing the grid ...' for i in range(1, 3): py2c_factor_set_dobldobl_trace_slice(i) py2c_factor_store_dobldobl_gammas(nvar) py2c_factor_dobldobl_track_paths(islaurent) py2c_factor_store_dobldobl_solutions() py2c_factor_restore_dobldobl_solutions() py2c_factor_swap_dobldobl_slices() (err, dis) = py2c_factor_dobldobl_trace_grid_diagnostics() if (verbose): print 'The diagnostics of the trace grid :' print ' largest error on the samples :', err print ' smallest distance between the samples :', dis for i in range(1, nbloops + 1): if (verbose): print '... starting loop %d ...' % i py2c_factor_new_dobldobl_slices(dim, nvar) py2c_factor_store_dobldobl_gammas(nvar) py2c_factor_dobldobl_track_paths(islaurent) py2c_solcon_clear_dobldobl_solutions() py2c_factor_store_dobldobl_gammas(nvar) py2c_factor_dobldobl_track_paths(islaurent) py2c_factor_store_dobldobl_solutions() sprm = py2c_factor_permutation_after_dobldobl_loop(deg) if (verbose): perm = eval(sprm) print 'the permutation :', perm nb0 = py2c_factor_number_of_dobldobl_components() done = py2c_factor_update_dobldobl_decomposition(deg, len(sprm), sprm) nb1 = py2c_factor_number_of_dobldobl_components() if (verbose): print 'number of factors : %d -> %d' % (nb0, nb1) deco = decomposition(deg, 'dd') print 'decomposition :', deco if (done == 1): break py2c_factor_restore_dobldobl_solutions()