newarp_UpperHessenbergEigen_bones.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
  2. // Copyright 2008-2016 National ICT Australia (NICTA)
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // ------------------------------------------------------------------------
  15. namespace newarp
  16. {
  17. //! Calculate the eigenvalues and eigenvectors of an upper Hessenberg matrix.
  18. //! This class is a wrapper of the Lapack functions `_lahqr` and `_trevc`.
  19. template<typename eT>
  20. class UpperHessenbergEigen
  21. {
  22. private:
  23. blas_int n;
  24. Mat<eT> mat_Z; // In the first stage, H = ZTZ', Z is an orthogonal matrix
  25. // In the second stage, Z will be overwritten by the eigenvectors of H
  26. Mat<eT> mat_T; // H = ZTZ', T is a Schur form matrix
  27. Col< std::complex<eT> > evals; // eigenvalues of H
  28. bool computed;
  29. public:
  30. //! Default constructor. Computation can
  31. //! be performed later by calling the compute() method.
  32. inline UpperHessenbergEigen();
  33. //! Constructor to create an object that calculates the eigenvalues
  34. //! and eigenvectors of an upper Hessenberg matrix `mat_obj`.
  35. inline UpperHessenbergEigen(const Mat<eT>& mat_obj);
  36. //! Compute the eigenvalue decomposition of an upper Hessenberg matrix.
  37. inline void compute(const Mat<eT>& mat_obj);
  38. //! Retrieve the eigenvalues.
  39. inline Col< std::complex<eT> > eigenvalues();
  40. //! Retrieve the eigenvectors.
  41. inline Mat< std::complex<eT> > eigenvectors();
  42. };
  43. } // namespace newarp