00001
00002
00003
00004
00005 #ifndef _LA_BAND_FACT_DOUBLE_H
00006 #define _LA_BAND_FACT_DOUBLE_H
00007
00019 #include "lafnames.h"
00020 #include LA_VECTOR_LONG_INT_H
00021 #include LA_BAND_MAT_DOUBLE_H
00022 #include "lapack.h"
00023
00024
00032 class LaBandFactDouble
00033 {
00034 LaBandMatDouble B_;
00035 LaVectorLongInt pivot_;
00036 int info_;
00037
00038 public:
00039
00040
00041
00042 inline LaBandFactDouble();
00043 inline LaBandFactDouble(int,int,int);
00044 inline LaBandFactDouble(LaBandMatDouble &);
00045 inline LaBandFactDouble(LaBandFactDouble &);
00046 inline ~LaBandFactDouble();
00047
00048
00049
00050 inline LaBandMatDouble& B();
00051 inline LaVectorLongInt& pivot();
00052 inline int& info();
00053
00054
00055
00056 inline LaBandFactDouble& ref(LaBandFactDouble &);
00057 inline LaBandFactDouble& ref(LaBandMatDouble &);
00058
00059 };
00060
00061
00062
00063
00064
00065 inline LaBandFactDouble::LaBandFactDouble():B_(),pivot_()
00066 {
00067 #ifdef BandFactDouble_DEBUG
00068 std::cout << " called LaBandFactDouble::LaBandFactDouble() " << std::endl;
00069 #endif
00070
00071 info_ = 0;
00072 }
00073
00074
00075 inline LaBandFactDouble::LaBandFactDouble(int N, int kl, int ku)
00076 : B_(N,kl,ku),pivot_(kl+ku+1)
00077 {
00078 #ifdef BandFactDouble_DEBUG
00079 std::cout << " called LaBandFactDouble::LaBandFactDouble(int,int,int) " << std::endl;
00080 #endif
00081
00082 info_ = 0;
00083 }
00084
00085
00086 inline LaBandFactDouble::LaBandFactDouble(LaBandMatDouble &G):pivot_()
00087 {
00088 #ifdef BandFactDouble_DEBUG
00089 std::cout << " called LaBandFactDouble::LaBandFactDouble(LaBandMatDouble &)"
00090 <<std::endl;
00091 #endif
00092
00093 B_.ref(G);
00094 info_ = 0;
00095 }
00096
00097
00098 inline LaBandFactDouble::LaBandFactDouble(LaBandFactDouble &F)
00099 {
00100 #ifdef BandFactDouble_DEBUG
00101 std::cout << " called LaBandFactDouble::LaBandFactDouble(LaBandFactDouble &) " << std::endl;
00102 #endif
00103
00104 B_.ref(F.B_);
00105 pivot_.ref(F.pivot_);
00106 info_ = F.info_;
00107 }
00108
00109 inline LaBandFactDouble::~LaBandFactDouble()
00110 {
00111 }
00112
00113
00114
00115 inline LaBandMatDouble& LaBandFactDouble::B()
00116 {
00117
00118 return B_;
00119 }
00120
00121 inline LaVectorLongInt& LaBandFactDouble::pivot()
00122 {
00123
00124 return pivot_;
00125 }
00126
00127 inline int& LaBandFactDouble::info()
00128 {
00129
00130 return info_;
00131 }
00132
00133
00134
00135
00136
00137 inline LaBandFactDouble& LaBandFactDouble::ref(LaBandFactDouble& F)
00138 {
00139
00140 B_.ref(F.B_);
00141 pivot_.ref(F.pivot_);
00142 info_ = F.info_;
00143
00144 return *this;
00145 }
00146
00147
00148 inline LaBandFactDouble& LaBandFactDouble::ref(LaBandMatDouble& F)
00149 {
00150 B_.ref(F);
00151
00152 return *this;
00153 }
00154
00178 inline void LaBandMatFactorize(LaBandMatDouble &A, LaBandFactDouble &AF)
00179 {
00180 integer n = A.size(1), m = n, LDA = A.gdim(0);
00181 integer KL = A.subdiags(), KU = A.superdiags(), info=0;
00182
00183 F77NAME(dgbtrf)(&m, &n, &KL, &KU, &A(0,0), &LDA, &(AF.pivot()(0)), &info);
00184 }
00185
00186 inline void LaLinearSolve(LaBandFactDouble &AF, LaGenMatDouble &X,
00187 LaGenMatDouble &B)
00188 {
00189 char trans = 'N';
00190 integer n = AF.B().size(1), lda = AF.B().gdim(0), nrhs = X.size(1),
00191 ldb = B.size(0), kl = AF.B().subdiags(),
00192 ku = AF.B().superdiags(), info=0;
00193
00194 X.inject(B);
00195 F77NAME(dgbtrs)(
00196 &trans,
00197 &n,
00198 &kl, &ku, &nrhs, &(AF.B()(-kl,0)),
00199 &lda, &(AF.pivot()(0)), &X(0,0), &ldb, &info);
00200 }
00201
00202
00203 #endif