sybmd.h

Go to the documentation of this file.
00001 //      LAPACK++ (V. 1.1)
00002 //      (C) 1992-1996 All Rights Reserved.
00003 
00004 // Dominik Wagenfuehr <dominik.wagenfuehr@arcor.de>
00005 // Copyright (C) 2006
00006 
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; either version 2, or (at
00010 // your option) any later version.
00011 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU Lesser General Public License for more details.
00016 
00017 // You should have received a copy of the GNU Lesser General Public License along
00018 // with this library; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00020 // USA.
00021 
00026 #ifndef _LA_SYMM_BAND_MAT_DOUBLE_H_
00027 #define _LA_SYMM_BAND_MAT_DOUBLE_H_
00028 
00029 #include "arch.h"
00030 #include "lafnames.h"
00031 #include LA_GEN_MAT_DOUBLE_H
00032 
00048 class DLLIMPORT LaSymmBandMatDouble
00049 {
00050   LaGenMatDouble data_;  // internal storage.
00051 
00052   int N_;       // N_ is (NxN)
00053   int kl_;      // kl_ = # subdiags
00054   static double outofbounds_; // out of range value returned.
00055   static int debug_;         // print debug info.
00056   static int *info_;         // print matrix info only, not values
00057                              //   originally 0, set to 1, and then
00058                              //   reset to 0 after use.
00059 
00060 
00061 public:
00062 
00065   /*::::::::::::::::::::::::::*/
00066   /* Constructors/Destructors */
00067   /*::::::::::::::::::::::::::*/
00068 
00072   LaSymmBandMatDouble();
00073 
00079   LaSymmBandMatDouble(int n, int p);
00080 
00084   LaSymmBandMatDouble(const LaSymmBandMatDouble& A);
00085 
00089   ~LaSymmBandMatDouble();
00090 
00094   LaSymmBandMatDouble& resize(int n, int p);
00095 
00099   LaSymmBandMatDouble& resize(const LaSymmBandMatDouble& ob);
00101 
00104 
00108   LaSymmBandMatDouble& operator=(double scalar);
00109 
00113   LaSymmBandMatDouble& operator=(const LaSymmBandMatDouble& ob);
00114 
00122   double& operator()(int i, int j);
00123 
00131   double& operator()(int i, int j) const;
00132 
00138   inline LaSymmBandMatDouble& ref(LaSymmBandMatDouble &ob);
00139 
00144   LaSymmBandMatDouble& copy(const LaSymmBandMatDouble &ob);
00146 
00149 
00159   inline int size(int d) const;         // submatrix size
00160 
00168   inline int inc(int d) const;          // explicit increment
00169 
00176   inline int gdim(int d) const;         // global dimensions
00177 
00182   inline double* addr() const 
00183   {     
00184         return data_.addr();
00185   }
00186   
00192   inline int ref_count() const  
00193   { 
00194         return data_.ref_count();
00195   }
00196   
00203   inline LaIndex index(int d) const
00204   { 
00205         return data_.index(d);
00206   }
00207   
00215   inline int subdiags()
00216   { 
00217         return (kl_);
00218   }
00219 
00227   inline int subdiags() const
00228   {
00229         return (kl_);
00230   }
00232 
00235 
00237   inline int shallow() const
00238   {
00239         return data_.shallow();
00240   }
00241   
00243   inline int debug() const
00244   {
00245         return debug_;
00246   }
00247   
00249   inline int debug(int d)
00250   {
00251         return debug_ = d;
00252   }
00253 
00254   inline const LaSymmBandMatDouble& info() const
00255   {
00256         int *t = info_;
00257         *t = 1;
00258         return *this;
00259   };
00260 
00264   inline void print_data() const
00265   {
00266         std::cout << data_;
00267   }
00269 
00277   friend std::ostream& operator<<(std::ostream &s, const LaSymmBandMatDouble &ob);
00278 
00279 };
00280 
00281   // member functions and operators
00282 
00283 inline LaSymmBandMatDouble& LaSymmBandMatDouble::ref(LaSymmBandMatDouble &ob)
00284 {
00285   data_.ref(ob.data_);
00286   N_ = ob.N_;
00287   kl_ = ob.kl_;
00288 
00289   return *this;
00290 }
00291 
00292 inline int LaSymmBandMatDouble::size(int d) const
00293 {
00294    return(data_.size(1));
00295 }
00296 
00297 inline int LaSymmBandMatDouble::inc(int d) const
00298 {
00299    return(data_.inc(d));
00300 }
00301 
00302 inline int LaSymmBandMatDouble::gdim(int d) const
00303 {
00304    return(data_.gdim(d));
00305 }
00306 
00307 inline double& LaSymmBandMatDouble::operator()(int i, int j)
00308 {
00309 #ifdef LA_BOUNDS_CHECK
00310    assert(i >= 0);
00311    assert(i < N_);
00312    assert(j >= 0);
00313    assert(j < N_);
00314 #endif
00315 
00316    if (i >= j)
00317    {
00318       if (i-j <= kl_)
00319          return data_(kl_ + i - j, j);
00320       else
00321       {
00322 #ifdef LA_BOUNDS_CHECK
00323          assert(0);
00324 #else
00325          return outofbounds_;
00326 #endif
00327       }
00328    }
00329    else // if (j>i)
00330    {
00331       if (j-i <= kl_)
00332          return data_(kl_ + j - i,i);
00333       else
00334       {
00335 #ifdef LA_BOUNDS_CHECK
00336          assert(0);
00337 #else
00338          return outofbounds_;
00339 #endif
00340       }
00341    }
00342 }
00343 
00344 inline double& LaSymmBandMatDouble::operator()(int i, int j) const
00345 {
00346 #ifdef LA_BOUNDS_CHECK
00347    assert(i >= 0);
00348    assert(i < N_);
00349    assert(j >= 0);
00350    assert(j < N_);
00351 #endif
00352 
00353    if (i >= j)
00354    {
00355       if (i-j <= kl_)
00356          return data_(kl_ + i - j, j);
00357       else
00358       {
00359 #ifdef LA_BOUNDS_CHECK
00360          assert(0);
00361 #else
00362          return outofbounds_;
00363 #endif
00364       }
00365    }
00366    else // if (j>i)
00367    {
00368       if (j-i <= kl_)
00369          return data_(kl_ + j - i,i);
00370       else
00371       {
00372 #ifdef LA_BOUNDS_CHECK
00373          assert(0);
00374 #else
00375          return outofbounds_;
00376 #endif
00377       }
00378    }
00379 }
00380 
00381 #endif 
00382 // _LA_SYMM_BAND_MAT_DOUBLE_H_
00383 

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