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
fDiagMatrix.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_fDiagMatrix_h)
24 #define octave_fDiagMatrix_h 1
25 
26 #include "MDiagArray2.h"
27 
28 #include "fRowVector.h"
29 #include "fColVector.h"
30 #include "DET.h"
31 
32 #include "mx-defs.h"
33 
34 class
35 OCTAVE_API
37 {
38  friend class FloatSVD;
39  friend class FloatComplexSVD;
40 
41 public:
42 
44 
46  : MDiagArray2<float> (r, c) { }
47 
49  : MDiagArray2<float> (r, c, val) { }
50 
52 
54 
55  template <class U>
57 
58  explicit FloatDiagMatrix (const Array<double>& a) : MDiagArray2<float> (a) { }
59 
61  : MDiagArray2<float> (a, r, c) { }
62 
64  {
66  return *this;
67  }
68 
69  bool operator == (const FloatDiagMatrix& a) const;
70  bool operator != (const FloatDiagMatrix& a) const;
71 
72  FloatDiagMatrix& fill (float val);
73  FloatDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type end);
74  FloatDiagMatrix& fill (const FloatColumnVector& a);
75  FloatDiagMatrix& fill (const FloatRowVector& a);
77  FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg);
78 
80  { return MDiagArray2<float>::transpose (); }
81 
82  FloatDiagMatrix abs (void) const;
83 
84  friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a);
85  friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a);
86 
87  // resize is the destructive analog for this one
88 
91 
92  // extract row or column i.
93 
94  FloatRowVector row (octave_idx_type i) const;
95  FloatRowVector row (char *s) const;
96 
97  FloatColumnVector column (octave_idx_type i) const;
98  FloatColumnVector column (char *s) const;
99 
100  FloatDiagMatrix inverse (void) const;
101  FloatDiagMatrix inverse (octave_idx_type& info) const;
102  FloatDiagMatrix pseudo_inverse (float tol = 0.0f) const;
103 
104  // other operations
105 
107  { return MDiagArray2<float>::extract_diag (k); }
108 
109  FloatDET determinant (void) const;
110  float rcond (void) const;
111 
112  // i/o
113 
114  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
115  const FloatDiagMatrix& a);
116 
117 };
118 
119 OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a);
120 OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a);
121 
122 // diagonal matrix by diagonal matrix -> diagonal matrix operations
123 
124 OCTAVE_API FloatDiagMatrix operator * (const FloatDiagMatrix& a,
125  const FloatDiagMatrix& b);
126 
128 
129 #endif
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
OCTAVE_API FloatDiagMatrix imag(const FloatComplexDiagMatrix &a)
Definition: fDiagMatrix.cc:154
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
Definition: MDiagArray2.h:66
FloatDiagMatrix(const MDiagArray2< float > &a)
Definition: fDiagMatrix.h:53
OCTAVE_API FloatDiagMatrix real(const FloatComplexDiagMatrix &a)
Definition: fDiagMatrix.cc:148
FloatComplexSVD & operator=(const FloatComplexSVD &a)
Definition: fCmplxSVD.h:63
Array< T > extract_diag(octave_idx_type k=0) const
Definition: DiagArray2.cc:58
FloatDiagMatrix(octave_idx_type r, octave_idx_type c, float val)
Definition: fDiagMatrix.h:48
FloatDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition: fDiagMatrix.h:45
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
FloatDiagMatrix transpose(void) const
Definition: fDiagMatrix.h:79
F77_RET_T const double const double * f
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:256
Definition: DET.h:31
FloatDiagMatrix(const Array< float > &a, octave_idx_type r, octave_idx_type c)
Definition: fDiagMatrix.h:60
FloatColumnVector extract_diag(octave_idx_type k=0) const
Definition: fDiagMatrix.h:106
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
FloatDiagMatrix(const DiagArray2< U > &a)
Definition: fDiagMatrix.h:56
FloatDiagMatrix(const FloatDiagMatrix &a)
Definition: fDiagMatrix.h:51
FloatDiagMatrix(const Array< double > &a)
Definition: fDiagMatrix.h:58
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
OCTAVE_API FloatDiagMatrix operator*(const FloatDiagMatrix &a, const FloatDiagMatrix &b)
Definition: fDiagMatrix.cc:320
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
FloatDiagMatrix(void)
Definition: fDiagMatrix.h:43
MDiagArray2< T > transpose(void) const
Definition: MDiagArray2.h:97
T abs(T x)
Definition: pr-output.cc:3062