#NEWLINE# def test_eig_banded( self ) : #NEWLINE# #INDENT# 'Compare eigenvalues and eigenvectors of eig_banded\n           with those of linalg.eig. ' #NEWLINE# ( w_sym , evec_sym ) = eig_banded ( self . bandmat_sym ) #NEWLINE# evec_sym_ = evec_sym [ : , argsort ( w_sym . real ) ] #NEWLINE# assert_array_almost_equal ( sort ( w_sym ) , self . w_sym_lin ) #NEWLINE# assert_array_almost_equal ( abs ( evec_sym_ ) , abs ( self . evec_sym_lin ) ) #NEWLINE# ( w_herm , evec_herm ) = eig_banded ( self . bandmat_herm ) #NEWLINE# evec_herm_ = evec_herm [ : , argsort ( w_herm . real ) ] #NEWLINE# assert_array_almost_equal ( sort ( w_herm ) , self . w_herm_lin ) #NEWLINE# assert_array_almost_equal ( abs ( evec_herm_ ) , abs ( self . evec_herm_lin ) ) #NEWLINE# ind1 = 2 #NEWLINE# ind2 = 6 #NEWLINE# ( w_sym_ind , evec_sym_ind ) = eig_banded ( self . bandmat_sym , select = 'i' , select_range = ( ind1 , ind2 ) ) #NEWLINE# assert_array_almost_equal ( sort ( w_sym_ind ) , self . w_sym_lin [ ind1 : ( ind2 + 1 ) ] ) #NEWLINE# assert_array_almost_equal ( abs ( evec_sym_ind ) , abs ( self . evec_sym_lin [ : , ind1 : ( ind2 + 1 ) ] ) ) #NEWLINE# ( w_herm_ind , evec_herm_ind ) = eig_banded ( self . bandmat_herm , select = 'i' , select_range = ( ind1 , ind2 ) ) #NEWLINE# assert_array_almost_equal ( sort ( w_herm_ind ) , self . w_herm_lin [ ind1 : ( ind2 + 1 ) ] ) #NEWLINE# assert_array_almost_equal ( abs ( evec_herm_ind ) , abs ( self . evec_herm_lin [ : , ind1 : ( ind2 + 1 ) ] ) ) #NEWLINE# v_lower = ( self . w_sym_lin [ ind1 ] - 1e-05 ) #NEWLINE# v_upper = ( self . w_sym_lin [ ind2 ] + 1e-05 ) #NEWLINE# ( w_sym_val , evec_sym_val ) = eig_banded ( self . bandmat_sym , select = 'v' , select_range = ( v_lower , v_upper ) ) #NEWLINE# assert_array_almost_equal ( sort ( w_sym_val ) , self . w_sym_lin [ ind1 : ( ind2 + 1 ) ] ) #NEWLINE# assert_array_almost_equal ( abs ( evec_sym_val ) , abs ( self . evec_sym_lin [ : , ind1 : ( ind2 + 1 ) ] ) ) #NEWLINE# v_lower = ( self . w_herm_lin [ ind1 ] - 1e-05 ) #NEWLINE# v_upper = ( self . w_herm_lin [ ind2 ] + 1e-05 ) #NEWLINE# ( w_herm_val , evec_herm_val ) = eig_banded ( self . bandmat_herm , select = 'v' , select_range = ( v_lower , v_upper ) ) #NEWLINE# assert_array_almost_equal ( sort ( w_herm_val ) , self . w_herm_lin [ ind1 : ( ind2 + 1 ) ] ) #NEWLINE# assert_array_almost_equal ( abs ( evec_herm_val ) , abs ( self . evec_herm_lin [ : , ind1 : ( ind2 + 1 ) ] ) ) #NEWLINE# ( w_sym , evec_sym ) = eig_banded ( self . bandmat_sym , check_finite = False ) #NEWLINE# evec_sym_ = evec_sym [ : , argsort ( w_sym . real ) ] #NEWLINE# assert_array_almost_equal ( sort ( w_sym ) , self . w_sym_lin ) #NEWLINE# assert_array_almost_equal ( abs ( evec_sym_ ) , abs ( self . evec_sym_lin ) )