def exactMatch(A, resolution=1e-8, cython=True):
    # via tha LAPJV algorithm
    A = np.array(A)
    if cython:
        [pi, cost, v, u, costMat] = LAPJV.fast_lapjv(A, resolution)
    else:
        [pi, cost, v, u, costMat] = LAPJV.lapjv(A, resolution)
    N = len(pi)
    edge_cost = A[xrange(N), pi]
    return cost, np.array(pi), np.array(edge_cost)