Lapack++
|
00001 // LAPACK++ (V. 1.1) 00002 // (C) 1992-1996 All Rights Reserved. 00003 00004 00005 #include "arch.h" 00006 #ifndef _LA_UNIT_UPPER_TRIANG_MAT_DOUBLE_H_ 00007 #define _LA_UNIT_UPPER_TRIANG_MAT_DOUBLE_H_ 00008 00009 #include "lafnames.h" 00010 #include LA_GEN_MAT_DOUBLE_H 00011 00012 00013 //#define UNIT_UPPER_INDEX_CHK 00014 00015 class DLLIMPORT LaUnitUpperTriangMatDouble 00016 { 00017 LaGenMatDouble data_; 00018 static double outofbounds_; 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 public: 00024 00025 // constructors 00026 00027 inline LaUnitUpperTriangMatDouble(); 00028 inline LaUnitUpperTriangMatDouble(int, int); 00029 inline LaUnitUpperTriangMatDouble(double*, int, int); 00030 inline LaUnitUpperTriangMatDouble(const LaUnitUpperTriangMatDouble &); 00031 00032 // operators 00033 00034 inline LaUnitUpperTriangMatDouble& ref(LaUnitUpperTriangMatDouble &); 00035 inline LaUnitUpperTriangMatDouble& ref(LaGenMatDouble &); 00036 LaUnitUpperTriangMatDouble& copy(LaUnitUpperTriangMatDouble &); 00037 LaUnitUpperTriangMatDouble& operator=(const double &); 00038 inline LaUnitUpperTriangMatDouble& operator=(const LaUnitUpperTriangMatDouble &); 00039 double& operator()(int, int); 00040 const double& operator()(int, int) const; 00041 00042 inline operator LaGenMatDouble(); 00043 00044 inline int size(int) const; // submatrix size 00045 inline int inc(int d) const; // explicit increment 00046 inline int gdim(int d) const; // global dimensions 00047 inline double* addr() const // return address of matrix. 00048 { 00049 return data_.addr(); 00050 } 00051 inline int ref_count() const // return ref_count of matrix. 00052 { 00053 return data_.ref_count(); 00054 } 00055 inline LaIndex index(int d) const // return indices of matrix. 00056 { 00057 return data_.index(d); 00058 } 00059 inline int shallow() const // return indices of matrix. 00060 { 00061 return data_.shallow(); 00062 } 00063 inline int debug() const // return debug flag. 00064 { 00065 return debug_; 00066 } 00067 inline int debug(int d) // set debug flag. 00068 { 00069 return debug_ = d; 00070 } 00071 00072 inline LaUnitUpperTriangMatDouble& resize(const LaUnitUpperTriangMatDouble&); 00073 00074 inline const LaUnitUpperTriangMatDouble& info() const 00075 { 00076 int *t = info_; 00077 *t = 1; 00078 return *this; 00079 }; 00080 00081 00082 00083 friend DLLIMPORT std::ostream &operator<<(std::ostream &, const LaUnitUpperTriangMatDouble &); 00084 00085 // destructor 00086 00087 inline ~LaUnitUpperTriangMatDouble(); 00088 }; 00089 00090 DLLIMPORT std::ostream &operator<<(std::ostream &s, const LaUnitUpperTriangMatDouble &ob); 00091 00092 // constructor functions 00093 00094 inline LaUnitUpperTriangMatDouble::LaUnitUpperTriangMatDouble() : data_() 00095 { 00096 *info_ = 0; 00097 } 00098 00099 inline LaUnitUpperTriangMatDouble::LaUnitUpperTriangMatDouble(int i, int j): 00100 data_(i, j) 00101 { 00102 *info_ = 0; 00103 } 00104 00105 inline LaUnitUpperTriangMatDouble::LaUnitUpperTriangMatDouble(double *d, int i, int j): data_(d, i, j) 00106 { 00107 *info_ = 0; 00108 } 00109 00110 inline LaUnitUpperTriangMatDouble::LaUnitUpperTriangMatDouble(const LaUnitUpperTriangMatDouble &A) 00111 { 00112 00113 data_.copy(A.data_); 00114 } 00115 00116 00117 // operator functions 00118 00119 inline LaUnitUpperTriangMatDouble& LaUnitUpperTriangMatDouble::ref(LaUnitUpperTriangMatDouble &ob) 00120 { 00121 00122 data_.ref(ob.data_); 00123 00124 return *this; 00125 } 00126 00127 inline LaUnitUpperTriangMatDouble& LaUnitUpperTriangMatDouble::ref(LaGenMatDouble &ob) 00128 { 00129 00130 data_.ref(ob); 00131 00132 return *this; 00133 } 00134 00135 inline LaUnitUpperTriangMatDouble& LaUnitUpperTriangMatDouble::resize(const LaUnitUpperTriangMatDouble &ob) 00136 { 00137 00138 data_.resize(ob.data_); 00139 00140 return *this; 00141 } 00142 00143 00144 00145 inline LaUnitUpperTriangMatDouble& LaUnitUpperTriangMatDouble::operator=(const LaUnitUpperTriangMatDouble &U) 00146 { 00147 00148 data_ = U.data_; 00149 00150 return *this; 00151 } 00152 00153 00154 00155 // destructor function 00156 00157 inline LaUnitUpperTriangMatDouble::~LaUnitUpperTriangMatDouble() 00158 { 00159 } 00160 00161 inline int LaUnitUpperTriangMatDouble::size(int d) const 00162 { 00163 return(data_.size(d)); 00164 } 00165 00166 inline int LaUnitUpperTriangMatDouble::inc(int d) const 00167 { 00168 return(data_.inc(d)); 00169 } 00170 00171 inline int LaUnitUpperTriangMatDouble::gdim(int d) const 00172 { 00173 return(data_.gdim(d)); 00174 } 00175 00176 00177 // type conversions between LaGenMat and LaUnitUpTriMat 00178 00179 inline LaUnitUpperTriangMatDouble::operator LaGenMatDouble() 00180 { 00181 LaGenMatDouble G; 00182 00183 G.ref((*this).data_); 00184 00185 return G; 00186 } 00187 00188 #endif 00189 // _LA_UNIT_UPPER_TRIANG_MAT_DOUBLE_H_