Beispiel #1
0
def quaddobl_real_sweep(pols, sols, par='s', start=0.0, target=1.0):
    r"""
    A real sweep homotopy is a family of n equations in n+1 variables,
    where one of the variables is the artificial parameter s which moves
    from 0.0 to 1.0.  The last equation can then be of the form

    (1 - s)*(lambda - L[0]) + s*(lambda - L[1]) = 0 so that,

    at s = 0, the natural parameter lambda has the value L[0], and

    at s = 1, the natural parameter lambda has the value L[1].

    Thus: as s moves from 0 to 1, lambda goes from L[0] to L[1].

    All solutions in the list sols must have then the value L[0]
    for the variable lambda.
    The sweep stops when the target value for s is reached
    or when a singular solution is encountered.
    Computations happen in quad double precision.
    """
    from phcpy.interface import store_quaddobl_solutions as storesols
    from phcpy.interface import store_quaddobl_system as storesys
    nvar = len(pols) + 1
    storesys(pols, nbvar=nvar)
    storesols(nvar, sols)
    print('done storing system and solutions ...')
    from phcpy.interface import load_quaddobl_solutions as loadsols
    from phcpy.phcpy2c3 \
        import py2c_sweep_define_parameters_symbolically as define
    from phcpy.phcpy2c3 \
        import py2c_sweep_set_quaddobl_start as set_start
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_target as set_target
    (nbq, nbp) = (len(pols), 1)
    pars = [par]
    parnames = ' '.join(pars)
    nbc = len(parnames)
    print('defining the parameters ...')
    define(nbq, nvar, nbp, nbc, parnames)
    set_start(nbp, str([start, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    set_target(nbp, str([target, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    from phcpy.phcpy2c3 import py2c_sweep_quaddobl_real_run as run
    run()
    result = loadsols()
    return result
Beispiel #2
0
def quaddobl_real_sweep(pols, sols, par='s', start=0.0, target=1.0):
    r"""
    A real sweep homotopy is a family of n equations in n+1 variables,
    where one of the variables is the artificial parameter s which moves
    from 0.0 to 1.0.  The last equation can then be of the form

    (1 - s)*(lambda - L[0]) + s*(lambda - L[1]) = 0 so that,

    at s = 0, the natural parameter lambda has the value L[0], and

    at s = 1, the natural parameter lambda has the value L[1].

    Thus: as s moves from 0 to 1, lambda goes from L[0] to L[1].

    All solutions in the list sols must have then the value L[0]
    for the variable lambda.
    The sweep stops when the target value for s is reached
    or when a singular solution is encountered.
    Computations happen in quad double precision.
    """
    from phcpy.interface import store_quaddobl_solutions as storesols
    from phcpy.interface import store_quaddobl_system as storesys
    nvar = len(pols) + 1
    storesys(pols, nbvar=nvar)
    storesols(nvar, sols)
    print('done storing system and solutions ...')
    from phcpy.interface import load_quaddobl_solutions as loadsols
    from phcpy.phcpy2c3 \
        import py2c_sweep_define_parameters_symbolically as define
    from phcpy.phcpy2c3 \
        import py2c_sweep_set_quaddobl_start as set_start
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_target as set_target
    (nbq, nbp) = (len(pols), 1)
    pars = [par]
    parnames = ' '.join(pars)
    nbc = len(parnames)
    print('defining the parameters ...')
    define(nbq, nvar, nbp, nbc, parnames)
    set_start(nbp, str([start, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    set_target(nbp, str([target, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    from phcpy.phcpy2c3 import py2c_sweep_quaddobl_real_run as run
    run()
    result = loadsols()
    return result
Beispiel #3
0
def quaddobl_complex_sweep(pols, sols, nvar, pars, start, target):
    """
    For the polynomials in the list of strings pols
    and the solutions in sols for the values in the list start,
    a sweep through the parameter space will be performed
    in quad double precision to the target values of
    the parameters in the list target.
    The number of variables in the polynomials and the solutions
    must be the same and be equal to the value of nvar.
    The list of symbols in pars contains the names of the variables
    in the polynomials pols that serve as parameters.
    The size of the lists pars, start, and target must be same.
    """
    from phcpy.interface import store_quaddobl_solutions as storesols
    from phcpy.interface import store_quaddobl_system as storesys
    storesys(pols, nbvar=nvar)
    storesols(nvar, sols)
    from phcpy.interface import load_quaddobl_solutions as loadsols
    from phcpy.phcpy2c3 \
    import py2c_sweep_define_parameters_symbolically as define
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_start as set_start
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_target as set_target
    from phcpy.phcpy2c3 import py2c_sweep_quaddobl_complex_run as run
    (nbq, nbp) = (len(pols), len(pars))
    parnames = ' '.join(pars)
    nbc = len(parnames)
    define(nbq, nvar, nbp, nbc, parnames)
    print('setting the start and the target ...')
    set_start(nbp, str(start))
    set_target(nbp, str(target))
    print('calling run in quad double precision ...')
    run(0, 0.0, 0.0)
    result = loadsols()
    return result
Beispiel #4
0
def quaddobl_complex_sweep(pols, sols, nvar, pars, start, target):
    r"""
    For the polynomials in the list of strings p*ols*
    and the solutions in *sols* for the values in the list *start*,
    a sweep through the parameter space will be performed
    in quad double precision to the target values of
    the parameters in the list *target*.
    The number of variables in the polynomials and the solutions
    must be the same and be equal to the value of *nvar*.
    The list of symbols in *pars* contains the names of the variables
    in the polynomials pols that serve as parameters.
    The size of the lists *pars*, *start*, and *target* must be same.
    """
    from phcpy.interface import store_quaddobl_solutions as storesols
    from phcpy.interface import store_quaddobl_system as storesys
    storesys(pols, nbvar=nvar)
    storesols(nvar, sols)
    from phcpy.interface import load_quaddobl_solutions as loadsols
    from phcpy.phcpy2c3 \
    import py2c_sweep_define_parameters_symbolically as define
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_start as set_start
    from phcpy.phcpy2c3 \
    import py2c_sweep_set_quaddobl_target as set_target
    from phcpy.phcpy2c3 import py2c_sweep_quaddobl_complex_run as run
    (nbq, nbp) = (len(pols), len(pars))
    parnames = ' '.join(pars)
    nbc = len(parnames)
    define(nbq, nvar, nbp, nbc, parnames)
    print('setting the start and the target ...')
    set_start(nbp, str(start))
    set_target(nbp, str(target))
    print('calling run in quad double precision ...')
    run(0, 0.0, 0.0)
    result = loadsols()
    return result