00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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_;
00051
00052 int N_;
00053 int kl_;
00054 static double outofbounds_;
00055 static int debug_;
00056 static int *info_;
00057
00058
00059
00060
00061 public:
00062
00065
00066
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;
00160
00168 inline int inc(int d) const;
00169
00176 inline int gdim(int d) const;
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
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
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
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
00383