ultgmd.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_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 //#define UNIT_LOWER_INDEX_CHK
00013 
00014 class DLLIMPORT LaUnitLowerTriangMatDouble
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 LaUnitLowerTriangMatDouble();
00027   inline LaUnitLowerTriangMatDouble(int,int);
00028   inline LaUnitLowerTriangMatDouble(double*,int,int);
00029   inline LaUnitLowerTriangMatDouble(const LaUnitLowerTriangMatDouble &);
00030 
00031   // operators
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;           // 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 data.
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 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   // destructor
00071 
00072   inline ~LaUnitLowerTriangMatDouble();
00073 };
00074 
00075 DLLIMPORT std::ostream &operator<<(std::ostream &s, const LaUnitLowerTriangMatDouble &ob);
00076 
00077   // constructor functions
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   // operator functions
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)) // special case, allows us to access beginning of
00151     return data_(0,0);// matrix without getting default outofbounds_.
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)) // special case, allows us to access beginning of
00171     return data_(0,0);// matrix without getting default outofbounds_.
00172   else if (j>=i)
00173     return outofbounds_;
00174   else
00175     return data_(i,j);
00176 }
00177 
00178 
00179   // destructor function
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 // type conversions between LaGenMat and LaUpTriMat
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 // _LA_UNIT_LOWER_TRIANG_MAT_DOUBLE_H_

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