GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
CDiagMatrix.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_CDiagMatrix_h)
24 #define octave_CDiagMatrix_h 1
25 
26 #include "octave-config.h"
27 
28 #include "CColVector.h"
29 #include "CRowVector.h"
30 #include "DET.h"
31 #include "MDiagArray2.h"
32 #include "dColVector.h"
33 #include "dRowVector.h"
34 #include "mx-defs.h"
35 
36 class
37 OCTAVE_API
39 {
40 public:
41 
43 
44  typedef double real_elt_type;
47 
49 
51  : MDiagArray2<Complex> (r, c) { }
52 
54  : MDiagArray2<Complex> (r, c, val) { }
55 
57  : MDiagArray2<Complex> (a) { }
58 
59  explicit ComplexDiagMatrix (const Array<double>& a)
60  : MDiagArray2<Complex> (Array<Complex> (a)) { }
61 
64  : MDiagArray2<Complex> (a, r, c) { }
65 
66  explicit ComplexDiagMatrix (const DiagMatrix& a);
67 
69  : MDiagArray2<Complex> (a) { }
70 
72  : MDiagArray2<Complex> (a) { }
73 
74  template <typename U>
76  : MDiagArray2<Complex> (a) { }
77 
79  {
81  return *this;
82  }
83 
84  bool operator == (const ComplexDiagMatrix& a) const;
85  bool operator != (const ComplexDiagMatrix& a) const;
86 
87  ComplexDiagMatrix& fill (double val);
89  ComplexDiagMatrix& fill (double val,
101 
105  { return MDiagArray2<Complex>::transpose (); }
106  DiagMatrix abs (void) const;
107 
108  friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
109 
110  // resize is the destructive analog for this one
111 
113  octave_idx_type r2, octave_idx_type c2) const;
114 
115  // extract row or column i
116 
118  ComplexRowVector row (char *s) const;
119 
121  ComplexColumnVector column (char *s) const;
122 
123  ComplexDiagMatrix inverse (octave_idx_type& info) const;
124  ComplexDiagMatrix inverse (void) const;
125  ComplexDiagMatrix pseudo_inverse (double tol = 0.0) const;
126 
127  bool all_elements_are_real (void) const;
128 
129  // diagonal matrix by diagonal matrix -> diagonal matrix operations
130 
133 
134  // other operations
135 
138 
139  ComplexDET determinant (void) const;
140  double rcond (void) const;
141 
142  // i/o
143 
144  friend std::ostream& operator << (std::ostream& os,
145  const ComplexDiagMatrix& a);
146 
147 };
148 
149 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
150 
151 // diagonal matrix by diagonal matrix -> diagonal matrix operations
152 
153 OCTAVE_API ComplexDiagMatrix
155 
156 OCTAVE_API ComplexDiagMatrix
157 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b);
158 
159 OCTAVE_API ComplexDiagMatrix
160 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b);
161 
163 
164 #endif
ComplexRowVector & fill(double val)
Definition: CRowVector.cc:95
OCTAVE_EXPORT octave_value_list column
Definition: sparse.cc:123
ComplexDiagMatrix(const Array< Complex > &a, octave_idx_type r, octave_idx_type c)
Definition: CDiagMatrix.h:62
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:566
ComplexDiagMatrix transpose(void) const
Definition: CDiagMatrix.h:104
OCTAVE_API ComplexDiagMatrix conj(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.cc:213
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
ComplexDiagMatrix(const Array< double > &a)
Definition: CDiagMatrix.h:59
for large enough k
Definition: lu.cc:617
ComplexColumnVector extract_diag(octave_idx_type k=0) const
Definition: CDiagMatrix.h:136
static T abs(T x)
Definition: pr-output.cc:1696
Complex complex_elt_type
Definition: CDiagMatrix.h:45
ComplexDiagMatrix(const DiagArray2< U > &a)
Definition: CDiagMatrix.h:75
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MDiagArray2.h:126
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
ComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: CRowVector.cc:212
double real_elt_type
Definition: CDiagMatrix.h:44
Template for two dimensional diagonal array with math operators.
Definition: MDiagArray2.h:32
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
ComplexRowVector & operator=(const ComplexRowVector &a)
Definition: CRowVector.h:60
Definition: DET.h:34
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c, const Complex &val)
Definition: CDiagMatrix.h:53
ComplexMatrix full_matrix_type
Definition: CDiagMatrix.h:42
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:150
ComplexDiagMatrix(void)
Definition: CDiagMatrix.h:48
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
Definition: MDiagArray2.h:77
Complex element_type
Definition: CDiagMatrix.h:46
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
ComplexDiagMatrix hermitian(void) const
Definition: CDiagMatrix.h:102
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition: CDiagMatrix.h:50
MDiagArray2< T > transpose(void) const
Definition: MDiagArray2.h:103
OCTAVE_API ComplexDiagMatrix operator*(const ComplexDiagMatrix &a, const ComplexDiagMatrix &b)
Definition: CDiagMatrix.cc:439
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:150
Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:50
ComplexDiagMatrix(const MDiagArray2< Complex > &a)
Definition: CDiagMatrix.h:68
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
b
Definition: cellfun.cc:400
for i
Definition: data.cc:5264
MDiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
Definition: MDiagArray2.h:104
ComplexDiagMatrix(const Array< Complex > &a)
Definition: CDiagMatrix.h:56
std::complex< double > Complex
Definition: oct-cmplx.h:31
ComplexDiagMatrix(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.h:71
octave::stream os
Definition: file-io.cc:627
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
Definition: str2double.cc:342