Issue vectorizing a recursive function that is used in iterative scheme to calculate Numpy array
问题 I have the following recursive function, def subspaceiterate(A,V,v,j): if j == 0: return v else: v_jm1 = V[:,j-1] v_jm1 = np.reshape(v_jm1,(np.size(V,axis=0),1)) v = v - np.matmul(v_jm1.T,np.matmul(A,v_jm1)) j = j - 1 subspaceiterate(A,V,v,j) A is an mxm matrix whose eigenvalues and eigenvectors I want to compute using an iterative method, V is an mxm matrix that stores my initial guess for the eigenvectors of A , v_j is a particular column of V , and j is an index that I descend and use to