Lapack++
spdbmd.h
Go to the documentation of this file.
00001 //      LAPACK++ (V. 1.1)
00002 //      (C) 1992-1996 All Rights Reserved.
00003 
00004 #ifndef _LA_SPD_BAND_MAT_DOUBLE_H_
00005 #define _LA_SPD_BAND_MAT_DOUBLE_H_
00006 
00007 #include "arch.h"
00008 #include LA_GEN_MAT_DOUBLE_H
00009 #include LA_VECTOR_DOUBLE_H
00010 
00011 
00012 class DLLIMPORT LaSpdBandMatDouble
00013 {
00014     LaGenMatDouble data_;  // internal storage.
00015 
00016     int N_;       // N_ is (NxN)
00017     int kl_;      // kl_ = # subdiags
00018     static double outofbounds_; // out of range value returned.
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 
00024 
00025 public:
00026 
00027     // constructors
00028 
00029     inline LaSpdBandMatDouble();
00030     inline LaSpdBandMatDouble(int, int);
00031     inline LaSpdBandMatDouble(const LaSpdBandMatDouble &);
00032 
00033     // operators
00034 
00035     inline LaSpdBandMatDouble& operator=(double);
00036     inline LaSpdBandMatDouble& operator=(const LaSpdBandMatDouble&);
00037     double& operator()(int, int);
00038     const double& operator()(int, int) const;
00039     friend std::ostream& operator<<(std::ostream &, const LaSpdBandMatDouble &);
00040 
00041 
00042     // member functions
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 
00048     inline LaSpdBandMatDouble& ref(LaSpdBandMatDouble &);
00049     inline LaSpdBandMatDouble& copy(const LaSpdBandMatDouble &);
00050     inline double* addr() const          // return address of matrix.
00051     {
00052         return data_.addr();
00053     }
00054     inline int ref_count() const          // return ref_count of matrix.
00055     {
00056         return data_.ref_count();
00057     }
00058     inline LaIndex index(int d) const       // return indices of matrix.
00059     {
00060         return data_.index(d);
00061     }
00062     inline int subdiags()       // return # of subdiags of matrix.
00063     {
00064         return (kl_);
00065     }
00066     inline int shallow() const        // return shallow flag.
00067     {
00068         return data_.shallow();
00069     }
00070     inline int debug() const      // return debug flag.
00071     {
00072         return debug_;
00073     }
00074     inline int debug(int d)   // set debug flag for lagenmat.
00075     {
00076         return debug_ = d;
00077     }
00078 
00079     inline LaSpdBandMatDouble& resize(const LaSpdBandMatDouble&);
00080 
00081     inline const LaSpdBandMatDouble& info() const
00082     {
00083         int *t = info_;
00084         *t = 1;
00085         return *this;
00086     };
00087 
00088     inline LaSpdBandMatDouble print_data() const
00089     {
00090         std::cout << data_;
00091         return *this;
00092     }
00093 
00094     // destructor
00095 
00096     inline ~LaSpdBandMatDouble();
00097 };
00098 
00099 // constructors
00100 
00101 inline LaSpdBandMatDouble::LaSpdBandMatDouble()
00102     : data_()
00103 {
00104 
00105     N_ = kl_ = 0;
00106 }
00107 
00108 inline LaSpdBandMatDouble::LaSpdBandMatDouble(int n, int l)
00109     : data_(n, 2 * l + 1)
00110 {
00111 
00112     N_ = n;
00113     kl_ = l;
00114 }
00115 
00116 inline LaSpdBandMatDouble::LaSpdBandMatDouble(const LaSpdBandMatDouble &A)
00117 {
00118 
00119     data_.copy(A.data_);
00120     N_ = A.N_;
00121     kl_ = A.kl_;
00122 }
00123 
00124 // destructor
00125 
00126 inline LaSpdBandMatDouble::~LaSpdBandMatDouble()
00127 {
00128 }
00129 
00130 
00131 // member functions and operators
00132 
00133 inline LaSpdBandMatDouble& LaSpdBandMatDouble::ref(LaSpdBandMatDouble &ob)
00134 {
00135 
00136     data_.ref(ob.data_);
00137     N_ = ob.N_;
00138     kl_ = ob.kl_;
00139 
00140     return *this;
00141 }
00142 
00143 inline LaSpdBandMatDouble& LaSpdBandMatDouble::resize(const LaSpdBandMatDouble &ob)
00144 {
00145 
00146     data_.resize(ob.data_);
00147 
00148     return *this;
00149 }
00150 
00151 
00152 inline LaSpdBandMatDouble& LaSpdBandMatDouble::operator=(const LaSpdBandMatDouble &B)
00153 {
00154     data_ = B.data_;
00155     N_ = B.N_;
00156     kl_ = B.kl_;
00157 
00158     return *this;
00159 }
00160 
00161 inline int LaSpdBandMatDouble::size(int d) const
00162 {
00163     return(data_.size(d));
00164 }
00165 
00166 inline int LaSpdBandMatDouble::inc(int d) const
00167 {
00168     return(data_.inc(d));
00169 }
00170 
00171 inline int LaSpdBandMatDouble::gdim(int d) const
00172 {
00173     return(data_.gdim(d));
00174 }
00175 
00176 #endif
00177 // _LA_SPD_BAND_MAT_DOUBLE_H_
00178