GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CDiagMatrix.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2013 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_CDiagMatrix_h)
24 #define octave_CDiagMatrix_h 1
25 
26 #include "MDiagArray2.h"
27 
28 #include "dRowVector.h"
29 #include "CRowVector.h"
30 #include "dColVector.h"
31 #include "CColVector.h"
32 #include "DET.h"
33 
34 #include "mx-defs.h"
35 
36 class
37 OCTAVE_API
39 {
40 public:
41 
43 
45  : MDiagArray2<Complex> (r, c) { }
46 
48  : MDiagArray2<Complex> (r, c, val) { }
49 
50  explicit ComplexDiagMatrix (const Array<Complex>& a)
51  : MDiagArray2<Complex> (a) { }
52 
53  explicit ComplexDiagMatrix (const Array<double>& a)
54  : MDiagArray2<Complex> (Array<Complex> (a)) { }
55 
58  : MDiagArray2<Complex> (a, r, c) { }
59 
60  explicit ComplexDiagMatrix (const DiagMatrix& a);
61 
63  : MDiagArray2<Complex> (a) { }
64 
66  : MDiagArray2<Complex> (a) { }
67 
68  template <class U>
70  : MDiagArray2<Complex> (a) { }
71 
73  {
75  return *this;
76  }
77 
78  bool operator == (const ComplexDiagMatrix& a) const;
79  bool operator != (const ComplexDiagMatrix& a) const;
80 
81  ComplexDiagMatrix& fill (double val);
82  ComplexDiagMatrix& fill (const Complex& val);
83  ComplexDiagMatrix& fill (double val,
85  ComplexDiagMatrix& fill (const Complex& val,
89  ComplexDiagMatrix& fill (const RowVector& a);
95 
99  { return MDiagArray2<Complex>::transpose (); }
100  DiagMatrix abs (void) const;
101 
102  friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
103 
104  // resize is the destructive analog for this one
105 
108 
109  // extract row or column i
110 
111  ComplexRowVector row (octave_idx_type i) const;
112  ComplexRowVector row (char *s) const;
113 
115  ComplexColumnVector column (char *s) const;
116 
117  ComplexDiagMatrix inverse (octave_idx_type& info) const;
118  ComplexDiagMatrix inverse (void) const;
119  ComplexDiagMatrix pseudo_inverse (void) const;
120 
121  bool all_elements_are_real (void) const;
122 
123  // diagonal matrix by diagonal matrix -> diagonal matrix operations
124 
127 
128  // other operations
129 
130  ComplexColumnVector extract_diag (octave_idx_type k = 0) const
131  { return MDiagArray2<Complex>::extract_diag (k); }
132 
133  ComplexDET determinant (void) const;
134  double rcond (void) const;
135 
136  // i/o
137 
138  friend std::ostream& operator << (std::ostream& os,
139  const ComplexDiagMatrix& a);
140 
141 };
142 
143 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
144 
145 // diagonal matrix by diagonal matrix -> diagonal matrix operations
146 
147 OCTAVE_API ComplexDiagMatrix
149 
150 OCTAVE_API ComplexDiagMatrix
151 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b);
152 
153 OCTAVE_API ComplexDiagMatrix
154 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b);
155 
157 
158 #endif