spdfd.h

Go to the documentation of this file.
00001 //      LAPACK++ (V. 1.1)
00002 //      (C) 1992-1996 All Rights Reserved.
00003 
00004 #ifndef _LA_SPD_FACT_DOUBLE_H_
00005 #define _LA_SPD_FACT_DOUBLE_H_
00006 
00007 #include LA_SPD_MAT_DOUBLE_H
00008 
00009 #include "lapack.h"
00010 
00011 class LaSpdFactDouble
00012 {
00013     int size_;
00014     int gdim_;
00015     LaSpdMatDouble S_;
00016 
00017     public:
00018 
00019     LaSpdFactDouble();
00020     LaSpdFactDouble(int,int);
00021     LaSpdFactDouble(const LaSpdFactDouble&);
00022     ~LaSpdFactDouble();
00023 
00024     LaSpdFactDouble& ref(LaSpdFactDouble&);
00025     LaSpdFactDouble& ref(LaSpdMatDouble&);
00026     LaSpdFactDouble& copy(const LaSpdFactDouble&);
00027     LaSpdFactDouble& copy(const LaSpdMatDouble&);
00028 
00029     LaSpdMatDouble& S() { return S_; }
00030     int size() { return size_; }
00031     int gdim() { return gdim_; }
00032 };
00033 
00034 
00035 inline LaSpdFactDouble::LaSpdFactDouble(): S_(), size_(0), gdim_(0)
00036 {}
00037 
00038 inline LaSpdFactDouble::LaSpdFactDouble(int m,int n):S_(m,n), 
00039                 size_(n), gdim_(m)
00040 {}
00041 
00042 inline LaSpdFactDouble::LaSpdFactDouble(const LaSpdFactDouble &X)
00043 {
00044     size_ = X.size_;
00045     gdim_ = X.gdim_;
00046     S_.copy(X.S_);
00047 }
00048 
00049 inline LaSpdFactDouble::~LaSpdFactDouble()
00050 {}
00051 
00052 inline LaSpdFactDouble& LaSpdFactDouble::ref(LaSpdFactDouble &X)
00053 {
00054     size_ = X.size_;
00055     gdim_ = X.gdim_;
00056     S_.ref(X.S_);
00057 
00058     return *this;
00059 }
00060 
00061 inline LaSpdFactDouble& LaSpdFactDouble::ref(LaSpdMatDouble &X)
00062 {
00063     size_ = X.size(1);
00064     gdim_ = X.gdim(0);
00065     S_.ref(X);
00066 
00067     return *this;
00068 }
00069     
00070 inline LaSpdFactDouble& LaSpdFactDouble::copy(const LaSpdFactDouble &X)
00071 {
00072     size_ = X.size_;
00073     gdim_ = X.gdim_;
00074     S_.copy(X.S_);
00075 
00076     return *this;
00077 }
00078 
00079 inline LaSpdFactDouble& LaSpdFactDouble::copy(const LaSpdMatDouble &X)
00080 {
00081     size_ = X.size(1);
00082     gdim_ = X.gdim(0);
00083     S_.copy(X);
00084 
00085     return *this;
00086 }
00087 
00088 inline void LaSpdMatFactorize(LaSpdMatDouble &A, LaSpdFactDouble &AF)
00089 {
00090     char uplo = 'L';
00091     integer N = A.size(1), lda = A.gdim(0), info = 0;
00092     AF.copy(A);
00093 
00094     F77NAME(dpotrf)(&uplo, &N, &(AF.S()(0,0)), &lda, &info);
00095 }
00096 
00097 
00098 inline void LaLinearSolve(LaSpdFactDouble &AF, LaGenMatDouble &X,
00099                             LaGenMatDouble &B)
00100 {
00101     char uplo = 'L';
00102     integer N = AF.size(), nrhs = X.size(1), lda = AF.gdim(), 
00103             ldb = B.size(0), info = 0;
00104 
00105     X.inject(B);
00106     F77NAME(dpotrs)(&uplo, &N, &nrhs, &(AF.S()(0,0)), &lda, &X(0,0),
00107                     &ldb, &info);
00108 }
00109 
00110 #endif 
00111 // _LA_SPD_FACT_DOUBLE_H_

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