def loopy_app(embed_vec, R):
    tot_vec = embed_vec.shape[0]
p = np.zeros(tot_vec)
for i in range(tot_vec - 1):
    for j in range(i + 1, tot_vec):
        if np.linalg.norm(embed_vec[i] - embed_vec[j]) < R:
            p[i] += 1
return p
how to compare entries in numpy array with each other efficiently?