Go to the documentation of this file.00001
00002
00003
00004
00005 #include "arch.h"
00006 #ifndef _LA_UNIT_LOWER_TRIANG_MAT_DOUBLE_H_
00007 #define _LA_UNIT_LOWER_TRIANG_MAT_DOUBLE_H_
00008
00009 #include "lafnames.h"
00010 #include LA_GEN_MAT_DOUBLE_H
00011
00012
00013
00014 class DLLIMPORT LaUnitLowerTriangMatDouble
00015 {
00016 LaGenMatDouble data_;
00017 static double outofbounds_;
00018 static int debug_;
00019 static int *info_;
00020
00021
00022 public:
00023
00024
00025
00026 inline LaUnitLowerTriangMatDouble();
00027 inline LaUnitLowerTriangMatDouble(int, int);
00028 inline LaUnitLowerTriangMatDouble(double*, int, int);
00029 inline LaUnitLowerTriangMatDouble(const LaUnitLowerTriangMatDouble &);
00030
00031
00032
00033 inline LaUnitLowerTriangMatDouble& ref(LaUnitLowerTriangMatDouble &);
00034 inline LaUnitLowerTriangMatDouble& ref(LaGenMatDouble &);
00035 LaUnitLowerTriangMatDouble& copy(LaUnitLowerTriangMatDouble &);
00036 LaUnitLowerTriangMatDouble& operator=(double );
00037 inline LaUnitLowerTriangMatDouble& operator=(const LaUnitLowerTriangMatDouble &);
00038 inline double& operator()(int, int);
00039 inline const double& operator()(int, int) const;
00040
00041 inline operator LaGenMatDouble(void);
00042
00043 inline int size(int) const;
00044 inline int inc(int d) const;
00045 inline int gdim(int d) const;
00046 inline double* addr() const
00047 {
00048 return data_.addr();
00049 }
00050 inline int ref_count() const
00051 {
00052 return data_.ref_count();
00053 }
00054 inline LaIndex index(int d) const
00055 {
00056 return data_.index(d);
00057 }
00058 inline int shallow() const
00059 {
00060 return data_.shallow();
00061 }
00062 inline int debug() const
00063 {
00064 return debug_;
00065 }
00066 inline int debug(int d)
00067 {
00068 return debug_ = d;
00069 }
00070
00071 inline LaUnitLowerTriangMatDouble& resize(const LaUnitLowerTriangMatDouble&);
00072
00073 inline const LaUnitLowerTriangMatDouble& info() const
00074 {
00075 int *t = info_;
00076 *t = 1;
00077 return *this;
00078 };
00079
00080
00081
00082 friend DLLIMPORT std::ostream &operator<<(std::ostream &, const LaUnitLowerTriangMatDouble &);
00083
00084
00085
00086 inline ~LaUnitLowerTriangMatDouble();
00087 };
00088
00089 DLLIMPORT std::ostream &operator<<(std::ostream &s, const LaUnitLowerTriangMatDouble &ob);
00090
00091
00092
00093 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble() : data_()
00094 {
00095 *info_ = 0;
00096 }
00097
00098 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(int i, int j):
00099 data_(i, j)
00100 {
00101 *info_ = 0;
00102 }
00103
00104 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(double *d, int i, int j): data_(d, i, j)
00105 {
00106 *info_ = 0;
00107 }
00108
00109 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(const LaUnitLowerTriangMatDouble &A)
00110 {
00111
00112 data_.copy(A.data_);
00113 }
00114
00115
00116
00117
00118 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::ref(LaUnitLowerTriangMatDouble &ob)
00119 {
00120
00121 data_.ref(ob.data_);
00122
00123 return *this;
00124 }
00125
00126 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::ref(LaGenMatDouble &ob)
00127 {
00128
00129 data_.ref(ob);
00130
00131 return *this;
00132 }
00133
00134
00135 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::resize(const LaUnitLowerTriangMatDouble &ob)
00136 {
00137
00138 data_.resize(ob.data_);
00139
00140 return *this;
00141 }
00142
00143
00144 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::operator=(const LaUnitLowerTriangMatDouble &L)
00145 {
00146
00147 data_ = L.data_;
00148
00149 return *this;
00150 }
00151
00152
00153 inline double& LaUnitLowerTriangMatDouble::operator()(int i, int j)
00154 {
00155
00156 #ifdef UNIT_LOWER_INDEX_CHK
00157 if (j >= i)
00158 {
00159 std::cout << "Warning, index to Lower Triular matrix out of range!\n";
00160 std::cout << " i = " << i << " " << " j = " << j << std::endl;
00161 }
00162 #endif
00163
00164 if ((j == 0) && (i == 0))
00165 return data_(0, 0);
00166 else if (j >= i)
00167 return outofbounds_;
00168 else
00169 return data_(i, j);
00170 }
00171
00172
00173 inline const double& LaUnitLowerTriangMatDouble::operator()(int i, int j) const
00174 {
00175
00176 #ifdef UNIT_LOWER_INDEX_CHK
00177 if (j >= i)
00178 {
00179 std::cout << "Warning, index to Lower Triangular matrix out of range!\n";
00180 std::cout << " i = " << i << " " << " j = " << j << std::endl;
00181 }
00182 #endif
00183
00184 if ((j == 0) && (i == 0))
00185 return data_(0, 0);
00186 else if (j >= i)
00187 return outofbounds_;
00188 else
00189 return data_(i, j);
00190 }
00191
00192
00193
00194
00195 inline LaUnitLowerTriangMatDouble::~LaUnitLowerTriangMatDouble()
00196 {
00197 }
00198
00199 inline int LaUnitLowerTriangMatDouble::size(int d) const
00200 {
00201 return(data_.size(d));
00202 }
00203
00204 inline int LaUnitLowerTriangMatDouble::inc(int d) const
00205 {
00206 return(data_.inc(d));
00207 }
00208
00209 inline int LaUnitLowerTriangMatDouble::gdim(int d) const
00210 {
00211 return(data_.gdim(d));
00212 }
00213
00214
00215
00216
00217 inline LaUnitLowerTriangMatDouble::operator LaGenMatDouble()
00218 {
00219 LaGenMatDouble G;
00220
00221 G.ref((*this).data_);
00222
00223 return G;
00224 }
00225
00226 #endif
00227