Repository: scipy/scipy
File: scipy/linalg/_basic.py (Python)

Code before:
             LinAlgWarning, stacklevel=3)


def _find_matrix_structure(a):
    n = a.shape[0]
    n_below, n_above = bandwidth(a)

    if n_below == n_above == 0:
        kind = 'diagonal'
    elif n_above == 0:
        kind = 'lower triangular'
    elif n_below == 0:
        kind = 'upper triangular'
    elif n_above <= 1 and n_below <= 1 and n > 3:
        kind = 'tridiagonal'
    elif np.issubdtype(a.dtype, np.complexfloating) and ishermitian(a):
        kind = 'hermitian'
    elif issymmetric(a):
        kind = 'symmetric'
    else:
        kind = 'general'

    return kind, n_below, n_above


def solve(a, b,lower=None, overwrite_a=False,
          overwrite_b=False, check_finite=True, assume_a=None,
          transposed=False):
    """
    Solve the equation ``a @ x = b`` for  ``x``,
    where `a` is a square matrix.

    If the data matrix is known to be a particular type then supplying the
    corresponding string to ``assume_a`` key chooses the dedicated solver.
    The available options are

    =============================  ================================
     diagonal                       'diagonal'
     tridiagonal                    'tridiagonal'
     banded                         'banded'
     upper triangular               'upper triangular'
     lower triangular               'lower triangular'
     symmetric                      'symmetric' (or 'sym')
     hermitian                      'hermitian' (or 'her')
     symmetric positive definite    'positive definite' (or 'pos')
     general                        'general' (or 'gen')
    =============================  ================================

    Parameters
    ----------
    a : array_like, shape (..., N, N)

Review comment (suggestion):
```suggestion
def solve(a, b, lower=None, overwrite_a=False,
```

Code after:
             LinAlgWarning, stacklevel=3)


def _find_matrix_structure(a):
    n = a.shape[0]
    n_below, n_above = bandwidth(a)

    if n_below == n_above == 0:
        kind = 'diagonal'
    elif n_above == 0:
        kind = 'lower triangular'
    elif n_below == 0:
        kind = 'upper triangular'
    elif n_above <= 1 and n_below <= 1 and n > 3:
        kind = 'tridiagonal'
    elif np.issubdtype(a.dtype, np.complexfloating) and ishermitian(a):
        kind = 'hermitian'
    elif issymmetric(a):
        kind = 'symmetric'
    else:
        kind = 'general'

    return kind, n_below, n_above


def solve(a, b, lower=None, overwrite_a=False,
          overwrite_b=False, check_finite=True, assume_a=None,
          transposed=False):
    """
    Solve the equation ``a @ x = b`` for  ``x``,
    where `a` is a square matrix.

    If the data matrix is known to be a particular type then supplying the
    corresponding string to ``assume_a`` key chooses the dedicated solver.
    The available options are

    =============================  ================================
     diagonal                       'diagonal'
     tridiagonal                    'tridiagonal'
     banded                         'banded'
     upper triangular               'upper triangular'
     lower triangular               'lower triangular'
     symmetric                      'symmetric' (or 'sym')
     hermitian                      'hermitian' (or 'her')
     symmetric positive definite    'positive definite' (or 'pos')
     general                        'general' (or 'gen')
    =============================  ================================

    Parameters
    ----------
    a : array_like, shape (..., N, N)