Пример #1
0
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.phcpy2c2 import py2c_product_supporting_set_structure
    from phcpy.phcpy2c2 import py2c_product_random_linear_product_system
    from phcpy.phcpy2c2 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)
Пример #2
0
def linear_product_root_count(pols, silent=False):
    """
    Given in pols a list of string representations of polynomials,
    returns a linear-product root count based on a supporting
    set structure of the polynomials in pols.  This root count is
    an upper bound for the number of isolated solutions.
    """
    from phcpy.phcpy2c2 import py2c_product_supporting_set_structure
    from phcpy.phcpy2c2 import py2c_product_write_set_structure
    from phcpy.phcpy2c2 import py2c_product_linear_product_root_count
    from phcpy.interface import store_standard_system
    store_standard_system(pols)
    py2c_product_supporting_set_structure()
    if not silent:
        print 'a supporting set structure :'
        py2c_product_write_set_structure()
    root_count = py2c_product_linear_product_root_count()
    if not silent:
        print 'the root count :', root_count
    return root_count