Ejemplo n.º 1
0
def store_quaddobl_tropism(dim, idx, wnd, dir, err):
    r"""
    Stores the tropism, given in standard double precision,
    with *dim* doubles as coordinates in the list *dir*, the error in *err*,
    and the winding number *wnd*, at position *idx*.
    The index *idx* must be in the range 1..quaddobl_size().
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_store_quaddobl_tropism as store
    data = [x for x in dir]
    data.append(err)
    strdata = str(data)
    store(dim, idx, wnd, strdata)
Ejemplo n.º 2
0
def store_quaddobl_tropism(dim, idx, wnd, dir, err):
    r"""
    Stores the tropism, given in standard double precision,
    with *dim* doubles as coordinates in the list *dir*, the error in *err*,
    and the winding number *wnd*, at position *idx*.
    The index *idx* must be in the range 1..quaddobl_size().
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_store_quaddobl_tropism as store
    data = [x for x in dir]
    data.append(err)
    strdata = str(data)
    store(dim, idx, wnd, strdata)
Ejemplo n.º 3
0
def store_dobldobl_tropism(dim, idx, wnd, dir, err):
    """
    Stores the tropism, given in standard double precision,
    with dim doubles as coordinates in the list dir, the error in err,
    and the winding number wnd, at position idx.
    The index idx must be in the range 1..dobldobl_size().
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_store_dobldobl_tropism as store
    data = [x for x in dir]
    data.append(err)
    strdata = str(data)
    store(dim, idx, wnd, strdata)
Ejemplo n.º 4
0
def store_dobldobl_tropism(dim, idx, wnd, dir, err):
    """
    Stores the tropism, given in standard double precision,
    with dim doubles as coordinates in the list dir, the error in err,
    and the winding number wnd, at position idx.
    The index idx must be in the range 1..dobldobl_size().
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_store_dobldobl_tropism as store

    data = [x for x in dir]
    data.append(err)
    strdata = str(data)
    store(dim, idx, wnd, strdata)
Ejemplo n.º 5
0
def standard_initialize(nbt, dim, wnd, dir, err):
    """
    Initializes the direction vectors computed in double precision,
    along with estimates for their winding numbers and errors.
    On entry are the following five parameters:
    nbt : the number of direction vectors;
    dim : the number of coordinates in each vector;
    wnd : a list of integer values for the winding numbers, as many as nbt;
    dir : a list of lists of doubles with the coordinates of the directions,
    each inner list has dim doubles and nbt vectors are given;
    err : a list of nbt doubles.
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_standard_initialize as store
    flat = []
    for vec in dir:
        flat = flat + vec
    data = wnd + flat + err
    store(nbt, dim, str(data))
Ejemplo n.º 6
0
def standard_initialize(nbt, dim, wnd, dir, err):
    """
    Initializes the direction vectors computed in double precision,
    along with estimates for their winding numbers and errors.
    On entry are the following five parameters:
    nbt : the number of direction vectors;
    dim : the number of coordinates in each vector;
    wnd : a list of integer values for the winding numbers, as many as nbt;
    dir : a list of lists of doubles with the coordinates of the directions,
    each inner list has dim doubles and nbt vectors are given;
    err : a list of nbt doubles.
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_standard_initialize as store

    flat = []
    for vec in dir:
        flat = flat + vec
    data = wnd + flat + err
    store(nbt, dim, str(data))
Ejemplo n.º 7
0
def quaddobl_initialize(nbt, dim, wnd, dir, err):
    r"""
    Initializes the direction vectors computed in quad double precision,
    along with estimates for their winding numbers and errors.
    On entry are the following five parameters:

    *nbt*: the number of direction vectors;

    *dim*: the number of coordinates in each vector;

    *wnd*: a list of integer values for the winding numbers, as many as *nbt*;

    *dir*: a list of lists of quad doubles with the coordinates of the 
    directions, each inner list has *dim* quad doubles and *nbt* vectors;

    *err*: a list of nbt quad doubles.
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_quaddobl_initialize as store
    flat = []
    for vec in dir:
        flat = flat + vec
    data = wnd + flat + err
    store(nbt, dim, str(data))
Ejemplo n.º 8
0
def quaddobl_initialize(nbt, dim, wnd, dir, err):
    r"""
    Initializes the direction vectors computed in quad double precision,
    along with estimates for their winding numbers and errors.
    On entry are the following five parameters:

    *nbt*: the number of direction vectors;

    *dim*: the number of coordinates in each vector;

    *wnd*: a list of integer values for the winding numbers, as many as *nbt*;

    *dir*: a list of lists of quad doubles with the coordinates of the 
    directions, each inner list has *dim* quad doubles and *nbt* vectors;

    *err*: a list of nbt quad doubles.
    """
    from phcpy.phcpy2c2 import py2c_numbtrop_quaddobl_initialize as store
    flat = []
    for vec in dir:
        flat = flat + vec
    data = wnd + flat + err
    store(nbt, dim, str(data))
Ejemplo n.º 9
0
def store_standard_tableau(poltab, verbose=False):
    r"""
    Stores the polynomial system given in the list of lists *poltab* in
    the container for systems with coefficients in standard double precision.
    Every polynomial in the system is represented by a list of tuples.
    A monomial is represented by a 2-tuple:

    1. the coefficient of the monomial is a complex number,

    2. the exponent are a tuple of natural numbers.

    For example, the system x^2 - y = 0, x^3 - z = 0 is represented as
    [[((1+0j), (2, 0, 0)), ((-1+0j), (0, 1, 0))], \
    [((1+0j), (3, 0, 0)), ((-1+0j), (0, 0, 1))]].
    """
    from phcpy.phcpy2c2 import py2c_tabform_store_standard_tableau as store
    neq = len(poltab)  # number of equations
    if verbose:
        print 'number of equations :', neq
    if neq > 0:
        nvr = len(poltab[0][0][1])  # number of variables
        if verbose:
            print 'number of variables :', nvr
        nbt = [len(pol) for pol in poltab]  # number of terms
        if verbose:
            print 'number of terms :', nbt
        cff = [[c for (c, e) in p] for p in poltab]  # coefficients
        if verbose:
            print 'the coefficients on input :', cff
        flatcff = sum(cff, [])  # flatten list of lists
        frimcff = sum([[x.real, x.imag] for x in flatcff], [])
        if verbose:
            print 'flat list of coefficients :', frimcff
        xps = [[e for (c, e) in p] for p in poltab]  # exponents
        if verbose:
            print 'the exponents on input :', xps
        txps = sum(xps, [])  # list of tuples
        lxps = [list(x) for x in txps]  # list of lists
        flatxps = sum(lxps, [])  # flatten list of lists
        if verbose:
            print 'flat list of exponents :', flatxps
        strnbt = str(nbt)
        strcff = str(frimcff)
        strxps = str(flatxps)
        fail = store(neq, nvr, len(strnbt), strnbt, \
                     len(strcff), strcff, len(strxps), strxps, int(verbose))