I am interested in calculating a large NumPy array. I have a large array A that contains a bunch of numbers. I want to calculate the sum of various combinations of these numbers. The data structure is as follows:
A = np.random.uniform(0,1, (3743, 1388, 3)) Combinations = np.random.randint(0,3, (306,3)) Final_Product = np.array([ np.sum( A*cb, axis=2) for cb in Combinations])
My question is, is there a more elegant and efficient way to count data? I find it difficult to work with np.dot() when a three-dimensional array is involved.
If this helps, the Final_Product form Final_Product ideally be (3743, 306, 1388). Final_Product has the form (306, 3743, 1388), so I can just redo it to get there.
source share