I am interested in calculating a large NumPy array. I have a large array A
which contains a bunch of numbers. I want to calculate the sum of different combinati
Instead of dot
you could use tensordot. Your current method is equivalent to:
np.tensordot(A, Combinations, [2, 1]).transpose(2, 0, 1)
Note the transpose
at the end to put the axes in the correct order.
Like dot
, the tensordot
function can call down to the fast BLAS/LAPACK libraries (if you have them installed) and so should be perform well for large arrays.