コード例 #1
0
ファイル: interface.py プロジェクト: cmplx/PHCpack
def load_standard_tableau(verbose=False):
    """
    Returns the tableau form of the system stored in the container for
    double precision coefficients.
    """
    from phcpy.phcpy2c3 import py2c_tabform_load_standard_tableau as load
    neq, nvr, nbterms, coefficients, exponents = load(int(verbose))
    nbt = eval(nbterms)
    cff = eval(coefficients)
    xps = eval(exponents)
    xpsidx = 0
    cffidx = 0
    tableau = []
    for i in range(neq):
        pol = []
        for j in range(nbt[i]):
            trm = []
            for k in range(nvr):
                trm.append(xps[xpsidx])
                xpsidx = xpsidx + 1
            cfftrm = complex(cff[cffidx], cff[cffidx+1])
            cffidx = cffidx + 2
            pol.append((cfftrm ,tuple(trm)))
        tableau.append(pol)
    return (neq, nvr, tableau)
コード例 #2
0
ファイル: tropisms.py プロジェクト: lailaiflow/PHCpack
def retrieve_quaddobl_tropism(dim, idx):
    r"""
    Returns the winding number, coordinates of the direction, and its error,
    stored in quad double precision, of dimension *dim*, and index *idx*.
    The index must be in the range 1..quaddobl_size().
    Observe that the index counter starts at one and not at zero.
    """
    from ast import literal_eval
    from phcpy.phcpy2c3 \
    import py2c_numbtrop_quaddobl_retrieve_tropism as load
    (fail, wnd, strdata) = load(dim, idx)
    data = literal_eval(strdata)
    dir = [data[k] for k in range(4*dim)]
    err = [data[4*dim], data[4*dim+1], data[4*dim+2], data[4*dim+3]]
    return (wnd, dir, err)
コード例 #3
0
def retrieve_standard_tropism(dim, idx):
    """
    Returns the winding number, coordinates of the direction, and its error,
    stored in double precision, of dimension dim, and index idx.
    The index must be in the range 1..standard_size().
    Observe that the index counter starts at one and not at zero.
    """
    from ast import literal_eval
    from phcpy.phcpy2c3 \
    import py2c_numbtrop_standard_retrieve_tropism as load
    (fail, wnd, strdata) = load(dim, idx)
    data = literal_eval(strdata)
    dir = [data[k] for k in range(dim)]
    err = data[dim]
    return (wnd, dir, err)
コード例 #4
0
ファイル: tropisms.py プロジェクト: callmetaste/PHCpack
def retrieve_standard_tropism(dim, idx):
    """
    Returns the winding number, coordinates of the direction, and its error,
    stored in double precision, of dimension dim, and index idx.
    The index must be in the range 1..standard_size().
    Observe that the index counter starts at one and not at zero.
    """
    from ast import literal_eval
    from phcpy.phcpy2c3 import py2c_numbtrop_standard_retrieve_tropism as load

    (fail, wnd, strdata) = load(dim, idx)
    data = literal_eval(strdata)
    dir = [data[k] for k in range(dim)]
    err = data[dim]
    return (wnd, dir, err)
コード例 #5
0
ファイル: tropisms.py プロジェクト: lailaiflow/PHCpack
def quaddobl_retrieve(nbt, dim):
    r"""
    Given on input the number of tropisms in *nbt* and the dimension in *dim*,
    returns a tuple of three lists: the winding numbers, coordinates of
    the direction vectors, and the errrors; in quad double precision.
    """
    from ast import literal_eval
    from phcpy.phcpy2c3 import py2c_numbtrop_quaddobl_retrieve as load
    (fail, strdata) = load(nbt, dim)
    data = literal_eval(strdata)
    wnd = [int(data[k]) for k in range(nbt)]
    dirs = []
    for i in range(nbt):
        dirs.append([data[nbt+i*4*dim+j] for j in range(4*dim)])
    err = [data[nbt*(4*dim+1)+k] for k in range(4*nbt)]
    return (wnd, dirs, err)