I have two numpy arrays :
- M of shape (n_nodes, n_nodes, n_clusters, n_clusters)
- tau of shape (n_nodes, n_clusters)
I want to get the matrix K such that
K[i,j,k,l] = M[i,j]**tau[j,l]
I want to do it without any for loop. I triedK = M ** tau[:, np.newaxis, :, np.newaxis]
but it doesn't work Anyone has an answer please ?
K = M ** tau[:, np.newaxis, :, np.newaxis]