GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fCDiagMatrix.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_fCDiagMatrix_h)
27 #define octave_fCDiagMatrix_h 1
28 
29 #include "octave-config.h"
30 
31 #include "DET.h"
32 #include "MDiagArray2.h"
33 #include "fCColVector.h"
34 #include "fCRowVector.h"
35 #include "fColVector.h"
36 #include "fRowVector.h"
37 #include "mx-defs.h"
38 
39 class
40 OCTAVE_API
42 {
43 public:
44 
46 
47  typedef float real_elt_type;
50 
51  FloatComplexDiagMatrix (void) = default;
52 
54 
55  FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) = default;
56 
57  ~FloatComplexDiagMatrix (void) = default;
58 
61  : MDiagArray2<FloatComplex> (r, c) { }
62 
64  const FloatComplex& val)
65  : MDiagArray2<FloatComplex> (r, c, val) { }
66 
68  : MDiagArray2<FloatComplex> (a) { }
69 
72  : MDiagArray2<FloatComplex> (a, r, c) { }
73 
76 
77  explicit FloatComplexDiagMatrix (const FloatDiagMatrix& a);
78 
80  : MDiagArray2<FloatComplex> (a) { }
81 
82  template <typename U>
84  : MDiagArray2<FloatComplex> (a) { }
85 
86  bool operator == (const FloatComplexDiagMatrix& a) const;
87  bool operator != (const FloatComplexDiagMatrix& a) const;
88 
89  FloatComplexDiagMatrix& fill (float val);
90  FloatComplexDiagMatrix& fill (const FloatComplex& val);
91  FloatComplexDiagMatrix& fill (float val,
93  FloatComplexDiagMatrix& fill (const FloatComplex& val,
97  FloatComplexDiagMatrix& fill (const FloatRowVector& a);
100  octave_idx_type beg);
102  octave_idx_type beg);
105  octave_idx_type beg);
106 
111  FloatDiagMatrix abs (void) const;
112 
113  friend OCTAVE_API FloatComplexDiagMatrix
114  conj (const FloatComplexDiagMatrix& a);
115 
116  // resize is the destructive analog for this one
117 
119  octave_idx_type r2, octave_idx_type c2) const;
120 
121  // extract row or column i
122 
124  FloatComplexRowVector row (char *s) const;
125 
126  FloatComplexColumnVector column (octave_idx_type i) const;
127  FloatComplexColumnVector column (char *s) const;
128 
129  FloatComplexDiagMatrix inverse (octave_idx_type& info) const;
130  FloatComplexDiagMatrix inverse (void) const;
131  FloatComplexDiagMatrix pseudo_inverse (float tol = 0.0f) const;
132 
133  bool all_elements_are_real (void) const;
134 
135  // diagonal matrix by diagonal matrix -> diagonal matrix operations
136 
139 
140  // other operations
141 
144 
145  FloatComplexDET determinant (void) const;
146  float rcond (void) const;
147 
148  // i/o
149 
150  friend std::ostream& operator << (std::ostream& os,
151  const FloatComplexDiagMatrix& a);
152 
153 };
154 
156 
157 // diagonal matrix by diagonal matrix -> diagonal matrix operations
158 
159 OCTAVE_API FloatComplexDiagMatrix
161 
162 OCTAVE_API FloatComplexDiagMatrix
164 
165 OCTAVE_API FloatComplexDiagMatrix
167 
169 
170 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:152
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:152
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MDiagArray2.h:128
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:128
Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:50
FloatComplexDiagMatrix transpose(void) const
Definition: fCDiagMatrix.h:109
FloatComplex element_type
Definition: fCDiagMatrix.h:49
FloatComplexDiagMatrix(const Array< float > &a)
Definition: fCDiagMatrix.h:74
FloatComplexColumnVector extract_diag(octave_idx_type k=0) const
Definition: fCDiagMatrix.h:142
FloatComplexDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition: fCDiagMatrix.h:59
FloatComplexDiagMatrix(void)=default
FloatComplexDiagMatrix(const FloatComplexDiagMatrix &a)=default
FloatComplexDiagMatrix(const Array< FloatComplex > &a, octave_idx_type r, octave_idx_type c)
Definition: fCDiagMatrix.h:70
~FloatComplexDiagMatrix(void)=default
FloatComplex complex_elt_type
Definition: fCDiagMatrix.h:48
FloatComplexDiagMatrix(const MDiagArray2< FloatComplex > &a)
Definition: fCDiagMatrix.h:79
FloatComplexDiagMatrix(const DiagArray2< U > &a)
Definition: fCDiagMatrix.h:83
FloatComplexDiagMatrix hermitian(void) const
Definition: fCDiagMatrix.h:107
FloatComplexMatrix full_matrix_type
Definition: fCDiagMatrix.h:45
FloatComplexDiagMatrix(const Array< FloatComplex > &a)
Definition: fCDiagMatrix.h:67
FloatComplexDiagMatrix(octave_idx_type r, octave_idx_type c, const FloatComplex &val)
Definition: fCDiagMatrix.h:63
MDiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
Definition: MDiagArray2.h:106
MDiagArray2< T > transpose(void) const
Definition: MDiagArray2.h:105
Definition: DET.h:39
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:601
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:585
OCTAVE_API FloatComplexDiagMatrix conj(const FloatComplexDiagMatrix &a)
OCTAVE_API FloatComplexDiagMatrix operator*(const FloatComplexDiagMatrix &a, const FloatComplexDiagMatrix &b)
T * r
Definition: mx-inlines.cc:773
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34
static T abs(T x)
Definition: pr-output.cc:1678