Advertisement
BumiBarbi

EIG.h

Mar 29th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.83 KB | None | 0 0
  1. /*
  2.  
  3. Copyright (C) 1994-2015 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 3 of the License, or (at your
  10. option) any later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, see
  19. <http://www.gnu.org/licenses/>.
  20.  
  21. */
  22.  
  23. #if ! defined (octave_EIG_h)
  24. #define octave_EIG_h 1
  25.  
  26. #include "octave-config.h"
  27.  
  28. #include <iosfwd>
  29.  
  30. #include "dMatrix.h"
  31. #include "CMatrix.h"
  32. #include "CColVector.h"
  33.  
  34. class
  35. OCTAVE_API
  36. EIG
  37. {
  38.   friend class Matrix;
  39.   friend class ComplexMatrix;
  40.  
  41. public:
  42.  
  43.   EIG (void) : lambda (), v () { }
  44.  
  45.   EIG (const Matrix& a, bool calc_eigenvectors = true,
  46.        bool balance = true)
  47.     : lambda (), v ()
  48.   {
  49.     init (a, calc_eigenvectors, balance);
  50.   }
  51.  
  52.   EIG (const Matrix& a, octave_idx_type& info,
  53.        bool calc_eigenvectors = true, bool balance = true)
  54.     : lambda (), v ()
  55.   {
  56.     info = init (a, calc_eigenvectors, balance);
  57.   }
  58.  
  59.   EIG (const Matrix& a, const Matrix& b, bool calc_eigenvectors = true)
  60.     : lambda (), v ()
  61.   {
  62.     init (a, b, calc_eigenvectors);
  63.   }
  64.  
  65.   EIG (const Matrix& a, const Matrix& b, octave_idx_type& info,
  66.        bool calc_eigenvectors = true)
  67.     : lambda (), v ()
  68.   {
  69.     info = init (a, b, calc_eigenvectors);
  70.   }
  71.  
  72.   EIG (const ComplexMatrix& a, bool calc_eigenvectors = true,
  73.        bool balance = true)
  74.     : lambda (), v ()
  75.   {
  76.     init (a, calc_eigenvectors, balance);
  77.   }
  78.  
  79.   EIG (const ComplexMatrix& a, octave_idx_type& info,
  80.        bool calc_eigenvectors = true, bool balance = true)
  81.     : lambda (), v ()
  82.   {
  83.     info = init (a, calc_eigenvectors, balance);
  84.   }
  85.  
  86.   EIG (const ComplexMatrix& a, const ComplexMatrix& b,
  87.        bool calc_eigenvectors = true)
  88.     : lambda (), v ()
  89.   {
  90.     init (a, b, calc_eigenvectors);
  91.   }
  92.  
  93.   EIG (const ComplexMatrix& a, const ComplexMatrix& b,
  94.        octave_idx_type& info, bool calc_eigenvectors = true)
  95.     : lambda (), v ()
  96.   {
  97.     info = init (a, b, calc_eigenvectors);
  98.   }
  99.  
  100.   EIG (const EIG& a)
  101.     : lambda (a.lambda), v (a.v) { }
  102.  
  103.   EIG& operator = (const EIG& a)
  104.   {
  105.     if (this != &a)
  106.       {
  107.         lambda = a.lambda;
  108.         v = a.v;
  109.       }
  110.     return *this;
  111.   }
  112.  
  113.   ~EIG (void) { }
  114.  
  115.   ComplexColumnVector eigenvalues (void) const { return lambda; }
  116.  
  117.   ComplexMatrix eigenvectors (void) const { return v; }
  118.  
  119.   friend std::ostream&  operator << (std::ostream& os, const EIG& a);
  120.  
  121. private:
  122.  
  123.   ComplexColumnVector lambda;
  124.   ComplexMatrix v;
  125.  
  126.   octave_idx_type init (const Matrix& a, bool calc_eigenvectors,
  127.                         bool balance);
  128.  
  129.   octave_idx_type init (const Matrix& a, const Matrix& b,
  130.                         bool calc_eigenvectors);
  131.  
  132.   octave_idx_type init (const ComplexMatrix& a, bool calc_eigenvectors,
  133.                         bool balance);
  134.  
  135.   octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b,
  136.                         bool calc_eigenvectors);
  137.  
  138.   octave_idx_type symmetric_init (const Matrix& a, bool calc_eigenvectors);
  139.  
  140.   octave_idx_type symmetric_init (const Matrix& a, const Matrix& b,
  141.                                   bool calc_eigenvectors);
  142.  
  143.   octave_idx_type hermitian_init (const ComplexMatrix& a,
  144.                                   bool calc_eigenvectors);
  145.  
  146.   octave_idx_type hermitian_init (const ComplexMatrix& a,
  147.                                   const ComplexMatrix& b,
  148.                                   bool calc_eigenvectors);
  149.  
  150. };
  151.  
  152. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement