00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_DiagMatrix_h)
00025 #define octave_DiagMatrix_h 1
00026
00027 #include "MDiagArray2.h"
00028
00029 #include "dRowVector.h"
00030 #include "dColVector.h"
00031 #include "DET.h"
00032
00033 #include "mx-defs.h"
00034
00035 class
00036 OCTAVE_API
00037 DiagMatrix : public MDiagArray2<double>
00038 {
00039 friend class SVD;
00040 friend class ComplexSVD;
00041
00042 public:
00043
00044 DiagMatrix (void) : MDiagArray2<double> () { }
00045
00046 DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { }
00047
00048 DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { }
00049
00050 DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { }
00051
00052 DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { }
00053
00054 template <class U>
00055 DiagMatrix (const DiagArray2<U>& a) : MDiagArray2<double> (a) { }
00056
00057 explicit DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { }
00058
00059 explicit DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { }
00060
00061 DiagMatrix& operator = (const DiagMatrix& a)
00062 {
00063 MDiagArray2<double>::operator = (a);
00064 return *this;
00065 }
00066
00067 bool operator == (const DiagMatrix& a) const;
00068 bool operator != (const DiagMatrix& a) const;
00069
00070 DiagMatrix& fill (double val);
00071 DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end);
00072 DiagMatrix& fill (const ColumnVector& a);
00073 DiagMatrix& fill (const RowVector& a);
00074 DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg);
00075 DiagMatrix& fill (const RowVector& a, octave_idx_type beg);
00076
00077 DiagMatrix transpose (void) const { return MDiagArray2<double>::transpose(); }
00078 DiagMatrix abs (void) const;
00079
00080 friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a);
00081 friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a);
00082
00083
00084
00085 Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const;
00086
00087
00088
00089 RowVector row (octave_idx_type i) const;
00090 RowVector row (char *s) const;
00091
00092 ColumnVector column (octave_idx_type i) const;
00093 ColumnVector column (char *s) const;
00094
00095 DiagMatrix inverse (void) const;
00096 DiagMatrix inverse (octave_idx_type& info) const;
00097 DiagMatrix pseudo_inverse (void) const;
00098
00099
00100
00101 ColumnVector diag (octave_idx_type k = 0) const
00102 { return MDiagArray2<double>::diag (k); }
00103
00104 DET determinant (void) const;
00105 double rcond (void) const;
00106
00107
00108
00109 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a);
00110
00111 private:
00112
00113 DiagMatrix (double *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2<double> (d, nr, nc) { }
00114 };
00115
00116 OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a);
00117 OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a);
00118
00119
00120
00121 OCTAVE_API DiagMatrix
00122 operator * (const DiagMatrix& a, const DiagMatrix& b);
00123
00124 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, DiagMatrix, double)
00125
00126 #endif
00127
00128
00129
00130
00131
00132