home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-bin.lha / include / octave / EIG.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  2KB  |  121 lines

  1. //                                  -*- C++ -*-
  2. /*
  3.  
  4. Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
  5.  
  6. This file is part of Octave.
  7.  
  8. Octave is free software; you can redistribute it and/or modify it
  9. under the terms of the GNU General Public License as published by the
  10. Free Software Foundation; either version 2, or (at your option) any
  11. later version.
  12.  
  13. Octave is distributed in the hope that it will be useful, but WITHOUT
  14. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16. for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with Octave; see the file COPYING.  If not, write to the Free
  20. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. */
  23.  
  24. #if !defined (octave_EIG_h)
  25. #define octave_EIG_h 1
  26.  
  27. class ostream;
  28.  
  29. #include "dMatrix.h"
  30. #include "CMatrix.h"
  31. #include "CColVector.h"
  32.  
  33. extern "C++" {
  34.  
  35. class EIG
  36. {
  37. friend class Matrix;
  38. friend class ComplexMatrix;
  39.  
  40. public:
  41.  
  42.   EIG (void) {}
  43.  
  44.   EIG (const Matrix& a);
  45.   EIG (const Matrix& a, int& info);
  46.  
  47.   EIG (const ComplexMatrix& a);
  48.   EIG (const ComplexMatrix& a, int& info);
  49.  
  50.   EIG (const EIG& a);
  51.  
  52.   EIG& operator = (const EIG& a);
  53.  
  54.   ComplexColumnVector eigenvalues (void) const;
  55.   ComplexMatrix eigenvectors (void) const;
  56.  
  57.   friend ostream&  operator << (ostream& os, const EIG& a);
  58.  
  59. private:
  60.  
  61.   int init (const Matrix& a);
  62.   int init (const ComplexMatrix& a);
  63.  
  64.   ComplexColumnVector lambda;
  65.   ComplexMatrix v;
  66. };
  67.  
  68. inline EIG::EIG (const Matrix& a)
  69. {
  70.   init (a);
  71. }
  72.  
  73. inline EIG::EIG (const Matrix& a, int& info)
  74. {
  75.   info = init (a);
  76. }
  77.  
  78. inline EIG::EIG (const ComplexMatrix& a)
  79. {
  80.   init (a);
  81. }
  82.  
  83. inline EIG::EIG (const ComplexMatrix& a, int& info)
  84. {
  85.   info = init (a);
  86. }
  87.  
  88. inline EIG::EIG (const EIG& a)
  89. {
  90.   lambda = a.lambda;
  91.   v = a.v;
  92. }
  93.  
  94. inline EIG& EIG::operator = (const EIG& a)
  95. {
  96.   lambda = a.lambda;
  97.   v = a.v;
  98.   return *this;
  99. }
  100.  
  101. inline ComplexColumnVector EIG::eigenvalues (void) const
  102. {
  103.   return lambda;
  104. }
  105.  
  106. inline ComplexMatrix EIG::eigenvectors (void) const
  107. {
  108.   return v;
  109. }
  110.  
  111. } // extern "C++"
  112.  
  113. #endif
  114.  
  115. /*
  116. ;;; Local Variables: ***
  117. ;;; mode: C++ ***
  118. ;;; page-delimiter: "^/\\*" ***
  119. ;;; End: ***
  120. */
  121.