trmd.h

Go to the documentation of this file.
00001 // -*-C++-*- 
00002 //      LAPACK++ (V. 1.1)
00003 //      (C) 1992-1996 All Rights Reserved.
00004 
00005 
00006 #include "arch.h"
00007 #ifndef _LA_TRIDIAG_MAT_DOUBLE_
00008 #define _LA_TRIDIAG_MAT_DOUBLE_
00009 
00010 #include "lafnames.h"
00011 #include LA_VECTOR_DOUBLE_H
00012 
00042 class DLLIMPORT LaTridiagMatDouble
00043 {   
00044       LaVectorDouble du2_;    /* second upper diag, N-2 */
00045       LaVectorDouble du_;     /* upper diag, N-1 */
00046       LaVectorDouble d_;      /* main diag, N */
00047       LaVectorDouble dl_;     /* lower diag, N-1 */
00048       int size_;
00049 
00050       static double outofbounds_; /* return this address, when addresing out
00051                                      of bounds */
00052       static int debug_;        // print debug info.
00053       static int *info_;        // print matrix info only, not values
00054       //   originally 0, set to 1, and then
00055       //   reset to 0 after use.
00056 
00057    public:
00058 
00062       LaTridiagMatDouble();
00065       LaTridiagMatDouble(int N);
00068       LaTridiagMatDouble(const LaTridiagMatDouble &);
00073       LaTridiagMatDouble(const LaVectorDouble& diag,
00074                          const LaVectorDouble& diaglower,
00075                          const LaVectorDouble& diagupper);
00076 
00079       ~LaTridiagMatDouble();
00081 
00086       int size() const { return size_;}
00088 
00114       inline double &operator()(int i, int j);
00115 
00139       inline double operator()(int i, int j) const;
00140 
00168       LaVectorDouble& diag(int diag_selection);
00169 
00192       const LaVectorDouble& diag(int diag_selection) const;
00194 
00195 
00202       LaTridiagMatDouble& copy(const LaTridiagMatDouble& s); 
00203 
00212       LaTridiagMatDouble& inject(const LaTridiagMatDouble& s);
00213 
00221       inline LaTridiagMatDouble& ref(LaTridiagMatDouble&); 
00223 
00237       const LaTridiagMatDouble& info() const {
00238          int *t = info_; *t = 1; return *this;}
00240       int debug() const { return debug_;}
00242 
00253       friend DLLIMPORT std::ostream& operator<<(std::ostream&,const LaTridiagMatDouble&);
00254 
00255 
00256 };
00257 
00258 DLLIMPORT std::ostream& operator<<(std::ostream& s, const LaTridiagMatDouble& td);
00259 
00260 
00261     // operators and member functions
00262 
00263 inline double& LaTridiagMatDouble::operator()(int i,int j)
00264 {
00265    switch (i-j)
00266    {
00267       case 0:   // main
00268 #ifdef LA_BOUNDS_CHECK
00269          if (i>d_.size()-1)
00270             return outofbounds_;
00271          else
00272 #endif
00273             return d_(i);
00274       case 1:  // lower
00275 #ifdef LA_BOUNDS_CHECK
00276          if (i>dl_.size()-1)
00277             return outofbounds_;
00278          else
00279 #endif
00280             // Before lapackpp-2.4.12 this was dl_(i) but that was WRONG!
00281             return dl_(j);
00282       case -1:   // upper
00283 #ifdef LA_BOUNDS_CHECK
00284          if (i>du_.size()-1)
00285             return outofbounds_;
00286          else
00287 #endif
00288             return du_(i);
00289       default:
00290          return outofbounds_;
00291    }
00292 }
00293 
00294 
00295 inline double LaTridiagMatDouble::operator()(int i,int j) const
00296 {
00297    switch (i-j)
00298    {
00299       case 0:   // main
00300 #ifdef LA_BOUNDS_CHECK
00301          if (i>d_.size()-1)
00302             return outofbounds_;
00303          else
00304 #endif
00305             return d_(i);
00306       case 1:  // lower
00307 #ifdef LA_BOUNDS_CHECK
00308          if (i>dl_.size()-1)
00309             return outofbounds_;
00310          else
00311 #endif
00312             // Before lapackpp-2.4.12 this was dl_(i) but that was WRONG!
00313             return dl_(j);
00314       case -1:   // upper
00315 #ifdef LA_BOUNDS_CHECK
00316          if (i>du_.size()-1)
00317             return outofbounds_;
00318          else
00319 #endif
00320             return du_(i);
00321       default:
00322          return outofbounds_;
00323    }
00324 }
00325 
00326 inline LaTridiagMatDouble& LaTridiagMatDouble::ref(LaTridiagMatDouble&T) 
00327 {
00328     du2_.ref(T.du2_);
00329     du_.ref(T.du_);
00330     d_.ref(T.d_);
00331     dl_.ref(T.dl_); 
00332     size_ = T.size_;
00333 
00334     return *this;
00335 }
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 #endif 
00344 // _LA_TRIDIAG_MAT_DOUBLE_

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