Example #1
0
def run_pieri_homotopies(mdim, pdim, qdeg, planes, *pts, **opt):
    r"""
    Computes the number of *pdim*-plane producing maps of degree *qdeg*
    that meet *mdim*-planes at mdim*pdim + qdeq*(mdim+pdim) points.
    For *qdeg* = 0, there are no interpolation points in *pts*.
    """
    from phcpy.phcpy2c3 import py2c_schubert_pieri_count
    from phcpy.phcpy2c3 import py2c_schubert_pieri_homotopies
    from phcpy.phcpy2c3 import py2c_syscon_load_standard_polynomial
    from phcpy.phcpy2c3 import py2c_solcon_clear_standard_solutions
    from phcpy.phcpy2c3 import py2c_solcon_number_of_standard_solutions
    from phcpy.phcpy2c3 import py2c_solcon_length_standard_solution_string
    from phcpy.phcpy2c3 import py2c_solcon_write_standard_solution_string
    if 'verbose' not in opt:
        verbose = True        # by default, the function is verbose
    else:
        verbose = opt['verbose']
    root_count = py2c_schubert_pieri_count(mdim, pdim, qdeg)
    if verbose:
        print('Pieri root count for', (mdim, pdim, qdeg), 'is', root_count)
    strplanes = planes_to_string(planes)
    # print 'length of input data :', len(strplanes)
    if(qdeg > 0):
        strpts = points_to_string(pts[0])
        # print 'the interpolation points :', strpts
    else:
        strpts = ''
    # print 'calling py2c_pieri_homotopies ...'
    py2c_solcon_clear_standard_solutions()
    if verbose:
        print('passing %d characters for (m, p, q) = (%d, %d, %d)' \
            % (len(strplanes), mdim, pdim, qdeg))
    py2c_schubert_pieri_homotopies(mdim, pdim, qdeg, \
        len(strplanes), strplanes, strpts)
    # print 'making the system ...'
    pols = []
    if(qdeg == 0):
        for i in range(1, mdim*pdim+1):
            pols.append(py2c_syscon_load_standard_polynomial(i))
    else:
        for i in range(1, mdim*pdim+qdeg*(mdim+pdim)+1):
            pols.append(py2c_syscon_load_standard_polynomial(i))
    if verbose:
        print('the system :')
        for poly in pols:
            print(poly)
        print('root count :', root_count)
    nbsols = py2c_solcon_number_of_standard_solutions()
    sols = []
    for k in range(1, nbsols+1):
        lns = py2c_solcon_length_standard_solution_string(k)
        sol = py2c_solcon_write_standard_solution_string(k, lns)
        sols.append(sol)
    if verbose:
        print('the solutions :')
        for solution in sols:
            print(solution)
    return (pols, sols)
Example #2
0
def standard_get_solution(verbose=False):
    """
    Returns the current solution on the path, in double precision,
    which starts at the solution set with standard_set_solution().
    If verbose, then extra output is written.
    """
    from phcpy.phcpy2c3 import py2c_padcon_get_standard_solution
    from phcpy.phcpy2c3 import py2c_solcon_length_standard_solution_string
    from phcpy.phcpy2c3 import py2c_solcon_write_standard_solution_string
    py2c_padcon_get_standard_solution(1, int(verbose))
    lns = py2c_solcon_length_standard_solution_string(1)
    return py2c_solcon_write_standard_solution_string(1, lns)
Example #3
0
def next_standard_solution():
    """
    Returns the next solution on a path tracked with standard
    double precision arithmetic, provided the functions
    initialize_standard_tracker() and initialize_standard_solution()
    have been executed properly.
    """
    from phcpy.phcpy2c3 import py2c_next_standard_solution
    from phcpy.phcpy2c3 import py2c_solcon_length_standard_solution_string
    from phcpy.phcpy2c3 import py2c_solcon_write_standard_solution_string
    py2c_next_standard_solution(1)
    lns = py2c_solcon_length_standard_solution_string(1)
    sol = py2c_solcon_write_standard_solution_string(1, lns)
    return sol
Example #4
0
def next_standard_solution():
    r"""
    Returns the next solution on a path tracked with standard
    double precision arithmetic, provided the functions
    **initialize_standard_tracker()** and **initialize_standard_solution()**
    have been executed properly.
    """
    from phcpy.phcpy2c3 import py2c_next_standard_solution
    from phcpy.phcpy2c3 import py2c_solcon_length_standard_solution_string
    from phcpy.phcpy2c3 import py2c_solcon_write_standard_solution_string
    py2c_next_standard_solution(1)
    lns = py2c_solcon_length_standard_solution_string(1)
    sol = py2c_solcon_write_standard_solution_string(1, lns)
    return sol