syfd.h

Go to the documentation of this file.
00001 //      LAPACK++ (V. 1.1)
00002 //      (C) 1992-1996 All Rights Reserved.
00003 
00004 
00005 #ifndef _LA_SYMM_FACT_DOUBLE_H_
00006 #define _LA_SYMM_FACT_DOUBLE_H_
00007 
00019 #include "lafnames.h"
00020 #include LA_VECTOR_INT_H
00021 #include LA_SYMM_MAT_DOUBLE_H
00022 
00023 
00024 #include "lapack.h"
00025 
00033 class LaSymmFactDouble
00034 {
00035     LaSymmMatDouble             S_;
00036     LaVectorLongInt             pivot_;
00037     int                      info_;
00038     char                     uplo_;
00039     int                     size_;
00040     int                     gdim_;
00041 
00042 public:
00043 
00044     // constructor
00045 
00046     inline LaSymmFactDouble();
00047     inline LaSymmFactDouble(int,int);
00048     inline LaSymmFactDouble(const LaSymmFactDouble &);
00049     inline ~LaSymmFactDouble();
00050 
00051     // extraction functions for components
00052 
00053     inline LaSymmMatDouble& S() { return S_; }
00054     inline LaVectorLongInt& pivot() { return pivot_; }
00055     inline int info() { return info_; }
00056     inline char uplo(){ return uplo_; }
00057     inline int size() { return size_; }
00058     inline int gdim() { return gdim_; }
00059 
00060     // operators
00061 
00062     inline LaSymmFactDouble ref(LaSymmFactDouble &);
00063     inline LaSymmFactDouble ref(LaSymmMatDouble &);
00064     inline LaSymmFactDouble& copy(const LaSymmFactDouble &);
00065     inline LaSymmFactDouble& copy(const LaSymmMatDouble &);
00066 
00067 };
00068 
00069 
00070 
00071     // constructor/destructor functions
00072 
00073 inline LaSymmFactDouble::LaSymmFactDouble():S_(),pivot_(),info_(0),uplo_('L')
00074 {}
00075 
00076 
00077 inline LaSymmFactDouble::LaSymmFactDouble(int n, int m):S_(n,m),pivot_(n*m),
00078                     info_(0),uplo_('L')
00079 {}
00080 
00081 
00082 inline LaSymmFactDouble::LaSymmFactDouble(const LaSymmFactDouble &F)
00083 {
00084     S_.copy(F.S_);
00085     pivot_.copy(F.pivot_);
00086     info_ = F.info_;
00087     uplo_ = F.uplo_;
00088     size_ = F.size_;
00089     gdim_ = F.gdim_;
00090 }
00091 
00092 inline LaSymmFactDouble::~LaSymmFactDouble()
00093 {}
00094 
00095     // operators
00096 
00097 
00098 inline LaSymmFactDouble LaSymmFactDouble::ref(LaSymmFactDouble& F)
00099 {
00100     S_.ref(F.S_);
00101     pivot_.ref(F.pivot_);
00102     info_ = F.info_;
00103     uplo_ = F.uplo_;
00104     size_ = F.size_;
00105     gdim_ = F.gdim_;
00106     
00107     return *this;
00108 }
00109 
00110 inline LaSymmFactDouble& LaSymmFactDouble::copy(const LaSymmFactDouble& F)
00111 {
00112     S_.copy(F.S_);
00113     pivot_.copy(F.pivot_);
00114     info_ = F.info_;
00115     uplo_ = F.uplo_;
00116     size_ = F.size_;
00117     gdim_ = F.gdim_;
00118     
00119     return *this;
00120 }
00121 
00122 inline LaSymmFactDouble LaSymmFactDouble::ref(LaSymmMatDouble &G)
00123 {
00124     S_.ref(G);
00125     info_ = 0;
00126     uplo_ = 'L';
00127     size_ = G.size(0);
00128     gdim_ = G.gdim(0);
00129 
00130     return *this;
00131 }
00132 
00133 inline LaSymmFactDouble& LaSymmFactDouble::copy(const LaSymmMatDouble &G)
00134 {
00135     S_.copy(G);
00136     info_ = 0;
00137     uplo_ = 'L';
00138     size_ = G.size(0);
00139     gdim_ = G.gdim(0);
00140 
00141     return *this;
00142 }
00143 
00144 #if 0
00145 inline void LaSymmMatFactorize(LaSymmMatDouble &A, LaSymmFactDouble &AF)
00146 {
00147     char UPLO = 'L';
00148     integer N = A.size(0), LDA = A.gdim(0), info = 0;
00149 //    integer M = DSYTRF;
00150 //    integer NB = F77NAME(get_nb)(&N,&M);
00151 
00152     integer LWORK = N*NB;
00153     double *WORK = new double[LWORK];
00154     LaVectorLongInt piv(N);
00155     AF.pivot().copy(piv); // make copies of A and pivot information
00156     AF.copy(A);
00157 
00158     F77NAME(dsytrf)(&UPLO, &N, &(AF.S()(0,0)), &LDA, &(AF.pivot()(0)), WORK,
00159                     &LWORK, &info);
00160 
00161     delete [] WORK;
00162 }
00163 #endif
00164 inline void LaLinearSolve(LaSymmFactDouble &AF, LaGenMatDouble &X,
00165                            LaGenMatDouble &B)
00166 {
00167     char uplo = 'L';
00168     integer N = AF.size(), nrhs = X.size(1), lda = AF.gdim(),
00169             ldb = B.size(0), info = 0;
00170 
00171     X.inject(B);
00172     F77NAME(dsytrs)(&uplo, &N, &nrhs, &(AF.S()(0,0)), &lda,
00173             &(AF.pivot()(0)), &X(0,0), &ldb, &info);
00174 
00175 }
00176 
00177 #endif 
00178 // _LA_SYMM_FACT_DOUBLE_H_

Generated on Sat Jul 14 11:40:36 2007 for Lapack++ by  doxygen 1.5.0