code: def rho_D_inv_A(A):
      
      if not hasattr(A, 'rho_D_inv'):
          D_inv = get_diagonal(A, inv=True)
          D_inv_A = scale_rows(A, D_inv, copy=True)
          A.rho_D_inv = approximate_spectral_radius(D_inv_A)
  
      return A.rho_D_inv
docs: Return the (approx.) spectral radius of D^-1 * A.
  
      Parameters
      ----------
      A : sparse-matrix
  
      Returns
      -------
      approximate spectral radius of diag(A)^{-1} A
  
      Examples
      --------
      >>> from pyamg.gallery import poisson
      >>> from pyamg.relaxation.smoothing import rho_D_inv_A
      >>> from scipy.sparse import csr_matrix
      >>> import numpy as np
      >>> A = csr_matrix(np.array([[1.0,0,0],[0,2.0,0],[0,0,3.0]]))
      >>> print rho_D_inv_A(A)
      1.0