def norm_diff(A, norm=2, msg=True):
 if msg:
  print ('... computing %s norm ...' % norm)
 if (norm == 2):
  value = sp.sparse.linalg.svds(A, k=1, return_singular_vectors=False)
 elif sp.sparse.issparse(A):
  value = sp.sparse.linalg.norm(A, ord=norm)
 else:
  value = sp.linalg.norm(A, ord=norm)
 return value

def norm_diff ( A , norm = 2 , msg = True ) : if msg : print ( '... computing %s norm ...' % norm ) if ( norm == 2 ) : value = sp . sparse . linalg . svds ( A , k = 1 , return_singular_vectors = False ) elif sp . sparse . issparse ( A ) : value = sp . sparse . linalg . norm ( A , ord = norm ) else : value = sp . linalg . norm ( A , ord = norm ) return value
compute the norm diff with the original matrix .