m, n = pts.shape
idx1 = np.arange(n)[:, (None)] + np.arange(n) * (n * (n + 2))
idx2 = idx1 + np.arange(m)[:, (None), (None)] * (n * n * (n + 1))
idx3 = n * n + np.arange(n) * (n * (n + 1) + 1) + np.arange(m)[:, (None)] * (
    n * n * (n + 1))
out = np.zeros((m * n, n * (n + 1)), dtype=pts.dtype)
out.ravel()[idx2] = pts[:, :, (None)]
out.ravel()[idx3] = 1
Creating this block matrix in numpy