def estimate_spectral_norm(A, its=20):
 from scipy.sparse.linalg import aslinearoperator
 A = aslinearoperator(A)
 (m, n) = A.shape
 matvec = (lambda x: A.matvec(x))
 matveca = (lambda x: A.rmatvec(x))
 if _is_real(A):
  return backend.idd_snorm(m, n, matveca, matvec, its=its)
 else:
  return backend.idz_snorm(m, n, matveca, matvec, its=its)

def estimate_spectral_norm ( A , its = 20 ) : from scipy . sparse . linalg import aslinearoperator A = aslinearoperator ( A ) ( m , n ) = A . shape matvec = ( lambda x : A . matvec ( x ) ) matveca = ( lambda x : A . rmatvec ( x ) ) if _is_real ( A ) : return backend . idd_snorm ( m , n , matveca , matvec , its = its ) else : return backend . idz_snorm ( m , n , matveca , matvec , its = its )
estimate spectral norm of a matrix by the randomized power method .