LINEAR++ library: AFF to LAPACK
spdfd.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 #ifndef _LA_SPD_FACT_DOUBLE_H_
7 #define _LA_SPD_FACT_DOUBLE_H_
8 
9 #include LA_SPD_MAT_DOUBLE_H
10 
11 #include "lapack.h"
12 
14 {
15  int size_;
16  int gdim_;
17  LaSpdMatDouble S_;
18 
19  public:
20 
22  LaSpdFactDouble(int,int);
25 
27  LaSpdFactDouble& ref(LaSpdMatDouble&);
29  LaSpdFactDouble& copy(const LaSpdMatDouble&);
30 
31  LaSpdMatDouble& S() { return S_; }
32  int size() { return size_; }
33  int gdim() { return gdim_; }
34 };
35 
36 
37 inline LaSpdFactDouble::LaSpdFactDouble(): S_(), size_(0), gdim_(0)
38 {}
39 
40 inline LaSpdFactDouble::LaSpdFactDouble(int m,int n):S_(m,n),
41  size_(n), gdim_(m)
42 {}
43 
45 {
46  size_ = X.size_;
47  gdim_ = X.gdim_;
48  S_.copy(X.S_);
49 }
50 
52 {}
53 
55 {
56  size_ = X.size_;
57  gdim_ = X.gdim_;
58  S_.ref(X.S_);
59 
60  return *this;
61 }
62 
63 inline LaSpdFactDouble& LaSpdFactDouble::ref(LaSpdMatDouble &X)
64 {
65  size_ = X.size(1);
66  gdim_ = X.gdim(0);
67  S_.ref(X);
68 
69  return *this;
70 }
71 
73 {
74  size_ = X.size_;
75  gdim_ = X.gdim_;
76  S_.copy(X.S_);
77 
78  return *this;
79 }
80 
81 inline LaSpdFactDouble& LaSpdFactDouble::copy(const LaSpdMatDouble &X)
82 {
83  size_ = X.size(1);
84  gdim_ = X.gdim(0);
85  S_.copy(X);
86 
87  return *this;
88 }
89 
90 inline void LaSpdMatFactorize(LaSpdMatDouble &A, LaSpdFactDouble &AF)
91 {
92  char uplo = 'L';
93  integer N = A.size(1), lda = A.gdim(0), info = 0;
94  AF.copy(A);
95 
96  F77NAME(dpotrf)(&uplo, &N, &(AF.S()(0,0)), &lda, &info);
97 }
98 
99 
100 inline void LaLinearSolve(LaSpdFactDouble &AF, LaGenMatDouble &X,
101  LaGenMatDouble &B)
102 {
103  char uplo = 'L';
104  integer N = AF.size(), nrhs = X.size(1), lda = AF.gdim(),
105  ldb = B.size(0), info = 0;
106 
107  X.inject(B);
108  F77NAME(dpotrs)(&uplo, &N, &nrhs, &(AF.S()(0,0)), &lda, &X(0,0),
109  &ldb, &info);
110 }
111 
112 #endif
113 // _LA_SPD_FACT_DOUBLE_H_
void F77NAME() dpotrf(char *UPLO, integer *N, doublereal *SM, integer *LDSM, integer *info)
LaSpdMatDouble & S()
Definition: spdfd.h:31
long int integer
Definition: f77lapack.h:61
int gdim()
Definition: spdfd.h:33
int size()
Definition: spdfd.h:32
void F77NAME() dpotrs(char *UPLO, integer *N, integer *nrhs, doublereal *A, integer *LDA, doublereal *b, integer *ldb, integer *info)
void LaLinearSolve(LaSpdFactDouble &AF, LaGenMatDouble &X, LaGenMatDouble &B)
Definition: spdfd.h:100
LaSpdFactDouble()
Definition: spdfd.h:37
LaSpdMatDouble S_
Definition: spdfd.h:17
LaSpdFactDouble & copy(const LaSpdFactDouble &)
Definition: spdfd.h:72
LaSpdFactDouble & ref(LaSpdFactDouble &)
Definition: spdfd.h:54
void LaSpdMatFactorize(LaSpdMatDouble &A, LaSpdFactDouble &AF)
Definition: spdfd.h:90
#define F77NAME(x)
Definition: arch.h:17
~LaSpdFactDouble()
Definition: spdfd.h:51