GNU Octave  4.2.1
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-2017 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 "octave-config.h"
27 
28 #include "MDiagArray2.h"
29 
30 #include "dRowVector.h"
31 #include "CRowVector.h"
32 #include "dColVector.h"
33 #include "CColVector.h"
34 #include "DET.h"
35 
36 #include "mx-defs.h"
37 
38 class
39 OCTAVE_API
41 {
42 public:
43 
45 
47  : MDiagArray2<Complex> (r, c) { }
48 
50  : MDiagArray2<Complex> (r, c, val) { }
51 
53  : MDiagArray2<Complex> (a) { }
54 
55  explicit ComplexDiagMatrix (const Array<double>& a)
56  : MDiagArray2<Complex> (Array<Complex> (a)) { }
57 
60  : MDiagArray2<Complex> (a, r, c) { }
61 
62  explicit ComplexDiagMatrix (const DiagMatrix& a);
63 
65  : MDiagArray2<Complex> (a) { }
66 
68  : MDiagArray2<Complex> (a) { }
69 
70  template <typename U>
72  : MDiagArray2<Complex> (a) { }
73 
75  {
77  return *this;
78  }
79 
80  bool operator == (const ComplexDiagMatrix& a) const;
81  bool operator != (const ComplexDiagMatrix& a) const;
82 
83  ComplexDiagMatrix& fill (double val);
85  ComplexDiagMatrix& fill (double val,
97 
101  { return MDiagArray2<Complex>::transpose (); }
102  DiagMatrix abs (void) const;
103 
104  friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
105 
106  // resize is the destructive analog for this one
107 
109  octave_idx_type r2, octave_idx_type c2) const;
110 
111  // extract row or column i
112 
114  ComplexRowVector row (char *s) const;
115 
117  ComplexColumnVector column (char *s) const;
118 
119  ComplexDiagMatrix inverse (octave_idx_type& info) const;
120  ComplexDiagMatrix inverse (void) const;
121  ComplexDiagMatrix pseudo_inverse (double tol = 0.0) const;
122 
123  bool all_elements_are_real (void) const;
124 
125  // diagonal matrix by diagonal matrix -> diagonal matrix operations
126 
129 
130  // other operations
131 
134 
135  ComplexDET determinant (void) const;
136  double rcond (void) const;
137 
138  // i/o
139 
140  friend std::ostream& operator << (std::ostream& os,
141  const ComplexDiagMatrix& a);
142 
143 };
144 
145 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
146 
147 // diagonal matrix by diagonal matrix -> diagonal matrix operations
148 
149 OCTAVE_API ComplexDiagMatrix
151 
152 OCTAVE_API ComplexDiagMatrix
153 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b);
154 
155 OCTAVE_API ComplexDiagMatrix
156 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b);
157 
159 
160 #endif
MDiagArray2< T > hermitian(T(*fcn)(const T &)=0) const
Definition: MDiagArray2.h:110
ComplexRowVector & fill(double val)
Definition: CRowVector.cc:96
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:58
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:567
OCTAVE_API ComplexDiagMatrix conj(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.cc:214
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
ComplexDiagMatrix(const Array< double > &a)
Definition: CDiagMatrix.h:55
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
Definition: MDiagArray2.h:78
ComplexColumnVector extract_diag(octave_idx_type k=0) const
Definition: CDiagMatrix.h:132
for large enough k
Definition: lu.cc:606
ComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: CRowVector.cc:213
Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:58
ComplexDiagMatrix(const DiagArray2< U > &a)
Definition: CDiagMatrix.h:71
ComplexDiagMatrix hermitian(void) const
Definition: CDiagMatrix.h:98
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MDiagArray2.h:132
s
Definition: file-io.cc:2682
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:398
ComplexRowVector & operator=(const ComplexRowVector &a)
Definition: CRowVector.h:61
Definition: DET.h:33
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c, const Complex &val)
Definition: CDiagMatrix.h:49
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:151
ComplexDiagMatrix(void)
Definition: CDiagMatrix.h:44
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:538
ComplexDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition: CDiagMatrix.h:46
ComplexDiagMatrix transpose(void) const
Definition: CDiagMatrix.h:100
OCTAVE_API ComplexDiagMatrix operator*(const ComplexDiagMatrix &a, const ComplexDiagMatrix &b)
Definition: CDiagMatrix.cc:440
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:151
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
ComplexDiagMatrix(const MDiagArray2< Complex > &a)
Definition: CDiagMatrix.h:64
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
b
Definition: cellfun.cc:398
ComplexDiagMatrix(const Array< Complex > &a)
Definition: CDiagMatrix.h:52
std::complex< double > Complex
Definition: oct-cmplx.h:31
MDiagArray2< T > transpose(void) const
Definition: MDiagArray2.h:109
ComplexDiagMatrix(const ComplexDiagMatrix &a)
Definition: CDiagMatrix.h:67
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