GNU Octave 7.1.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-2022 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
39class
42{
43public:
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
78
80 : MDiagArray2<FloatComplex> (a) { }
81
82 template <typename U>
84 : MDiagArray2<FloatComplex> (a) { }
85
88
89 OCTAVE_API FloatComplexDiagMatrix& fill (float val);
92 fill (float val, octave_idx_type beg, octave_idx_type end);
94 fill (const FloatComplex& val, octave_idx_type beg, octave_idx_type end);
100 fill (const FloatColumnVector& a, octave_idx_type beg);
102 fill (const FloatComplexColumnVector& a, octave_idx_type beg);
104 fill (const FloatRowVector& a, octave_idx_type beg);
106 fill (const FloatComplexRowVector& a, octave_idx_type beg);
107
112 OCTAVE_API FloatDiagMatrix abs (void) const;
113
115 conj (const FloatComplexDiagMatrix& a);
116
117 // resize is the destructive analog for this one
118
120 extract (octave_idx_type r1, octave_idx_type c1,
121 octave_idx_type r2, octave_idx_type c2) const;
122
123 // extract row or column i
124
126 OCTAVE_API FloatComplexRowVector row (char *s) const;
127
129 OCTAVE_API FloatComplexColumnVector column (char *s) const;
130
132 OCTAVE_API FloatComplexDiagMatrix inverse (void) const;
133 OCTAVE_API FloatComplexDiagMatrix pseudo_inverse (float tol = 0.0f) const;
134
135 OCTAVE_API bool all_elements_are_real (void) const;
136
137 // diagonal matrix by diagonal matrix -> diagonal matrix operations
138
141
142 // other operations
143
146
147 OCTAVE_API FloatComplexDET determinant (void) const;
148 OCTAVE_API float rcond (void) const;
149
150 // i/o
151
152 friend OCTAVE_API std::ostream&
153 operator << (std::ostream& os, const FloatComplexDiagMatrix& a);
154
155};
156
158
159// diagonal matrix by diagonal matrix -> diagonal matrix operations
160
163
166
169
171
172#endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:156
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:156
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MDiagArray2.h:132
OCTAVE_API Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:50
FloatComplexDiagMatrix transpose(void) const
Definition: fCDiagMatrix.h:110
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:144
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:108
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 > transpose(void) const
Definition: MDiagArray2.h:106
MDiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
Definition: MDiagArray2.h:107
Definition: DET.h:39
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:536
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:520
OCTAVE_API FloatComplexDiagMatrix conj(const FloatComplexDiagMatrix &a)
OCTAVE_API FloatComplexDiagMatrix operator*(const FloatComplexDiagMatrix &a, const FloatComplexDiagMatrix &b)
#define OCTAVE_API
Definition: main.in.cc:55
class OCTAVE_API FloatComplexDiagMatrix
Definition: mx-fwd.h:62
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34
static T abs(T x)
Definition: pr-output.cc:1678