Beispiel #1
0
def dobldobl_start_diagonal_cascade(gamma=0, tasks=0):
    r"""
    Does the path tracking to start a diagonal cascade in double double
    precision.  For this to work, the functions dobldobl_diagonal_homotopy
    and dobldobl_diagonal_cascade_solutions must be executed successfully.
    If *gamma* equals 0 on input, then a random *gamma* constant is generated,
    otherwise, the given complex *gamma* will be used in the homotopy.
    Multitasking is available, and activated by the *tasks* parameter.
    Returns the target (system and its corresponding) solutions.
    """
    from phcpy.phcpy2c2 import py2c_create_dobldobl_homotopy
    from phcpy.phcpy2c2 import py2c_create_dobldobl_homotopy_with_gamma
    from phcpy.phcpy2c2 import py2c_solve_by_dobldobl_homotopy_continuation
    from phcpy.phcpy2c2 import py2c_solcon_clear_dobldobl_solutions
    from phcpy.phcpy2c2 import py2c_syscon_clear_dobldobl_system
    from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_solutions_to_container
    from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_system_to_container
    from phcpy.interface import load_dobldobl_solutions
    from phcpy.interface import load_dobldobl_system
    if (gamma == 0):
        py2c_create_dobldobl_homotopy()
    else:
        py2c_create_dobldobl_homotopy_with_gamma(gamma.real, gamma.imag)
    py2c_solve_by_dobldobl_homotopy_continuation(tasks)
    py2c_solcon_clear_dobldobl_solutions()
    py2c_syscon_clear_dobldobl_system()
    py2c_copy_dobldobl_target_solutions_to_container()
    # from phcpy.phcpy2c2 import py2c_write_dobldobl_target_system
    # print 'the dobldobl target system :'
    # py2c_write_dobldobl_target_system()
    py2c_copy_dobldobl_target_system_to_container()
    tsys = load_dobldobl_system()
    sols = load_dobldobl_solutions()
    return (tsys, sols)
Beispiel #2
0
def store_dobldobl_system(polsys, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for double double arithmetic.
    The number of variables is an optional argument given in *nbvar*.
    If *nbvar* is omitted, then the system is assumed to be square.
    Otherwise, suppose the number of variables equals 2 and pols is the list
    of polynomials, then the call **store_dobldobl_system(pols, nbvar=2)**
    will store the polynomials in pols in the dobldobl systems container.
    """
    from phcpy.phcpy2c2 import py2c_syscon_clear_dobldobl_system
    from phcpy.phcpy2c2 \
        import py2c_syscon_initialize_number_of_dobldobl_polynomials
    from phcpy.phcpy2c2 import py2c_syscon_store_dobldobl_polynomial
    py2c_syscon_clear_dobldobl_system()
    dim = len(polsys)
    fail = 0
    py2c_syscon_initialize_number_of_dobldobl_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if(len(nbvar) == 0):
            fail = py2c_syscon_store_dobldobl_polynomial(nchar, dim, cnt+1, pol)
        else:
            nvr = nbvar.values()[0]
            fail = py2c_syscon_store_dobldobl_polynomial(nchar, nvr, cnt+1, pol)
        if(fail != 0):
            break
    return fail
Beispiel #3
0
def store_dobldobl_system(polsys, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for double double arithmetic.
    The number of variables is an optional argument given in *nbvar*.
    If *nbvar* is omitted, then the system is assumed to be square.
    Otherwise, suppose the number of variables equals 2 and pols is the list
    of polynomials, then the call **store_dobldobl_system(pols, nbvar=2)**
    will store the polynomials in pols in the dobldobl systems container.
    """
    from phcpy.phcpy2c2 import py2c_syscon_clear_dobldobl_system
    from phcpy.phcpy2c2 \
        import py2c_syscon_initialize_number_of_dobldobl_polynomials
    from phcpy.phcpy2c2 import py2c_syscon_store_dobldobl_polynomial
    py2c_syscon_clear_dobldobl_system()
    dim = len(polsys)
    fail = 0
    py2c_syscon_initialize_number_of_dobldobl_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if (len(nbvar) == 0):
            fail = py2c_syscon_store_dobldobl_polynomial(
                nchar, dim, cnt + 1, pol)
        else:
            nvr = nbvar.values()[0]
            fail = py2c_syscon_store_dobldobl_polynomial(
                nchar, nvr, cnt + 1, pol)
        if (fail != 0):
            break
    return fail
Beispiel #4
0
def dobldobl_start_diagonal_cascade(gamma=0, tasks=0):
    r"""
    Does the path tracking to start a diagonal cascade in double double
    precision.  For this to work, the functions dobldobl_diagonal_homotopy
    and dobldobl_diagonal_cascade_solutions must be executed successfully.
    If *gamma* equals 0 on input, then a random *gamma* constant is generated,
    otherwise, the given complex *gamma* will be used in the homotopy.
    Multitasking is available, and activated by the *tasks* parameter.
    Returns the target (system and its corresponding) solutions.
    """
    from phcpy.phcpy2c2 import py2c_create_dobldobl_homotopy
    from phcpy.phcpy2c2 import py2c_create_dobldobl_homotopy_with_gamma
    from phcpy.phcpy2c2 import py2c_solve_by_dobldobl_homotopy_continuation
    from phcpy.phcpy2c2 import py2c_solcon_clear_dobldobl_solutions
    from phcpy.phcpy2c2 import py2c_syscon_clear_dobldobl_system
    from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_solutions_to_container
    from phcpy.phcpy2c2 import py2c_copy_dobldobl_target_system_to_container
    from phcpy.interface import load_dobldobl_solutions
    from phcpy.interface import load_dobldobl_system
    if(gamma == 0):
        py2c_create_dobldobl_homotopy()
    else:
        py2c_create_dobldobl_homotopy_with_gamma(gamma.real, gamma.imag)
    py2c_solve_by_dobldobl_homotopy_continuation(tasks)
    py2c_solcon_clear_dobldobl_solutions()
    py2c_syscon_clear_dobldobl_system()
    py2c_copy_dobldobl_target_solutions_to_container()
    # from phcpy.phcpy2c2 import py2c_write_dobldobl_target_system
    # print 'the dobldobl target system :'
    # py2c_write_dobldobl_target_system()
    py2c_copy_dobldobl_target_system_to_container()
    tsys = load_dobldobl_system()
    sols = load_dobldobl_solutions()
    return (tsys, sols)