00001 // LAPACK++ (V. 1.1) 00002 // (C) 1992-1996 All Rights Reserved. 00003 00004 00005 #ifndef _LA_SPD_TRIDIAG_MAT_DOUBLE_H_ 00006 #define _LA_SPD_TRIDIAG_MAT_DOUBLE_H_ 00007 00008 #include "arch.h" 00009 #include "lafnames.h" 00010 #include LA_VECTOR_DOUBLE_H 00011 00012 class DLLIMPORT LaSpdTridiagMatDouble 00013 { 00014 int size_; 00015 LaVectorDouble d_; /* main diag */ 00016 LaVectorDouble dl_; /* lower diag */ 00017 static double outofbounds_; /* return this address, when addresing 00018 out of bounds */ 00019 static int debug_; // print debug info. 00020 static int *info_; // print matrix info only, not values 00021 // originally 0, set to 1, and then 00022 // reset to 0 after use. 00023 00024 public: 00025 00026 // constructors / destructor 00027 00028 inline LaSpdTridiagMatDouble(); 00029 inline LaSpdTridiagMatDouble(int N); 00030 inline LaSpdTridiagMatDouble(const LaSpdTridiagMatDouble &); 00031 inline ~LaSpdTridiagMatDouble(); 00032 00033 // operators and member functions 00034 00035 double& operator()(int i, int j); 00036 double operator()(int i, int j) const; 00037 LaVectorDouble diag(int); /* 0 main, -1 lower, 1 upper */ 00038 inline LaSpdTridiagMatDouble& ref(LaSpdTridiagMatDouble&); 00039 inline LaSpdTridiagMatDouble& copy(const LaSpdTridiagMatDouble&); 00040 inline const LaSpdTridiagMatDouble& info() const { 00041 int *t = info_; 00042 *t = 1; 00043 return *this;}; 00044 inline int debug() const { // return debug flag. 00045 return debug_;} 00046 inline int size() const; 00047 00048 00049 00050 friend DLLIMPORT std::ostream& operator<<(std::ostream&,const LaSpdTridiagMatDouble&); 00051 00052 00053 }; 00054 00055 DLLIMPORT std::ostream& operator<<(std::ostream& s, const LaSpdTridiagMatDouble& td); 00056 00057 // constructors 00058 00059 inline LaSpdTridiagMatDouble::LaSpdTridiagMatDouble(): 00060 d_(), dl_() 00061 { 00062 size_ = 0; 00063 } 00064 00065 inline LaSpdTridiagMatDouble::LaSpdTridiagMatDouble(int N): 00066 d_(N), dl_(N-1) 00067 { 00068 size_ = N; 00069 } 00070 00071 inline LaSpdTridiagMatDouble::LaSpdTridiagMatDouble(const LaSpdTridiagMatDouble& td): d_(td.d_), dl_(td.dl_) 00072 { 00073 size_ = td.size_; 00074 } 00075 00076 // destructor 00077 00078 inline LaSpdTridiagMatDouble::~LaSpdTridiagMatDouble() 00079 { 00080 } 00081 00082 00083 // operators and member functions 00084 00085 00086 00087 00088 00089 inline LaSpdTridiagMatDouble& LaSpdTridiagMatDouble::ref(LaSpdTridiagMatDouble&T) 00090 { 00091 d_.ref(T.d_); 00092 dl_.ref(T.dl_); 00093 size_ = T.size_; 00094 00095 return *this; 00096 } 00097 00098 00099 inline LaSpdTridiagMatDouble& LaSpdTridiagMatDouble::copy(const LaSpdTridiagMatDouble&T) 00100 { 00101 d_.copy(T.d_); 00102 dl_.copy(T.dl_); 00103 size_ = T.size_; 00104 00105 return *this; 00106 } 00107 00108 inline int LaSpdTridiagMatDouble::size() const 00109 { 00110 return size_; 00111 } 00112 00113 00114 00115 #endif 00116 // _LA_SPD_TRIDIAG_MAT_DOUBLE_H_