GNU Octave  4.0.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-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_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 (double tol = 0.0) 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 
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
MDiagArray2< T > hermitian(T(*fcn)(const T &)=0) const
Definition: MDiagArray2.h:98
ComplexRowVector & fill(double val)
Definition: CRowVector.cc:121
ComplexDiagMatrix(const Array< Complex > &a, octave_idx_type r, octave_idx_type c)
Definition: CDiagMatrix.h:56
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
OCTAVE_API ComplexDiagMatrix conj(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.cc:244
ComplexDiagMatrix(const Array< double > &a)
Definition: CDiagMatrix.h:53
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
Definition: MDiagArray2.h:66
ComplexColumnVector extract_diag(octave_idx_type k=0) const
Definition: CDiagMatrix.h:130
ComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: CRowVector.cc:244
Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:58
ComplexDiagMatrix(const DiagArray2< U > &a)
Definition: CDiagMatrix.h:69
ComplexDiagMatrix hermitian(void) const
Definition: CDiagMatrix.h:96
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
ComplexRowVector & operator=(const ComplexRowVector &a)
Definition: CRowVector.h:59
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:256
Definition: DET.h:31
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c, const Complex &val)
Definition: CDiagMatrix.h:47
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:149
Array< Complex > column(octave_idx_type k) const
Extract column: A(:,k+1).
ComplexDiagMatrix(void)
Definition: CDiagMatrix.h:42
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition: CDiagMatrix.h:44
ComplexDiagMatrix transpose(void) const
Definition: CDiagMatrix.h:98
OCTAVE_API ComplexDiagMatrix operator*(const ComplexDiagMatrix &a, const ComplexDiagMatrix &b)
Definition: CDiagMatrix.cc:497
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:149
ComplexDiagMatrix(const MDiagArray2< Complex > &a)
Definition: CDiagMatrix.h:62
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
ComplexDiagMatrix(const Array< Complex > &a)
Definition: CDiagMatrix.h:50
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
std::complex< double > Complex
Definition: oct-cmplx.h:29
MDiagArray2< T > transpose(void) const
Definition: MDiagArray2.h:97
T abs(T x)
Definition: pr-output.cc:3062
ComplexDiagMatrix(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.h:65