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