00001 00004 #ifndef tDIM 00005 #define tDIM 9 00006 #endif 00007 00008 00009 class Ptm(Type) 00010 00011 { 00012 Type t[tDIM]; 00013 Ptv(Type) row; 00014 00015 int num_rows; 00016 int& num_cols; 00017 int i_row; 00018 00019 Ptv(Type)& getRow (int); 00020 00021 Type dot (int, const Type*, int, const Type*, int) const; 00022 00023 public: 00024 00025 Ptm(Type) () : num_cols(row.n) { num_rows=i_row=0;} 00026 Ptm(Type) (const int n) : num_cols(row.n) { redim (n); } 00027 Ptm(Type) (const int m, const int n) : num_cols(row.n) { redim (m,n); } 00028 00029 Ptm(Type) (const Ptv(Type)& v1) : num_cols(row.n) { redim (v1); } 00030 00031 Ptm(Type) (const Ptv(Type)& v1, 00032 const Ptv(Type)& v2) : num_cols(row.n) { redim (v1,v2); } 00033 00034 Ptm(Type) (const Ptv(Type)& v1, 00035 const Ptv(Type)& v2, 00036 const Ptv(Type)& v3) : num_cols(row.n) { redim (v1,v2,v3); } 00037 00038 Ptm(Type) (const Ptm(Type)& T) : num_cols(row.n) { redim (T); } 00039 ~Ptm(Type) () {}; 00040 00041 bool ok () const; 00042 00043 void redim (int n); 00044 void redim (int m, int n); 00045 void redim (const Ptv(Type)& v1); 00046 void redim (const Ptv(Type)& v1, const Ptv(Type)& v2); 00047 void redim (const Ptv(Type)& v1, const Ptv(Type)& v2, const Ptv(Type)& v3); 00048 void redim (const Ptm(Type)& T); 00049 00050 void fill (Type* value); 00051 void fill (Type value); 00052 void mult (Type value); 00053 00054 int getNoRows () const { return num_rows; } 00055 int getNoColumns () const { return num_cols; } 00056 int size () const { return num_rows*num_cols; } 00057 00058 Type& operator () (int i, int j); 00059 Type operator () (int i, int j) const; 00060 00061 Ptv(Type)& operator () (int i); 00062 Ptv(Type) operator () (int i) const; 00063 00064 Type* getPtr (); 00065 00066 Ptm(Type)& operator = (const Type& value); 00067 Ptm(Type)& operator = (const Ptm(Type)& T); 00068 00069 bool operator == (const Ptm(Type)& T) const; 00070 bool operator != (const Ptm(Type)& T) const; 00071 00072 bool eq (const Ptm(Type)& T, real tolerance = comparison_tolerance) const; 00073 bool neq (const Ptm(Type)& T, real tolerance = comparison_tolerance) const; 00074 00075 Ptv(Type) operator * (const Ptv(Type)& X) const; 00076 Ptm(Type) operator * (const Ptm(Type)& T) const; 00077 00078 void prod (Ptv(Type)& X) const; 00079 void prod (Ptv(Type)& Y, const Ptv(Type)& X, 00080 bool add_to) const; 00081 void prod (Ptm(Type)& R, const Ptm(Type)& T, 00082 bool add_to) const; 00083 00084 void add (Type a, const Ptm(Type)& X); 00085 void add (const Ptm(Type)& X); 00086 void sub (const Ptm(Type)& X); 00087 00088 Type prod (const Ptv(Type)& X, const Ptv(Type)& Y) const; 00089 Type inner (const Ptm(Type)& T) const; 00090 real inner () const; 00091 Type trace () const; 00092 00093 void transpose (); 00094 void symmetric (); 00095 00096 void print (Os os, const char* = NULL) const; 00097 }; 00098 00099