code: def condest(A, tol=0.1, maxiter=25, symmetric=False):
      r
      [evect, ev, H, V, breakdown_flag] =\
          _approximate_eigenvalues(A, tol, maxiter, symmetric)
  
      return np.max([norm(x) for x in ev])/min([norm(x) for x in ev])
docs: r"""Estimates the condition number of A.
  
      Parameters
      ----------
      A   : {dense or sparse matrix}
          e.g. array, matrix, csr_matrix, ...
      tol : {float}
          Approximation tolerance, currently not used
      maxiter: {int}
          Max number of Arnoldi/Lanczos iterations
      symmetric : {bool}
          If symmetric use the far more efficient Lanczos algorithm,
          Else use Arnoldi
  
      Returns
      -------
      Estimate of cond(A) with \|lambda_max\| / \|lambda_min\|
      through the use of Arnoldi or Lanczos iterations, depending on
      the symmetric flag
  
      Notes
      -----
      The condition number measures how large of a change in the
      the problems solution is caused by a change in problem's input.
      Large condition numbers indicate that small perturbations
      and numerical errors are magnified greatly when solving the system.
  
      Examples
      --------
      >>> import numpy as np
      >>> from pyamg.util.linalg import condest
      >>> c = condest(np.array([[1.,0.],[0.,2.]]))
      >>> print c
      2.0