问题 I am looking at the joblib examples but I can't figure out how to do a parallel for loop over a matrix. I am computing a pairwise distance metric between the rows of a matrix. So I was doing: N, _ = data.shape upper_triangle = [(i, j) for i in range(N) for j in range(i + 1, N)] dist_mat = np.zeros((N,N)) for (i, j) in upper_triangle: dist_mat[i,j] = dist_fun(data[i], data[j]) dist_mat[j,i] = dist_mat[i,j] where dist_fun takes two vectors and computes a distance. How can I make this loop