matrix - Carefully mending "Objects are not aligned" error in python, with matrices -


in recent exercise, write function matrix , number k, , gives k-th approximation a's eigenvalues, using approximation formulas of rayleigh quotient iteration. wrote following function, made sure first iteration okay, second error, , don't know how maintain matrix or vector way there are. frustrated , appreciate kind of help.

def rayleighquotientitreation(a,k):    import math    import numpy np    i=np.matrix(np.identity(a.shape[0]))    b=np.random.rand(a.shape[0])    b=math.pow(normal(b),-1)*b    u=(np.dot(b,(np.dot(a.t,b)).t))[0,0]    in range(0,k):       b, u=(np.dot(np.linalg.inv((a-  u*i)).t,b))*math.pow(normal((np.dot(np.linalg.inv((a-u*i)),b)).t),-1), (np.dot((np.dot(b.t,a)),b))[0,0]    return u 


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -