utgmd.h

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

Generated on Sat Jul 14 11:40:36 2007 for Lapack++ by  doxygen 1.5.0