import numpy as np
A = np.random.randint(10, size =(ngrid*ngrid,2))B = np.random.randint(10,size =(ngrid*ngrid,2,2) )
A[jj,:] = A_tmp[jj,:]*B[jj,:,:].conjValueError: could not broadcast input array from shape (2,2)
我有一个10x250000大小的numpy数组,我需要在程序期间更改它的值,但是使用"for循环“使我的程序非常慢。这是节目中提到的部分。(L2、L1和T是其他数组):for m in range(10):
for n in range(250000):EEf1[m,n]+=2*(L2[m,0]-T[m,0])*L2[m,0]