def eig_banded(a_band, lower=False, eigvals_only=False, overwrite_a_band=False,<EOL>select='<STR_LIT:a>', select_range=None, max_ev=<NUM_LIT:0>, check_finite=True):
if eigvals_only or overwrite_a_band:<EOL><INDENT>if check_finite:<EOL><INDENT>a1 = asarray_chkfinite(a_band)<EOL><DEDENT>else:<EOL><INDENT>a1 = asarray(a_band)<EOL><DEDENT>overwrite_a_band = overwrite_a_band or (_datacopied(a1, a_band))<EOL><DEDENT>else:<EOL><INDENT>a1 = array(a_band)<EOL>if issubclass(a1.dtype.type, inexact) and not isfinite(a1).all():<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>overwrite_a_band = <NUM_LIT:1><EOL><DEDENT>if len(a1.shape) != <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if select.lower() not in [<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:2>, '<STR_LIT:a>', '<STR_LIT:v>', '<STR_LIT:i>', '<STR_LIT:all>', '<STR_LIT:value>', '<STR_LIT:index>']:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if select.lower() in [<NUM_LIT:0>, '<STR_LIT:a>', '<STR_LIT:all>']:<EOL><INDENT>if a1.dtype.char in '<STR_LIT>':<EOL><INDENT>bevd, = get_lapack_funcs(('<STR_LIT>',), (a1,))<EOL>internal_name = '<STR_LIT>'<EOL><DEDENT>else:  <EOL><INDENT>bevd, = get_lapack_funcs(('<STR_LIT>',), (a1,))<EOL>internal_name = '<STR_LIT>'<EOL><DEDENT>w,v,info = bevd(a1, compute_v=not eigvals_only,<EOL>lower=lower,<EOL>overwrite_ab=overwrite_a_band)<EOL><DEDENT>if select.lower() in [<NUM_LIT:1>, <NUM_LIT:2>, '<STR_LIT:i>', '<STR_LIT:v>', '<STR_LIT:index>', '<STR_LIT:value>']:<EOL><INDENT>if select.lower() in [<NUM_LIT:2>, '<STR_LIT:i>', '<STR_LIT:index>']:<EOL><INDENT>select = <NUM_LIT:2><EOL>vl, vu, il, iu = <NUM_LIT:0.0>, <NUM_LIT:0.0>, min(select_range), max(select_range)<EOL>if min(il, iu) < <NUM_LIT:0> or max(il, iu) >= a1.shape[<NUM_LIT:1>]:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>max_ev = iu - il + <NUM_LIT:1><EOL><DEDENT>else:  <EOL><INDENT>select = <NUM_LIT:1><EOL>vl, vu, il, iu = min(select_range), max(select_range), <NUM_LIT:0>, <NUM_LIT:0><EOL>if max_ev == <NUM_LIT:0>:<EOL><INDENT>max_ev = a_band.shape[<NUM_LIT:1>]<EOL><DEDENT><DEDENT>if eigvals_only:<EOL><INDENT>max_ev = <NUM_LIT:1><EOL><DEDENT>if a1.dtype.char in '<STR_LIT>':  <EOL><INDENT>lamch, = get_lapack_funcs(('<STR_LIT>',), (array(<NUM_LIT:0>, dtype='<STR_LIT:f>'),))<EOL><DEDENT>else:<EOL><INDENT>lamch, = get_lapack_funcs(('<STR_LIT>',), (array(<NUM_LIT:0>, dtype='<STR_LIT:d>'),))<EOL><DEDENT>abstol = <NUM_LIT:2> * lamch('<STR_LIT:s>')<EOL>if a1.dtype.char in '<STR_LIT>':<EOL><INDENT>bevx, = get_lapack_funcs(('<STR_LIT>',), (a1,))<EOL>internal_name = '<STR_LIT>'<EOL><DEDENT>else:  <EOL><INDENT>bevx, = get_lapack_funcs(('<STR_LIT>',), (a1,))<EOL>internal_name = '<STR_LIT>'<EOL><DEDENT>w, v, m, ifail, info = bevx(a1, vl, vu, il+<NUM_LIT:1>, iu+<NUM_LIT:1>,<EOL>compute_v=not eigvals_only,<EOL>mmax=max_ev,<EOL>range=select, lower=lower,<EOL>overwrite_ab=overwrite_a_band,<EOL>abstol=abstol)<EOL>w = w[:m]<EOL>if not eigvals_only:<EOL><INDENT>v = v[:, :m]<EOL><DEDENT><DEDENT>if info < <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>% (-info, internal_name))<EOL><DEDENT>if info > <NUM_LIT:0>:<EOL><INDENT>raise LinAlgError("<STR_LIT>")<EOL><DEDENT>if eigvals_only:<EOL><INDENT>return w<EOL><DEDENT>return w, v<EOL>
Solve real symmetric or complex hermitian band matrix eigenvalue problem.

Find eigenvalues w and optionally right eigenvectors v of a::

    a v[:,i] = w[i] v[:,i]
    v.H v    = identity

The matrix a is stored in a_band either in lower diagonal or upper
diagonal ordered form:

    a_band[u + i - j, j] == a[i,j]        (if upper form; i <= j)
    a_band[    i - j, j] == a[i,j]        (if lower form; i >= j)

where u is the number of bands above the diagonal.

Example of a_band (shape of a is (6,6), u=2)::

    upper form:
    *   *   a02 a13 a24 a35
    *   a01 a12 a23 a34 a45
    a00 a11 a22 a33 a44 a55

    lower form:
    a00 a11 a22 a33 a44 a55
    a10 a21 a32 a43 a54 *
    a20 a31 a42 a53 *   *

Cells marked with * are not used.

Parameters
----------
a_band : (u+1, M) array_like
    The bands of the M by M matrix a.
lower : bool, optional
    Is the matrix in the lower form. (Default is upper form)
eigvals_only : bool, optional
    Compute only the eigenvalues and no eigenvectors.
    (Default: calculate also eigenvectors)
overwrite_a_band : bool, optional
    Discard data in a_band (may enhance performance)
select : {'a', 'v', 'i'}, optional
    Which eigenvalues to calculate

    ======  ========================================
    select  calculated
    ======  ========================================
    'a'     All eigenvalues
    'v'     Eigenvalues in the interval (min, max]
    'i'     Eigenvalues with indices min <= i <= max
    ======  ========================================
select_range : (min, max), optional
    Range of selected eigenvalues
max_ev : int, optional
    For select=='v', maximum number of eigenvalues expected.
    For other values of select, has no meaning.

    In doubt, leave this parameter untouched.

check_finite : boolean, optional
    Whether to check that the input matrix contains only finite numbers.
    Disabling may give a performance gain, but may result in problems
    (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns
-------
w : (M,) ndarray
    The eigenvalues, in ascending order, each repeated according to its
    multiplicity.
v : (M, M) float or complex ndarray
    The normalized eigenvector corresponding to the eigenvalue w[i] is
    the column v[:,i].

Raises LinAlgError if eigenvalue computation does not converge