LINEAR++ library: AFF to LAPACK
gfd.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_GEN_FACT_DOUBLE_H
8 #define _LA_GEN_FACT_DOUBLE_H
9 
10 #include "lafnames.h"
11 #include LA_VECTOR_LONG_INT_H
12 #include LA_UNIT_LOWER_TRIANG_MAT_DOUBLE_H
13 #include LA_UPPER_TRIANG_MAT_DOUBLE_H
14 
15 #include "lapack.h"
16 
18 {
19  LaUnitLowerTriangMatDouble L_;
20  LaUpperTriangMatDouble U_;
21  LaVectorLongInt pivot_;
22  int info_;
24 
25 public:
26 
27  // constructor
28 
29  inline LaGenFactDouble();
30  inline LaGenFactDouble(int,int);
32  inline ~LaGenFactDouble();
33 
34  // extraction functions for components
35 
36  inline LaUnitLowerTriangMatDouble& L();
37  inline LaUpperTriangMatDouble& U();
38  inline LaVectorLongInt& pivot();
39  inline int& info();
40  inline int& transpose();
41 
42  // operators
43 
45  inline LaGenFactDouble& ref(LaGenMatDouble &);
46 
47 };
48 
49 
50 
51  // constructor/destructor functions
52 
53 inline LaGenFactDouble::LaGenFactDouble():L_(),U_(),pivot_()
54 {
55 
56  info_ = 0;
57  transpose_ = 0;
58 }
59 
60 
61 inline LaGenFactDouble::LaGenFactDouble(int n, int m):L_(n,m),U_(n,m),pivot_(n*m)
62 {
63 
64  info_ = 0;
65  transpose_ = 0;
66 }
67 
68 
70 {
71 
72  L_.ref(F.L_);
73  U_.ref(F.U_);
74  pivot_.ref(F.pivot_);
75  info_ = F.info_;
77 }
78 
80 {
81 }
82 
83  // member functions
84 
85 inline LaUnitLowerTriangMatDouble& LaGenFactDouble::L()
86 {
87 
88  return L_;
89 }
90 
91 inline LaUpperTriangMatDouble& LaGenFactDouble::U()
92 {
93 
94  return U_;
95 }
96 
97 inline LaVectorLongInt& LaGenFactDouble::pivot()
98 {
99 
100  return pivot_;
101 }
102 
104 {
105 
106  return info_;
107 }
108 
110 {
111 
112  return transpose_;
113 }
114 
115 
116  // operators
117 
118 
120 {
121 
122  L_.ref(F.L_);
123  U_.ref(F.U_);
124  pivot_.ref(F.pivot_);
125  info_ = F.info_;
127 
128  return *this;
129 }
130 
131 inline LaGenFactDouble& LaGenFactDouble::ref(LaGenMatDouble &G)
132 {
133 
134  L_.ref(G);
135  U_.ref(G);
136  info_ = 0;
137  transpose_ = 0;
138 
139  return *this;
140 }
141 
142 #if 0
143 inline void LaLinearSolve(LaGenFactDouble &AF, LaGenMatDouble& X,
144  LaGenMatDouble& B )
145 {
146  char trans = 'N';
147  integer n = AF.L().size(1), lda = AF.L().gdim(0), nrhs = X.size(1),
148  ldb = B.size(0), info = 0;
149 
150  X.inject(B);
151  F77NAME(dgetrs)(&trans, &n, &nrhs, &(AF.U()(0,0)), &lda, &(AF.pivot()(0)),
152  &X(0,0), &ldb, &info);
153 }
154 
155 inline void LaGenMatFactorize(LaGenMatDouble &GM, LaGenFactDouble &GF)
156 {
157  integer m = GM.size(0), n = GM.size(1), lda = GM.gdim(0);
158  integer info=0;
159 
160  F77NAME(dgetrf)(&m, &n, &GM(0,0), &lda, &(GF.pivot()(0)), &info);
161 }
162 
163 inline void LaGenMatFactorizeUnblocked(LaGenMatDouble &A, LaGenFactDouble &F)
164 {
165  integer m = A.size(0), n=A.size(1), lda = A.gdim(0);
166  integer info=0;
167 
168  F77NAME(dgetf2)(&m, &n, &A(0,0), &lda, &(F.pivot()(0)), &info);
169 }
170 #endif
171 
172 void LaLUFactorDouble(LaGenMatDouble &A, LaGenFactDouble &F, integer nb);
173 void LaLUFactorDouble(LaGenMatDouble &A, LaGenFactDouble &F);
174 
175 #endif
LaUnitLowerTriangMatDouble & L()
Definition: gfd.h:85
LaVectorLongInt & pivot()
Definition: gfd.h:97
int & transpose()
Definition: gfd.h:109
LaVectorLongInt pivot_
Definition: gfd.h:21
LaGenFactDouble & ref(LaGenFactDouble &)
Definition: gfd.h:119
long int integer
Definition: f77lapack.h:61
int info_
Definition: gfd.h:22
void LaLUFactorDouble(LaGenMatDouble &A, LaGenFactDouble &F, integer nb)
void LaGenMatFactorize(LaGenMatDouble &GM, LaGenFactDouble &GF)
Definition: fmd.h:26
int transpose_
Definition: gfd.h:23
void F77NAME() dgetrs(char *trans, integer *N, integer *nrhs, doublereal *A, integer *lda, integer *ipiv, doublereal *b, integer *ldb, integer *info)
void LaLinearSolve(LaBandFactDouble &AF, LaGenMatDouble &X, LaGenMatDouble &B)
Definition: bfd.h:148
int & info()
Definition: gfd.h:103
~LaGenFactDouble()
Definition: gfd.h:79
LaGenFactDouble()
Definition: gfd.h:53
LaUpperTriangMatDouble U_
Definition: gfd.h:20
void F77NAME() dgetrf(integer *m, integer *n, doublereal *A, integer *lda, integer *ipiv, integer *info)
void F77NAME() dgetf2(integer *m, integer *n, doublereal *A, integer *lda, integer *ipiv, integer *info)
LaUnitLowerTriangMatDouble L_
Definition: gfd.h:19
#define F77NAME(x)
Definition: arch.h:17
LaUpperTriangMatDouble & U()
Definition: gfd.h:91