我需要向量化下面的程序: y = np.empty((100, 100, 3))
x = np.empty((300,))
for i in xrange(y.shape[0]):
for j in xrange(y.shape[1]):
y[i, j, 0] = x[y[i, j, 0]]
當然,在我的例子中,我們假設Y [:,:,:] < = 299 矢量,據我知
爲什麼這個代碼 def fun(t1,t):
v = np.array([t,t1])
M = np.matrix([[0,0],[0,0]])
a = np.dot(scipy.linalg.expm(M, q=0),v)
return a[0]
x = np.linspace(0,10,201)
y = np.linspace(10,0,201)