Given a 2-d numpy array X of dimension [m,m] and a 1-d array Y of length m, I wish to calculate a resulting 2-d matrix, P also of dimension [m,m], whose [i,j] element is obtained using the following operation:
P[i][j] = Y[i] * Y[j] * np.dot(X[i],X[j])
Is there a faster way rather than applying a nested for loop?