ltgmd.h

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

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