Beispiel #1
0
def store_multprec_system(polsys, decimals, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for multiprecision arithmetic.
    The parameter *decimals* equals the number of decimal places
    in the working precision for the parsing of the strings in *polsys*.
    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_multprec_system(pols, nbvar=2)**
    will store the polynomials in pols in the multiprecision systems container.
    """
    from phcpy.phcpy2c3 import py2c_syscon_clear_multprec_system
    from phcpy.phcpy2c3 \
        import py2c_syscon_initialize_number_of_multprec_polynomials
    from phcpy.phcpy2c3 import py2c_syscon_store_multprec_polynomial
    py2c_syscon_clear_multprec_system()
    dim = len(polsys)
    fail = 0
    py2c_syscon_initialize_number_of_multprec_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if (len(nbvar) == 0):
            fail = py2c_syscon_store_multprec_polynomial\
                       (nchar, dim, cnt+1, decimals, pol)
        else:
            nvr = list(nbvar.values())[0]
            fail = py2c_syscon_store_multprec_polynomial\
                       (nchar, nvr, cnt+1, decimals, pol)
        if (fail != 0):
            break
    return fail
Beispiel #2
0
def store_multprec_system(polsys, decimals, **nbvar):
    r"""
    Stores the polynomials represented by the list of strings in *polsys*
    into the systems container for multiprecision arithmetic.
    The parameter *decimals* equals the number of decimal places
    in the working precision for the parsing of the strings in *polsys*.
    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_multprec_system(pols, nbvar=2)**
    will store the polynomials in pols in the multiprecision systems container.
    """
    from phcpy.phcpy2c3 import py2c_syscon_clear_multprec_system
    from phcpy.phcpy2c3 \
        import py2c_syscon_initialize_number_of_multprec_polynomials
    from phcpy.phcpy2c3 import py2c_syscon_store_multprec_polynomial
    py2c_syscon_clear_multprec_system()
    dim = len(polsys)
    py2c_syscon_initialize_number_of_multprec_polynomials(dim)
    for cnt in range(0, dim):
        pol = polsys[cnt]
        nchar = len(pol)
        if(len(nbvar) == 0):
            fail = py2c_syscon_store_multprec_polynomial\
                       (nchar, dim, cnt+1, decimals, pol)
        else:
            nvr = list(nbvar.values())[0]
            fail = py2c_syscon_store_multprec_polynomial\
                       (nchar, nvr, cnt+1, decimals, pol)
        if(fail != 0):
            break
    return fail