LINEAR++ library: AFF to LAPACK
bfd.h
Go to the documentation of this file.
1 // LAPACK++ (V. 1.1)
2 // (C) 1992-1996 All Rights Reserved.
3 // Copyright (c) 1992 by J. J. Dongarra, E. Greaser, R. Pozo, D. Walker
4 // see file README.lapack++
5 
6 
7 #ifndef _LA_BAND_FACT_DOUBLE_H
8 #define _LA_BAND_FACT_DOUBLE_H
9 
10 #include "lafnames.h"
11 #include LA_VECTOR_LONG_INT_H
12 #include LA_BAND_MAT_DOUBLE_H
13 #include "lapack.h"
14 
15 
17 {
18  LaBandMatDouble B_;
19  LaVectorLongInt pivot_;
20  int info_;
21 
22 public:
23 
24  // constructor
25 
26  inline LaBandFactDouble();
27  inline LaBandFactDouble(int,int,int);
28  inline LaBandFactDouble(LaBandMatDouble &);
30  inline ~LaBandFactDouble();
31 
32  // extraction functions for components
33 
34  inline LaBandMatDouble& B();
35  inline LaVectorLongInt& pivot();
36  inline int& info();
37 
38  // operators
39 
41  inline LaBandFactDouble& ref(LaBandMatDouble &);
42 
43 };
44 
45 
46 
47  // constructor/destructor functions
48 
49 inline LaBandFactDouble::LaBandFactDouble():B_(),pivot_()
50 {
51 #ifdef BandFactDouble_DEBUG
52  cout << " called LaBandFactDouble::LaBandFactDouble() " << endl;
53 #endif
54 
55  info_ = 0;
56 }
57 
58 
59 inline LaBandFactDouble::LaBandFactDouble(int N, int kl, int ku)
60  : B_(N,kl,ku),pivot_(kl+ku+1)
61 {
62 #ifdef BandFactDouble_DEBUG
63  cout << " called LaBandFactDouble::LaBandFactDouble(int,int,int) " << endl;
64 #endif
65 
66  info_ = 0;
67 }
68 
69 
70 inline LaBandFactDouble::LaBandFactDouble(LaBandMatDouble &G):pivot_()
71 {
72 #ifdef BandFactDouble_DEBUG
73  cout << " called LaBandFactDouble::LaBandFactDouble(LaBandMatDouble &)"
74  <<endl;
75 #endif
76 
77  B_.ref(G);
78  info_ = 0;
79 }
80 
81 
83 {
84 #ifdef BandFactDouble_DEBUG
85  cout << " called LaBandFactDouble::LaBandFactDouble(LaBandFactDouble &) " << endl;
86 #endif
87 
88  B_.ref(F.B_);
89  pivot_.ref(F.pivot_);
90  info_ = F.info_;
91 }
92 
94 {
95 }
96 
97  // member functions
98 
99 inline LaBandMatDouble& LaBandFactDouble::B()
100 {
101 
102  return B_;
103 }
104 
105 inline LaVectorLongInt& LaBandFactDouble::pivot()
106 {
107 
108  return pivot_;
109 }
110 
112 {
113 
114  return info_;
115 }
116 
117 
118  // operators
119 
120 
122 {
123 
124  B_.ref(F.B_);
125  pivot_.ref(F.pivot_);
126  info_ = F.info_;
127 
128  return *this;
129 }
130 
131 
132 inline LaBandFactDouble& LaBandFactDouble::ref(LaBandMatDouble& F)
133 {
134  B_.ref(F);
135 
136  return *this;
137 }
138 
139 
140 inline void LaBandMatFactorize(LaBandMatDouble &A, LaBandFactDouble &AF)
141 {
142  integer n = A.size(1), m = n, LDA = A.gdim(0);
143  integer KL = A.subdiags(), KU = A.superdiags(), info=0;
144 
145  F77NAME(dgbtrf)(&m, &n, &KL, &KU, &A(0,0), &LDA, &(AF.pivot()(0)), &info);
146 }
147 
148 inline void LaLinearSolve(LaBandFactDouble &AF, LaGenMatDouble &X,
149  LaGenMatDouble &B)
150 {
151  char trans = 'N';
152  integer n = AF.B().size(1), lda = AF.B().gdim(0), nrhs = X.size(1),
153  ldb = B.size(0), kl = AF.B().subdiags(),
154  ku = AF.B().superdiags(), info=0;
155 
156  X.inject(B);
157  F77NAME(dgbtrs)(
158  &trans,
159  &n,
160  &kl, &ku, &nrhs, &(AF.B()(-kl,0)),
161  &lda, &(AF.pivot()(0)), &X(0,0), &ldb, &info);
162 }
163 
164 
165 #endif
LaVectorLongInt pivot_
Definition: bfd.h:19
long int integer
Definition: f77lapack.h:61
LaVectorLongInt & pivot()
Definition: bfd.h:105
LaBandMatDouble B_
Definition: bfd.h:18
LaBandMatDouble & B()
Definition: bfd.h:99
LaBandFactDouble()
Definition: bfd.h:49
int & info()
Definition: bfd.h:111
int info_
Definition: bfd.h:20
void LaLinearSolve(LaBandFactDouble &AF, LaGenMatDouble &X, LaGenMatDouble &B)
Definition: bfd.h:148
void F77NAME() dgbtrs(char *trans, integer *N, integer *kl, integer *ku, integer *nrhs, doublereal *AB, integer *ldab, integer *ipiv, doublereal *b, integer *ldb, integer *info)
void LaBandMatFactorize(LaBandMatDouble &A, LaBandFactDouble &AF)
Definition: bfd.h:140
~LaBandFactDouble()
Definition: bfd.h:93
#define F77NAME(x)
Definition: arch.h:17
LaBandFactDouble & ref(LaBandFactDouble &)
Definition: bfd.h:121
void F77NAME() dgbtrf(integer *m, integer *n, integer *KL, integer *KU, doublereal *BM, integer *LDBM, integer *ipiv, integer *info)