'Compare eigenvalues of eigvals_banded with those of linalg.eig.'

def test_eigvals_banded(self):

    w_sym = eigvals_banded(self.bandmat_sym)
    w_sym = w_sym.real
    assert_array_almost_equal(sort(w_sym), self.w_sym_lin)
    w_herm = eigvals_banded(self.bandmat_herm)
    w_herm = w_herm.real
    assert_array_almost_equal(sort(w_herm), self.w_herm_lin)
    ind1 = 2
    ind2 = 6
    w_sym_ind = eigvals_banded(self.bandmat_sym, select='i', select_range=(ind1, ind2))
    assert_array_almost_equal(sort(w_sym_ind), self.w_sym_lin[ind1:(ind2 + 1)])
    w_herm_ind = eigvals_banded(self.bandmat_herm, select='i', select_range=(ind1, ind2))
    assert_array_almost_equal(sort(w_herm_ind), self.w_herm_lin[ind1:(ind2 + 1)])
    v_lower = (self.w_sym_lin[ind1] - 1e-05)
    v_upper = (self.w_sym_lin[ind2] + 1e-05)
    w_sym_val = eigvals_banded(self.bandmat_sym, select='v', select_range=(v_lower, v_upper))
    assert_array_almost_equal(sort(w_sym_val), self.w_sym_lin[ind1:(ind2 + 1)])
    v_lower = (self.w_herm_lin[ind1] - 1e-05)
    v_upper = (self.w_herm_lin[ind2] + 1e-05)
    w_herm_val = eigvals_banded(self.bandmat_herm, select='v', select_range=(v_lower, v_upper))
    assert_array_almost_equal(sort(w_herm_val), self.w_herm_lin[ind1:(ind2 + 1)])
    w_sym = eigvals_banded(self.bandmat_sym, check_finite=False)
    w_sym = w_sym.real
    assert_array_almost_equal(sort(w_sym), self.w_sym_lin)
