'Compare eigenvalues and eigenvectors of eig_banded
with those of linalg.eig.'

def test_eig_banded(self):

    (w_sym, evec_sym) = eig_banded(self.bandmat_sym)
    evec_sym_ = evec_sym[:, argsort(w_sym.real)]
    assert_array_almost_equal(sort(w_sym), self.w_sym_lin)
    assert_array_almost_equal(abs(evec_sym_), abs(self.evec_sym_lin))
    (w_herm, evec_herm) = eig_banded(self.bandmat_herm)
    evec_herm_ = evec_herm[:, argsort(w_herm.real)]
    assert_array_almost_equal(sort(w_herm), self.w_herm_lin)
    assert_array_almost_equal(abs(evec_herm_), abs(self.evec_herm_lin))
    ind1 = 2
    ind2 = 6
    (w_sym_ind, evec_sym_ind) = eig_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)])
    assert_array_almost_equal(abs(evec_sym_ind), abs(self.evec_sym_lin[:, ind1:(ind2 + 1)]))
    (w_herm_ind, evec_herm_ind) = eig_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)])
    assert_array_almost_equal(abs(evec_herm_ind), abs(self.evec_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, evec_sym_val) = eig_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)])
    assert_array_almost_equal(abs(evec_sym_val), abs(self.evec_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, evec_herm_val) = eig_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)])
    assert_array_almost_equal(abs(evec_herm_val), abs(self.evec_herm_lin[:, ind1:(ind2 + 1)]))
    (w_sym, evec_sym) = eig_banded(self.bandmat_sym, check_finite=False)
    evec_sym_ = evec_sym[:, argsort(w_sym.real)]
    assert_array_almost_equal(sort(w_sym), self.w_sym_lin)
    assert_array_almost_equal(abs(evec_sym_), abs(self.evec_sym_lin))
