Код: Выделить всё
import numpy as np
A = np.random.random((1000, 500))
res = sum(A[i].T @ A[i] for i in range(A.shape[0]))
Подробнее здесь: https://stackoverflow.com/questions/769 ... f-a-matrix
Код: Выделить всё
import numpy as np
A = np.random.random((1000, 500))
res = sum(A[i].T @ A[i] for i in range(A.shape[0]))