예제 #1
0
def laurent_cascade_filter(dim, embpols, nonsols, tol, \
    nbtasks=0, prc='d', verbose=True):
    r"""
    Runs one step in the cascade homotopy defined by the embedding of
    Laurent polynomials in *embpols*, starting at the solutions in *nonsols*,
    removing the last hyperplane from *embpols* at dimension *dim*.
    The tolerance *tol* is used to split filter the solutions.
    By default, the precision *prc* is double ('d').  Other valid values
    for *prc* are 'dd' (for double double) and 'qd' (for quad double).
    If *verbose*, then some output is written to screen.
    """
    if (prc == 'd'):
        from phcpy.sets \
        import drop_variable_from_standard_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_standard_solutions as drop1sols
    elif (prc == 'dd'):
        from phcpy.sets \
        import drop_variable_from_dobldobl_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_dobldobl_solutions as drop1sols
    elif (prc == 'qd'):
        from phcpy.sets \
        import drop_variable_from_quaddobl_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_quaddobl_solutions as drop1sols
    else:
        print 'invalid value for precision as argument for prc'
        return
    if verbose:
        print 'running a cascade with %d paths ...' % len(nonsols)
    sols = laurent_cascade_step\
               (dim, embpols, nonsols, precision=prc, tasks=nbtasks)
    dimslackvar = 'zz' + str(dim)
    embdown = drop1poly(embpols, dimslackvar)
    solsdrop = drop1sols(sols, len(embpols), dimslackvar)
    if dim <= 1:
        return (embdown[:-1], solsdrop)
    else:
        (sols0, sols1) = split_filter(solsdrop, dim - 1, tol, verbose)
        return (embdown[:-1], sols0, sols1)
예제 #2
0
def laurent_cascade_filter(dim, embpols, nonsols, tol, \
    nbtasks=0, prc='d', verbose=True):
    r"""
    Runs one step in the cascade homotopy defined by the embedding of
    Laurent polynomials in *embpols*, starting at the solutions in *nonsols*,
    removing the last hyperplane from *embpols* at dimension *dim*.
    The tolerance *tol* is used to split filter the solutions.
    By default, the precision *prc* is double ('d').  Other valid values
    for *prc* are 'dd' (for double double) and 'qd' (for quad double).
    If *verbose*, then some output is written to screen.
    """
    if(prc == 'd'):
        from phcpy.sets \
        import drop_variable_from_standard_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_standard_solutions as drop1sols
    elif(prc == 'dd'):
        from phcpy.sets \
        import drop_variable_from_dobldobl_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_dobldobl_solutions as drop1sols
    elif(prc == 'qd'):
        from phcpy.sets \
        import drop_variable_from_quaddobl_laurent_polynomials as drop1poly
        from phcpy.sets \
        import drop_coordinate_from_quaddobl_solutions as drop1sols
    else:
        print 'invalid value for precision as argument for prc'
        return
    if verbose:
        print 'running a cascade with %d paths ...' % len(nonsols)
    sols = laurent_cascade_step\
               (dim, embpols, nonsols, precision=prc, tasks=nbtasks)
    dimslackvar = 'zz' + str(dim)
    embdown = drop1poly(embpols, dimslackvar)
    solsdrop = drop1sols(sols, len(embpols), dimslackvar)
    if dim <= 1:
        return (embdown[:-1], solsdrop)
    else:
        (sols0, sols1) = split_filter(solsdrop, dim-1, tol, verbose)
        return (embdown[:-1], sols0, sols1)