(A)
return np.max(Sigma)/min(Sigma)
Return condition number of A.

    Parameters
    ----------
    A   : {dense or sparse matrix}
        e.g. array, matrix, csr_matrix, ...

    Returns
    -------
    2-norm condition number through use of the SVD
    Use for small to moderate sized dense matrices.
    For large sparse matrices, use condest.

    Notes
    -----
    The condition number measures how large of a change in
    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.],[0.,2.0]]))
    >>> print(f'{c:2.6}')
    2.0
Return condition number of A.
Return condition number of A .
def cond(A):
    """Return condition number of A.

    Parameters
    ----------
    A   : {dense or sparse matrix}
        e.g. array, matrix, csr_matrix, ...

    Returns
    -------
    2-norm condition number through use of the SVD
    Use for small to moderate sized dense matrices.
    For large sparse matrices, use condest.

    Notes
    -----
    The condition number measures how large of a change in
    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.],[0.,2.0]]))
    >>> print(f'{c:2.6}')
    2.0

    """
    if A.shape[0] != A.shape[1]:
        raise ValueError('expected square matrix')

    if sparse.isspmatrix(A):
        A = A.toarray()

    U, Sigma, Vh = svd(A)
    del U, Vh

    # 2-Norm Condition Number
    return np.max(Sigma)/min(Sigma)
def cond ( A ) : if A . shape [ 0 ] != A . shape [ 1 ] : raise ValueError ( 'expected square matrix' ) if sparse . isspmatrix ( A ) : A = A . toarray ( ) U , Sigma , Vh = svd ( A ) del U , Vh # 2-Norm Condition Number return np . max ( Sigma ) / min ( Sigma )