def random_linear_product_system(pols, tosolve=True): """ Given in pols a list of string representations of polynomials, returns a random linear-product system based on a supporting set structure and its solutions as well (if tosolve). """ from phcpy.phcpy2c3 import py2c_product_supporting_set_structure from phcpy.phcpy2c3 import py2c_product_random_linear_product_system from phcpy.phcpy2c3 import py2c_product_solve_linear_product_system from phcpy.interface import store_standard_system, load_standard_system from phcpy.interface import load_standard_solutions store_standard_system(pols) py2c_product_supporting_set_structure() py2c_product_random_linear_product_system() result = load_standard_system() if not tosolve: return result py2c_product_solve_linear_product_system() sols = load_standard_solutions() return (result, sols)
def m_homogeneous_start_system(pols, partition): """ For an m-homogeneous Bezout number of a polynomial system defined by a partition of the set of unknowns, one can define a linear-product system that has exactly as many regular solutions as the Bezount number. This linear-product system can then be used as start system in a homotopy to compute all isolated solutions of any polynomial system with the same m-homogeneous structure. This function returns a linear-product start system with random coefficients and its solutions for the given polynomials in pols and the partition. """ from phcpy.phcpy2c3 import py2c_product_m_homogeneous_start_system from phcpy.phcpy2c3 import py2c_product_solve_linear_product_system from phcpy.interface import store_standard_system, load_standard_system from phcpy.interface import load_standard_solutions store_standard_system(pols) py2c_product_m_homogeneous_start_system(len(partition), partition) result = load_standard_system() py2c_product_solve_linear_product_system() sols = load_standard_solutions() return (result, sols)