GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
EIG.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_EIG_h)
27 #define octave_EIG_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 #include "CColVector.h"
34 #include "CMatrix.h"
35 
36 class Matrix;
37 
38 class
39 OCTAVE_API
40 EIG
41 {
42  friend class Matrix;
43  friend class ComplexMatrix;
44 
45 public:
46 
47  EIG (void) : lambda (), v (), w () { }
48 
49  EIG (const Matrix& a, bool calc_rev = true,
50  bool calc_lev = true, bool balance = true)
51  : lambda (), v (), w ()
52  {
53  init (a, calc_rev, calc_lev, balance);
54  }
55 
56  EIG (const Matrix& a, octave_idx_type& info,
57  bool calc_rev = true, bool calc_lev = true, bool balance = true)
58  : lambda (), v (), w ()
59  {
60  info = init (a, calc_rev, calc_lev, balance);
61  }
62 
63  EIG (const Matrix& a, const Matrix& b,
64  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
65  : lambda (), v (), w ()
66  {
67  init (a, b, calc_rev, calc_lev, force_qz);
68  }
69 
70  EIG (const Matrix& a, const Matrix& b, octave_idx_type& info,
71  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
72  : lambda (), v (), w ()
73  {
74  info = init (a, b, calc_rev, calc_lev, force_qz);
75  }
76 
77  EIG (const ComplexMatrix& a, bool calc_rev = true,
78  bool calc_lev = true, bool balance = true)
79  : lambda (), v (), w ()
80  {
81  init (a, calc_rev, calc_lev, balance);
82  }
83 
84  EIG (const ComplexMatrix& a, octave_idx_type& info,
85  bool calc_rev = true, bool calc_lev = true, bool balance = true)
86  : lambda (), v (), w ()
87  {
88  info = init (a, calc_rev, calc_lev, balance);
89  }
90 
91  EIG (const ComplexMatrix& a, const ComplexMatrix& b,
92  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
93  : lambda (), v (), w ()
94  {
95  init (a, b, calc_rev, calc_lev, force_qz);
96  }
97 
98  EIG (const ComplexMatrix& a, const ComplexMatrix& b,
99  octave_idx_type& info, bool calc_rev = true, bool calc_lev = true,
100  bool force_qz = false)
101  : lambda (), v (), w ()
102  {
103  info = init (a, b, calc_rev, calc_lev, force_qz);
104  }
105 
106  EIG (const EIG& a) : lambda (a.lambda), v (a.v), w (a.w) { }
107 
108  EIG& operator = (const EIG& a)
109  {
110  if (this != &a)
111  {
112  lambda = a.lambda;
113  v = a.v;
114  w = a.w;
115  }
116  return *this;
117  }
118 
119  ~EIG (void) = default;
120 
121  ComplexColumnVector eigenvalues (void) const { return lambda; }
122  ComplexMatrix right_eigenvectors (void) const { return v; }
123  ComplexMatrix left_eigenvectors (void) const { return w; }
124 
125  friend std::ostream& operator << (std::ostream& os, const EIG& a);
126 
127 private:
128 
132 
133  octave_idx_type init (const Matrix& a, bool calc_rev, bool calc_lev,
134  bool balance);
135 
136  octave_idx_type init (const Matrix& a, const Matrix& b,
137  bool calc_rev, bool calc_lev, bool force_qz);
138 
139  octave_idx_type init (const ComplexMatrix& a, bool calc_rev,
140  bool calc_lev, bool balance);
141 
142  octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b,
143  bool calc_rev, bool calc_lev, bool force_qz);
144 
145  octave_idx_type symmetric_init (const Matrix& a, bool calc_rev,
146  bool calc_lev);
147 
148  octave_idx_type symmetric_init (const Matrix& a, const Matrix& b,
149  bool calc_rev, bool calc_lev);
150 
151  octave_idx_type hermitian_init (const ComplexMatrix& a,
152  bool calc_rev, bool calc_lev);
153 
154  octave_idx_type hermitian_init (const ComplexMatrix& a,
155  const ComplexMatrix& b,
156  bool calc_rev, bool calc_lev);
157 
158 };
159 
160 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexMatrix & operator=(const ComplexMatrix &a)=default
Definition: EIG.h:41
ComplexMatrix w
Definition: EIG.h:131
ComplexMatrix right_eigenvectors(void) const
Definition: EIG.h:122
EIG(const ComplexMatrix &a, const ComplexMatrix &b, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:91
EIG(const Matrix &a, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:49
ComplexColumnVector eigenvalues(void) const
Definition: EIG.h:121
EIG(const EIG &a)
Definition: EIG.h:106
EIG(void)
Definition: EIG.h:47
ComplexColumnVector lambda
Definition: EIG.h:129
ComplexMatrix left_eigenvectors(void) const
Definition: EIG.h:123
EIG(const ComplexMatrix &a, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:84
~EIG(void)=default
EIG(const ComplexMatrix &a, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:77
EIG(const Matrix &a, const Matrix &b, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:63
EIG(const Matrix &a, const Matrix &b, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:70
EIG(const ComplexMatrix &a, const ComplexMatrix &b, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:98
EIG(const Matrix &a, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:56
ComplexMatrix v
Definition: EIG.h:130
Definition: dMatrix.h:42
std::complex< double > w(std::complex< double > z, double relerr=0)