| fn_eig.hpp | | fn_eig.hpp | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 110 | |
| | | | |
| return status; | | return status; | |
| } | | } | |
| | | | |
| // | | // | |
| // general matrices | | // general matrices | |
| // | | // | |
| | | | |
| //! Eigenvalues and eigenvectors (both left and right) of general real/comp
lex square matrix X | | //! Eigenvalues and eigenvectors (both left and right) of general real/comp
lex square matrix X | |
| template<typename T1> | | template<typename T1> | |
|
| | | arma_deprecated | |
| inline | | inline | |
| bool | | bool | |
| eig_gen | | eig_gen | |
| ( | | ( | |
| Col< std::complex<typename T1::pod_type> >& eigval, | | Col< std::complex<typename T1::pod_type> >& eigval, | |
| Mat<typename T1::elem_type>& l_eigvec, | | Mat<typename T1::elem_type>& l_eigvec, | |
| Mat<typename T1::elem_type>& r_eigvec, | | Mat<typename T1::elem_type>& r_eigvec, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 165 | |
| //! Optional argument 'side' specifies which eigenvectors should be compute
d: | | //! Optional argument 'side' specifies which eigenvectors should be compute
d: | |
| //! 'r' for right (default) and 'l' for left. | | //! 'r' for right (default) and 'l' for left. | |
| template<typename eT, typename T1> | | template<typename eT, typename T1> | |
| inline | | inline | |
| bool | | bool | |
| eig_gen | | eig_gen | |
| ( | | ( | |
| Col< std::complex<eT> >& eigval, | | Col< std::complex<eT> >& eigval, | |
| Mat< std::complex<eT> >& eigvec, | | Mat< std::complex<eT> >& eigvec, | |
| const Base<eT, T1>& X, | | const Base<eT, T1>& X, | |
|
| const char side, | | const char side = 'r', | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| //std::cout << "real" << std::endl; | | //std::cout << "real" << std::endl; | |
| | | | |
| arma_debug_check( ( ((void*)(&eigval)) == ((void*)(&eigvec)) ), "eig_gen(
): eigval is an alias of eigvec" ); | | arma_debug_check( ( ((void*)(&eigval)) == ((void*)(&eigvec)) ), "eig_gen(
): eigval is an alias of eigvec" ); | |
| | | | |
| | | | |
| skipping to change at line 252 | | skipping to change at line 253 | |
| //! Optional argument 'side' specifies which eigenvectors should be compute
d: | | //! Optional argument 'side' specifies which eigenvectors should be compute
d: | |
| //! 'r' for right (default) and 'l' for left. | | //! 'r' for right (default) and 'l' for left. | |
| template<typename T, typename T1> | | template<typename T, typename T1> | |
| inline | | inline | |
| bool | | bool | |
| eig_gen | | eig_gen | |
| ( | | ( | |
| Col<std::complex<T> >& eigval, | | Col<std::complex<T> >& eigval, | |
| Mat<std::complex<T> >& eigvec, | | Mat<std::complex<T> >& eigvec, | |
| const Base<std::complex<T>, T1>& X, | | const Base<std::complex<T>, T1>& X, | |
|
| const char side, | | const char side = 'r', | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| //std::cout << "complex" << std::endl; | | //std::cout << "complex" << std::endl; | |
| | | | |
| arma_debug_check( ( ((void*)(&eigval)) == ((void*)(&eigvec)) ), "eig_gen(
): eigval is an alias of eigvec" ); | | arma_debug_check( ( ((void*)(&eigval)) == ((void*)(&eigvec)) ), "eig_gen(
): eigval is an alias of eigvec" ); | |
| | | | |
| | | | |
| skipping to change at line 292 | | skipping to change at line 293 | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| arma_bad("eig_gen(): failed to converge", false); | | arma_bad("eig_gen(): failed to converge", false); | |
| } | | } | |
| | | | |
| return status; | | return status; | |
| } | | } | |
| | | | |
|
| template<typename eT, typename T1> | | //! Eigenvalues of general real square matrix X | |
| | | template<typename T, typename T1> | |
| | | inline | |
| | | Col< std::complex<T> > | |
| | | eig_gen | |
| | | ( | |
| | | const Base<T, T1>& X, | |
| | | const typename arma_blas_type_only<T>::result* junk1 = 0, | |
| | | const typename arma_not_cx<T>::result* junk2 = 0 | |
| | | ) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk1); | |
| | | arma_ignore(junk2); | |
| | | | |
| | | Mat<T> l_eigvec; | |
| | | Mat<T> r_eigvec; | |
| | | | |
| | | Col< std::complex<T> > eigval; | |
| | | | |
| | | const bool status = auxlib::eig_gen(eigval, l_eigvec, r_eigvec, X, 'n'); | |
| | | | |
| | | if(status == false) | |
| | | { | |
| | | eigval.reset(); | |
| | | arma_bad("eig_gen(): failed to converge"); | |
| | | } | |
| | | | |
| | | return eigval; | |
| | | } | |
| | | | |
| | | //! Eigenvalues of general real square matrix X | |
| | | template<typename T, typename T1> | |
| | | inline | |
| | | Col< std::complex<T> > | |
| | | eig_gen | |
| | | ( | |
| | | const Base< std::complex<T>, T1>& X, | |
| | | const typename arma_blas_type_only< std::complex<T> >::result* junk1 = 0, | |
| | | const typename arma_cx_only< std::complex<T> >::result* junk2 = 0 | |
| | | ) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk1); | |
| | | arma_ignore(junk2); | |
| | | | |
| | | Mat< std::complex<T> > l_eigvec; | |
| | | Mat< std::complex<T> > r_eigvec; | |
| | | | |
| | | Col< std::complex<T> > eigval; | |
| | | | |
| | | const bool status = auxlib::eig_gen(eigval, l_eigvec, r_eigvec, X, 'n'); | |
| | | | |
| | | if(status == false) | |
| | | { | |
| | | eigval.reset(); | |
| | | arma_bad("eig_gen(): failed to converge"); | |
| | | } | |
| | | | |
| | | return eigval; | |
| | | } | |
| | | | |
| | | //! Eigenvalues of general real square matrix X | |
| | | template<typename T, typename T1> | |
| inline | | inline | |
| bool | | bool | |
| eig_gen | | eig_gen | |
| ( | | ( | |
|
| Col< std::complex<eT> >& eigval, | | Col< std::complex<T> >& eigval, | |
| Mat< std::complex<eT> >& eigvec, | | const Base<T, T1>& X, | |
| const Base<eT, T1>& X, | | const typename arma_blas_type_only<T>::result* junk = 0 | |
| const char* side = "right", | | | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk | | | |
| = 0 | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| return eig_gen(eigval, eigvec, X, side[0]); | | Mat<T> l_eigvec; | |
| | | Mat<T> r_eigvec; | |
| | | | |
| | | const bool status = auxlib::eig_gen(eigval, l_eigvec, r_eigvec, X, 'n'); | |
| | | | |
| | | if(status == false) | |
| | | { | |
| | | eigval.reset(); | |
| | | arma_bad("eig_gen(): failed to converge", false); | |
| | | } | |
| | | | |
| | | return status; | |
| } | | } | |
| | | | |
|
| | | //! Eigenvalues of general complex square matrix X | |
| template<typename T, typename T1> | | template<typename T, typename T1> | |
| inline | | inline | |
| bool | | bool | |
| eig_gen | | eig_gen | |
| ( | | ( | |
|
| Col<std::complex<T> >& eigval, | | Col< std::complex<T> >& eigval, | |
| Mat<std::complex<T> >& eigvec, | | const Base< std::complex<T>, T1>& X, | |
| const Base<std::complex<T>, T1>& X, | | const typename arma_blas_type_only< std::complex<T> >::result* junk = 0 | |
| const char* side = "right", | | | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk | | | |
| = 0 | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| return eig_gen(eigval, eigvec, X, side[0]); | | Mat< std::complex<T> > l_eigvec; | |
| | | Mat< std::complex<T> > r_eigvec; | |
| | | | |
| | | const bool status = auxlib::eig_gen(eigval, l_eigvec, r_eigvec, X, 'n'); | |
| | | | |
| | | if(status == false) | |
| | | { | |
| | | eigval.reset(); | |
| | | arma_bad("eig_gen(): failed to converge", false); | |
| | | } | |
| | | | |
| | | return status; | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 9 change blocks. |
| 17 lines changed or deleted | | 98 lines changed or added | |
|