|
|
@ -197,14 +197,13 @@ def Arnoldi(A, v, m):
|
|
|
|
beta = norm(v)
|
|
|
|
beta = norm(v)
|
|
|
|
v = v/beta
|
|
|
|
v = v/beta
|
|
|
|
h = sp.sparse.lil_matrix((m,m))
|
|
|
|
h = sp.sparse.lil_matrix((m,m))
|
|
|
|
|
|
|
|
|
|
|
|
for j in range(m):
|
|
|
|
for j in range(m):
|
|
|
|
w = A @ v
|
|
|
|
w = A @ v
|
|
|
|
for i in range(j):
|
|
|
|
for i in range(j):
|
|
|
|
tmp = v.T @ w
|
|
|
|
tmp = v.T @ w
|
|
|
|
h[i,j] = tmp[0,0]
|
|
|
|
h[i,j] = tmp[0,0]
|
|
|
|
w = w - h[i,j]*v
|
|
|
|
w = w - h[i,j]*v
|
|
|
|
h[j,j-1] = norm(w)
|
|
|
|
h[j,j-1] = norm(w) # in the paper the index is referred as h[j+1,j] but since python starts from 0 it's h[j,j-1]
|
|
|
|
|
|
|
|
|
|
|
|
if h[j,j-1] == 0:
|
|
|
|
if h[j,j-1] == 0:
|
|
|
|
print("Arnoldi breakdown")
|
|
|
|
print("Arnoldi breakdown")
|
|
|
|