Skip to content
Snippets Groups Projects
Commit bff7f389 authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

remving errors in beyn.py: keep on computing with current A0

parent f44bb407
No related branches found
No related tags found
No related merge requests found
......@@ -42,9 +42,11 @@ def simple(operator, origin, radius,
k = np.linalg.matrix_rank(A0, tol=rankTol) # Rank test
if(k == 0): # Rank is zero?
raise RuntimeError(zeroRankErrorStr()) # -> Stop
if(verbose): print " # Rank test is zero: keep A0 as is!"
hasK = True # -> Keep A0 (and warn)
elif(k == m): # Maximum rank reached?
raise RuntimeError(maxRankErrorStr()) # -> Stop
if(verbose): print " # Maximum rank reached: keep A0 as is!"
hasK = True # -> Keep A0 (and warn)
elif(k < l): # Found a null SV?
hasK = True # -> We have A0
else: # Matrix is full rank?
......@@ -54,13 +56,12 @@ def simple(operator, origin, radius,
# Check if maxIt was reached
if(it == maxIt):
raise RuntimeError(maxItErrorStr())
else:
if(verbose): print "Constructing linear EVP..."
if(verbose): print "# Last iteration over: keep A0 as is!"
# Compute V, S and Wh
# NB: For SVD(A) = V*S*Wh, numpy computes {v, s, w}, such that:
# v = V; diag(s) = S and w = Wh
if(verbose): print "Constructing linear EVP..."
V, S, Wh = np.linalg.svd(A0, full_matrices=False, compute_uv=1)
# Extract V0, W0 and S0Inv
......@@ -195,20 +196,3 @@ def display(nodes, maxIt, lStart, lStep, rankTol, origin, radius):
print " # Cirular path radius: ",
print format(radius, '+.2e')
print "---------------------------------------"
def zeroRankErrorStr():
"""Returns a string explaining the probable reason of a zero rank"""
return ("Found a rank of zero: " +
"the contour is probably enclosing no eigenvalues")
def maxRankErrorStr():
"""Returns a string explaining the probable reason of a maximal rank"""
return ("Maximal rank found: " +
"the contour is probably enclosing to many eigenvalues")
def maxItErrorStr():
"""Returns a string claiming: the maximum number of iterations is reached"""
return "Maximum number iterations is reached!"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment