GNU Octave  4.4.1
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-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://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 "CColVector.h"
31 #include "CMatrix.h"
32 
33 class Matrix;
34 
35 class
36 OCTAVE_API
37 EIG
38 {
39  friend class Matrix;
40  friend class ComplexMatrix;
41 
42 public:
43 
44  EIG (void) : lambda (), v (), w () { }
45 
46  EIG (const Matrix& a, bool calc_rev = true,
47  bool calc_lev = true, bool balance = true)
48  : lambda (), v (), w ()
49  {
50  init (a, calc_rev, calc_lev, balance);
51  }
52 
53  EIG (const Matrix& a, octave_idx_type& info,
54  bool calc_rev = true, bool calc_lev = true, bool balance = true)
55  : lambda (), v (), w ()
56  {
57  info = init (a, calc_rev, calc_lev, balance);
58  }
59 
60  EIG (const Matrix& a, const Matrix& b,
61  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
62  : lambda (), v (), w ()
63  {
64  init (a, b, calc_rev, calc_lev, force_qz);
65  }
66 
67  EIG (const Matrix& a, const Matrix& b, octave_idx_type& info,
68  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
69  : lambda (), v (), w ()
70  {
71  info = init (a, b, calc_rev, calc_lev, force_qz);
72  }
73 
74  EIG (const ComplexMatrix& a, bool calc_rev = true,
75  bool calc_lev = true, bool balance = true)
76  : lambda (), v (), w ()
77  {
78  init (a, calc_rev, calc_lev, balance);
79  }
80 
82  bool calc_rev = true, bool calc_lev = true, bool balance = true)
83  : lambda (), v (), w ()
84  {
85  info = init (a, calc_rev, calc_lev, balance);
86  }
87 
88  EIG (const ComplexMatrix& a, const ComplexMatrix& b,
89  bool calc_rev = true, bool calc_lev = true, bool force_qz = false)
90  : lambda (), v (), w ()
91  {
92  init (a, b, calc_rev, calc_lev, force_qz);
93  }
94 
95  EIG (const ComplexMatrix& a, const ComplexMatrix& b,
96  octave_idx_type& info, bool calc_rev = true, bool calc_lev = true,
97  bool force_qz = false)
98  : lambda (), v (), w ()
99  {
100  info = init (a, b, calc_rev, calc_lev, force_qz);
101  }
102 
103  EIG (const EIG& a) : lambda (a.lambda), v (a.v), w (a.w) { }
104 
105  EIG& operator = (const EIG& a)
106  {
107  if (this != &a)
108  {
109  lambda = a.lambda;
110  v = a.v;
111  w = a.w;
112  }
113  return *this;
114  }
115 
116  ~EIG (void) = default;
117 
118  ComplexColumnVector eigenvalues (void) const { return lambda; }
119  ComplexMatrix right_eigenvectors (void) const { return v; }
120  ComplexMatrix left_eigenvectors (void) const { return w; }
121 
122  friend std::ostream& operator << (std::ostream& os, const EIG& a);
123 
124 private:
125 
129 
130  octave_idx_type init (const Matrix& a, bool calc_rev, bool calc_lev,
131  bool balance);
132 
133  octave_idx_type init (const Matrix& a, const Matrix& b,
134  bool calc_rev, bool calc_lev, bool force_qz);
135 
136  octave_idx_type init (const ComplexMatrix& a, bool calc_rev,
137  bool calc_lev, bool balance);
138 
139  octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b,
140  bool calc_rev, bool calc_lev, bool force_qz);
141 
142  octave_idx_type symmetric_init (const Matrix& a, bool calc_rev,
143  bool calc_lev);
144 
145  octave_idx_type symmetric_init (const Matrix& a, const Matrix& b,
146  bool calc_rev, bool calc_lev);
147 
148  octave_idx_type hermitian_init (const ComplexMatrix& a,
149  bool calc_rev, bool calc_lev);
150 
151  octave_idx_type hermitian_init (const ComplexMatrix& a,
152  const ComplexMatrix& b,
153  bool calc_rev, bool calc_lev);
154 
155 };
156 
157 #endif
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:95
EIG(const EIG &a)
Definition: EIG.h:103
Definition: EIG.h:35
EIG(const Matrix &a, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:46
ComplexMatrix right_eigenvectors(void) const
Definition: EIG.h:119
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
EIG(void)
Definition: EIG.h:44
std::complex< double > w(std::complex< double > z, double relerr=0)
EIG(const ComplexMatrix &a, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:74
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:56
Definition: dMatrix.h:36
ComplexMatrix w
Definition: EIG.h:128
ComplexColumnVector lambda
Definition: EIG.h:126
EIG(const ComplexMatrix &a, const ComplexMatrix &b, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:88
EIG(const ComplexMatrix &a, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:81
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexMatrix v
Definition: EIG.h:127
b
Definition: cellfun.cc:400
ComplexColumnVector eigenvalues(void) const
Definition: EIG.h:118
EIG(const Matrix &a, octave_idx_type &info, bool calc_rev=true, bool calc_lev=true, bool balance=true)
Definition: EIG.h:53
EIG(const Matrix &a, const Matrix &b, bool calc_rev=true, bool calc_lev=true, bool force_qz=false)
Definition: EIG.h:60
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:67
octave::stream os
Definition: file-io.cc:627
ComplexMatrix left_eigenvectors(void) const
Definition: EIG.h:120