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 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 return data_.addr();}
00048 inline int ref_count() const {
00049 return data_.ref_count();}
00050 inline LaIndex index(int d) const {
00051 return data_.index(d);}
00052 inline int shallow() const {
00053 return data_.shallow();}
00054 inline int debug() const {
00055 return debug_;}
00056 inline int debug(int d) {
00057 return debug_ = d;}
00058
00059 inline LaUnitLowerTriangMatDouble& resize(const LaUnitLowerTriangMatDouble&);
00060
00061 inline const LaUnitLowerTriangMatDouble& info() const {
00062 int *t = info_;
00063 *t = 1;
00064 return *this;};
00065
00066
00067
00068 friend DLLIMPORT std::ostream &operator<<(std::ostream &, const LaUnitLowerTriangMatDouble &);
00069
00070
00071
00072 inline ~LaUnitLowerTriangMatDouble();
00073 };
00074
00075 DLLIMPORT std::ostream &operator<<(std::ostream &s, const LaUnitLowerTriangMatDouble &ob);
00076
00077
00078
00079 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble() : data_()
00080 {
00081 *info_ = 0;
00082 }
00083
00084 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(int i,int j):
00085 data_(i,j)
00086 {
00087 *info_ = 0;
00088 }
00089
00090 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(double *d,int i,int j):data_(d,i,j)
00091 {
00092 *info_ = 0;
00093 }
00094
00095 inline LaUnitLowerTriangMatDouble::LaUnitLowerTriangMatDouble(const LaUnitLowerTriangMatDouble &A)
00096 {
00097
00098 data_.copy(A.data_);
00099 }
00100
00101
00102
00103
00104 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::ref(LaUnitLowerTriangMatDouble &ob)
00105 {
00106
00107 data_.ref(ob.data_);
00108
00109 return *this;
00110 }
00111
00112 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::ref(LaGenMatDouble &ob)
00113 {
00114
00115 data_.ref(ob);
00116
00117 return *this;
00118 }
00119
00120
00121 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::resize(const LaUnitLowerTriangMatDouble &ob)
00122 {
00123
00124 data_.resize(ob.data_);
00125
00126 return *this;
00127 }
00128
00129
00130 inline LaUnitLowerTriangMatDouble& LaUnitLowerTriangMatDouble::operator=(const LaUnitLowerTriangMatDouble &L)
00131 {
00132
00133 data_ = L.data_;
00134
00135 return *this;
00136 }
00137
00138
00139 inline double& LaUnitLowerTriangMatDouble::operator()(int i, int j)
00140 {
00141
00142 #ifdef UNIT_LOWER_INDEX_CHK
00143 if (j>=i)
00144 {
00145 std::cout << "Warning, index to Lower Triular matrix out of range!\n";
00146 std::cout << " i = " << i << " " <<" j = " << j << std::endl;
00147 }
00148 #endif
00149
00150 if ((j==0)&&(i==0))
00151 return data_(0,0);
00152 else if (j>=i)
00153 return outofbounds_;
00154 else
00155 return data_(i,j);
00156 }
00157
00158
00159 inline double& LaUnitLowerTriangMatDouble::operator()(int i, int j) const
00160 {
00161
00162 #ifdef UNIT_LOWER_INDEX_CHK
00163 if (j>=i)
00164 {
00165 std::cout << "Warning, index to Lower Triangular matrix out of range!\n";
00166 std::cout << " i = " << i << " " <<" j = " << j << std::endl;
00167 }
00168 #endif
00169
00170 if ((j==0)&&(i==0))
00171 return data_(0,0);
00172 else if (j>=i)
00173 return outofbounds_;
00174 else
00175 return data_(i,j);
00176 }
00177
00178
00179
00180
00181 inline LaUnitLowerTriangMatDouble::~LaUnitLowerTriangMatDouble()
00182 {
00183 }
00184
00185 inline int LaUnitLowerTriangMatDouble::size(int d) const
00186 {
00187 return(data_.size(d));
00188 }
00189
00190 inline int LaUnitLowerTriangMatDouble::inc(int d) const
00191 {
00192 return(data_.inc(d));
00193 }
00194
00195 inline int LaUnitLowerTriangMatDouble::gdim(int d) const
00196 {
00197 return(data_.gdim(d));
00198 }
00199
00200
00201
00202
00203 inline LaUnitLowerTriangMatDouble::operator LaGenMatDouble()
00204 {
00205 LaGenMatDouble G;
00206
00207 G.ref((*this).data_);
00208
00209 return G;
00210 }
00211
00212 #endif
00213