def meshnd(D, N):
    tups = []

    def _compute_points_helper(x, C, stick, d):
        # Recursively compute the set of points for partial vector x
        # with "count" points in the (d-1) dimension

        if d == D:
            tups.append(x)
        else:
            for c, xd in enumerate(np.linspace(0., stick, num=C)):
                _compute_points_helper(x + (xd,), C-c, stick-xd, d+1)

    # Start
    _compute_points_helper((), N, 1.0, 1)

    # Convert tups to array and complete the last dimension
    tups = np.array(tups)
    tups = np.hstack((tups, (tups.sum(axis=1) - 1.0)[:,None]))

    return tups
dataset/ETHPy150Open HIPS/pgmult/pgmult/internals/simplex.py/meshnd/swapped operands of `-`