00001 00005 class MatTri(Type) : public Matrix(Type) 00006 00007 { 00008 00009 private: 00010 00011 Vec(Type) avec,bvec,cvec; 00012 Type zero_entry; 00013 00014 virtual void copy_matrix_attributes (const Matrix(Type)& X); 00015 virtual void reset (); 00016 00017 public: 00018 00019 00020 00021 MatTri(Type) (); 00022 00023 MatTri(Type) (int n); 00024 00025 MatTri(Type) (int nrows, int ncolumns); 00026 00027 MatTri(Type) (const MatTri(Type)& X); 00028 MatTri(Type) (const Matrix(prm_Type)& pm); 00029 00030 virtual ~MatTri(Type) (); 00031 00032 00033 00034 00035 00036 virtual int getNoRows () const { return avec.size(); } 00037 virtual int getNoColumns () const { return avec.size(); } 00038 virtual int getNoNonzeroes () const { return 3*avec.size()-2; } 00039 00040 virtual void size (int& m, int& n) const { 00041 m = n = avec.size(); 00042 } 00043 00044 int size() const { return avec.size();} 00045 00046 00047 virtual real getStorage() const; 00048 00049 00050 00051 00052 virtual bool makeItSimilar (Handle(Matrix(Type))& M) const; 00053 virtual bool redim (const Matrix(prm_Type)& pm); 00054 bool redim (int n); 00055 bool redim (int nrows, int ncolumns); 00056 00057 00058 00059 00060 virtual bool redim (const VecSimple(int)& ivec, 00061 const VecSimple(int)& jvec, 00062 int new_nrows, 00063 int new_ncolumns); 00064 virtual void getIndexSet (VecSimple(int)& ivec, 00065 VecSimple(int)& jvec) const; 00066 virtual bool validIndexSet (const VecSimple(int)& ivec, 00067 const VecSimple(int)& jvec, 00068 const int new_nrows, 00069 const int new_ncolumns); 00070 00071 00072 00073 00074 virtual Type& elm(int i, int j); 00075 00076 00077 Type& operator () (int i, int j); 00078 const Type& operator () (int i, int j) const; 00079 00080 00081 00082 const Type& a(int i) const { return avec(i); } 00083 const Type& b(int i) const { return bvec(i); } 00084 const Type& c(int i) const { return cvec(i); } 00085 Type& a(int i) { return avec(i); } 00086 Type& b(int i) { return bvec(i); } 00087 Type& c(int i) { return cvec(i); } 00088 00089 00090 Vec(Type)* getaPtr() { return &avec; } 00091 Vec(Type)* getbPtr() { return &bvec; } 00092 Vec(Type)* getcPtr() { return &cvec; } 00093 00094 Vec(Type)& getaRef() { return avec; } 00095 Vec(Type)& getbRef() { return bvec; } 00096 Vec(Type)& getcRef() { return cvec; } 00097 00098 virtual void fill (const Matrix(Type)& X); 00099 virtual void fill (Type a); 00100 00101 MatTri(Type)& operator = (const MatTri(Type)& X); 00102 MatTri(Type)& operator = (Type a) { fill(a); return *this; } 00103 00104 virtual void assemble (const Mat(Type)& em, 00105 const VecSimple(int)& idx_row_trans, 00106 const VecSimple(int)& idx_col_trans, 00107 int elm_no); 00108 00109 00110 00111 virtual void add (Matrix(Type)& bb, Matrix(Type)& cb); 00112 virtual void add (Matrix(Type)& bb, char s, Matrix(Type)& cb); 00113 virtual void add (Matrix(Type)& bb, Type b, Matrix(Type)& cb); 00114 virtual void add (Type a, Matrix(Type)& bb, Type b, Matrix(Type)& cb); 00115 00116 virtual void mult (Type value); 00117 00118 virtual void prod 00119 ( 00120 const Vector(Type)& xb, 00121 Vector(Type)& yb, 00122 TransposeMode tpmode = NOT_TRANSPOSED, 00123 bool add_to_yb = false 00124 ) const; 00125 00126 00127 00128 00129 00130 virtual bool factChol (bool zero_upper_part = true); 00131 virtual void forwBackChol (Vec(Type)& b, Vec(Type)& x); 00132 00133 virtual bool factLU (); 00134 virtual void forwBackLU (Vec(Type)& b, Vec(Type)& x); 00135 00136 virtual bool factRILU (real omega = 0.0, int level = 0); 00137 virtual void forwBackRILU (Vec(Type)& b, Vec(Type)& x); 00138 00139 virtual bool factorize (const FactStrategy& fstrategy); 00140 virtual void forwBack (Vector(Type)& bb, Vector(Type)& xb); 00141 00142 virtual void inverse (Mat(Type)& inv); 00143 virtual void inverse (Mat(Type)& inv, Vec(Type)& scratch); 00144 00145 virtual Type det (); 00146 00147 00148 00149 00150 virtual void SSOR1it (Vector(Type)& xnew, const Vector(Type)& xold, 00151 const Vector(Type)& b, real omega, 00152 TransposeMode tpmode = NOT_TRANSPOSED) const; 00153 virtual void SSORsolve (Vector(Type)& y, const Vector(Type)& c, 00154 real omega, 00155 TransposeMode tpmode = NOT_TRANSPOSED) const; 00156 00157 virtual void SOR1it (Vector(Type)& xnew, const Vector(Type)& xold, 00158 const Vector(Type)& b, real omega, 00159 TransposeMode tpmode = NOT_TRANSPOSED) const; 00160 virtual void SORsolve (Vector(Type)& y, const Vector(Type)& c, 00161 real omega, 00162 TransposeMode tpmode = NOT_TRANSPOSED) const; 00163 00164 virtual void Jacobi1it (Vector(Type)& xnew, const Vector(Type)& xold, 00165 const Vector(Type)& b, 00166 TransposeMode tpmode = NOT_TRANSPOSED) const; 00167 virtual void Jacobisolve (Vector(Type)& y, const Vector(Type)& c, 00168 TransposeMode tpmode = NOT_TRANSPOSED) const; 00169 00170 00171 00172 00173 virtual void print (Os os, const char* header = NULL, 00174 int nentries_per_line = 3) const; 00175 virtual void printAscii (Os os, const char* header = NULL) const; 00176 00177 virtual void scan (Is is); 00178 00179 friend Os& operator << (Os& os, const MatTri(Type)& X); 00180 friend Is& operator >> (Is& is, MatTri(Type)& X); 00181 00182 virtual void save (const char* filename, const char* name = "X") const; 00183 virtual void load (const char* filename, const char* name = "X"); 00184 00185 CLASS_INFO 00186 00187 VIRTUAL_CAST(MatTri(Type)) 00188 }; 00189 00190