コード例 #1
0
def quaddobl_start_diagonal_cascade(gamma=0, tasks=0):
    r"""
    Does the path tracking to start a diagonal cascade in quad double
    precision.  For this to work, the functions quaddobl_diagonal_homotopy
    and quaddobl_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 is activated by the *tasks* parameter.
    Returns the target (system and its corresponding) solutions.
    """
    from phcpy.phcpy2c2 import py2c_create_quaddobl_homotopy
    from phcpy.phcpy2c2 import py2c_create_quaddobl_homotopy_with_gamma
    from phcpy.phcpy2c2 import py2c_solve_by_quaddobl_homotopy_continuation
    from phcpy.phcpy2c2 import py2c_solcon_clear_quaddobl_solutions
    from phcpy.phcpy2c2 import py2c_syscon_clear_quaddobl_system
    from phcpy.phcpy2c2 import py2c_copy_quaddobl_target_solutions_to_container
    from phcpy.phcpy2c2 import py2c_copy_quaddobl_target_system_to_container
    from phcpy.interface import load_quaddobl_solutions
    from phcpy.interface import load_quaddobl_system
    if (gamma == 0):
        py2c_create_quaddobl_homotopy()
    else:
        py2c_create_quaddobl_homotopy_with_gamma(gamma.real, gamma.imag)
    py2c_solve_by_quaddobl_homotopy_continuation(tasks)
    py2c_solcon_clear_quaddobl_solutions()
    py2c_syscon_clear_quaddobl_system()
    py2c_copy_quaddobl_target_solutions_to_container()
    # from phcpy.phcpy2c2 import py2c_write_quaddobl_target_system
    # print 'the quaddobl target system :'
    # py2c_write_quaddobl_target_system()
    py2c_copy_quaddobl_target_system_to_container()
    tsys = load_quaddobl_system()
    sols = load_quaddobl_solutions()
    return (tsys, sols)
コード例 #2
0
ファイル: interface.py プロジェクト: janverschelde/PHCpack
def store_quaddobl_system(polsys, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for quad 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_quaddobl_system(pols, nbvar=2)**
    will store the polynomials in pols in the quaddobl systems container.
    """
    from phcpy.phcpy2c2 import py2c_syscon_clear_quaddobl_system
    from phcpy.phcpy2c2 \
        import py2c_syscon_initialize_number_of_quaddobl_polynomials
    from phcpy.phcpy2c2 import py2c_syscon_store_quaddobl_polynomial
    py2c_syscon_clear_quaddobl_system()
    dim = len(polsys)
    fail = 0
    py2c_syscon_initialize_number_of_quaddobl_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if(len(nbvar) == 0):
            fail = py2c_syscon_store_quaddobl_polynomial(nchar, dim, cnt+1, pol)
        else:
            nvr = nbvar.values()[0]
            fail = py2c_syscon_store_quaddobl_polynomial(nchar, nvr, cnt+1, pol)
        if(fail != 0):
            break
    return fail
コード例 #3
0
ファイル: interface.py プロジェクト: lailaiflow/PHCpack
def store_quaddobl_system(polsys, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for quad 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_quaddobl_system(pols, nbvar=2)**
    will store the polynomials in pols in the quaddobl systems container.
    """
    from phcpy.phcpy2c2 import py2c_syscon_clear_quaddobl_system
    from phcpy.phcpy2c2 \
        import py2c_syscon_initialize_number_of_quaddobl_polynomials
    from phcpy.phcpy2c2 import py2c_syscon_store_quaddobl_polynomial
    py2c_syscon_clear_quaddobl_system()
    dim = len(polsys)
    fail = 0
    py2c_syscon_initialize_number_of_quaddobl_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if (len(nbvar) == 0):
            fail = py2c_syscon_store_quaddobl_polynomial(
                nchar, dim, cnt + 1, pol)
        else:
            nvr = nbvar.values()[0]
            fail = py2c_syscon_store_quaddobl_polynomial(
                nchar, nvr, cnt + 1, pol)
        if (fail != 0):
            break
    return fail
コード例 #4
0
ファイル: diagonal.py プロジェクト: janverschelde/PHCpack
def quaddobl_start_diagonal_cascade(gamma=0, tasks=0):
    r"""
    Does the path tracking to start a diagonal cascade in quad double
    precision.  For this to work, the functions quaddobl_diagonal_homotopy
    and quaddobl_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 is activated by the *tasks* parameter.
    Returns the target (system and its corresponding) solutions.
    """
    from phcpy.phcpy2c2 import py2c_create_quaddobl_homotopy
    from phcpy.phcpy2c2 import py2c_create_quaddobl_homotopy_with_gamma
    from phcpy.phcpy2c2 import py2c_solve_by_quaddobl_homotopy_continuation
    from phcpy.phcpy2c2 import py2c_solcon_clear_quaddobl_solutions
    from phcpy.phcpy2c2 import py2c_syscon_clear_quaddobl_system
    from phcpy.phcpy2c2 import py2c_copy_quaddobl_target_solutions_to_container
    from phcpy.phcpy2c2 import py2c_copy_quaddobl_target_system_to_container
    from phcpy.interface import load_quaddobl_solutions
    from phcpy.interface import load_quaddobl_system
    if(gamma == 0):
        py2c_create_quaddobl_homotopy()
    else:
        py2c_create_quaddobl_homotopy_with_gamma(gamma.real, gamma.imag)
    py2c_solve_by_quaddobl_homotopy_continuation(tasks)
    py2c_solcon_clear_quaddobl_solutions()
    py2c_syscon_clear_quaddobl_system()
    py2c_copy_quaddobl_target_solutions_to_container()
    # from phcpy.phcpy2c2 import py2c_write_quaddobl_target_system
    # print 'the quaddobl target system :'
    # py2c_write_quaddobl_target_system()
    py2c_copy_quaddobl_target_system_to_container()
    tsys = load_quaddobl_system()
    sols = load_quaddobl_solutions()
    return (tsys, sols)