00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GENLIB2_LAPACK_INCLUDED
00022 #define GENLIB2_LAPACK_INCLUDED
00023
00024 #include "vector.h"
00025 #include "matrix.h"
00026
00027
00028 #ifdef GENLIB2_HAVE_INTEL_MKL
00029
00030 #define F77_DPOTRF DPOTRF
00031 #define F77_DPOTRS DPOTRS
00032 #define F77_DPOTRI DPOTRI
00033 #define F77_DPOSV DPOSV
00034 #else
00035
00036 #define F77_DPOTRF dpotrf_
00037 #define F77_DPOTRS dpotrs_
00038 #define F77_DPOTRI dpotri_
00039 #define F77_DPOSV dposv_
00040 #endif
00041
00042
00043 extern "C"
00044 {
00045
00046 void F77_DPOTRF(char&, int&, double&, int&, int&);
00047
00048
00049 void F77_DPOTRI(char&, int&, double&, int&, int&);
00050
00051
00052 void F77_DPOTRS(char&, int&, int&, double&, int&, double&, int&, int&);
00053
00054
00055 void F77_DPOSV(char&, int&, int&, double&, int&, double&, int&, int&);
00056 }
00057
00058
00059 namespace GenLib2
00060 {
00061
00066 int lapack_dpotrf(Matrix<double>& A)
00067 {
00068 char uplo = 'l';
00069 int n = A.rows();
00070 int lda = A.rows();
00071 int info = 0;
00072
00073 F77_DPOTRF(uplo, n, A(0,0), lda, info);
00074
00075 return info;
00076 }
00077
00078
00083 int lapack_dpotri(Matrix<double>& A)
00084 {
00085 char uplo = 'l';
00086 int n = A.rows();
00087 int lda = A.rows();
00088 int info = 0;
00089
00090 F77_DPOTRI(uplo, n, A(0,0), lda, info);
00091
00092 return info;
00093 }
00094
00095
00100 int lapack_dpotrs(Matrix<double>& A, Vector<double>& b)
00101 {
00102 char uplo = 'l';
00103 int n = A.rows();
00104 int nrhs = 1;
00105 int lda = A.rows();
00106 int ldb = b.size();
00107 int info = 0;
00108
00109 F77_DPOTRS(uplo, n, nrhs, A(0,0), lda, b(0), ldb, info);
00110
00111 return info;
00112 }
00113
00114
00118 int lapack_dposv(Matrix<double>& A, Vector<double>& b)
00119 {
00120 char uplo = 'l';
00121 int n = A.rows();
00122 int nrhs = 1;
00123 int lda = A.rows();
00124 int ldb = b.size();
00125 int info = 0;
00126
00127 F77_DPOSV(uplo, n, nrhs, A(0,0), lda, b(0), ldb, info);
00128
00129 return info;
00130 }
00131
00132 }
00133
00134 #endif