00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SELDON_FILE_SUPERLU_HXX
00021
00022 extern "C"
00023 {
00024 #include "superlu_interface.h"
00025 }
00026
00027 namespace Seldon
00028 {
00030 template<class T>
00031 class MatrixSuperLU_Base
00032 {
00033 protected :
00035 SuperMatrix A, L, U, B;
00036 SCformat *Lstore;
00037 NCformat *Ustore;
00038 SuperLUStat_t stat;
00039 superlu_options_t options;
00040
00041 Vector<int> perm_r, perm_c;
00042
00043 int permc_spec;
00044 int n;
00045 bool display_info;
00046
00047 public :
00048 MatrixSuperLU_Base();
00049 ~MatrixSuperLU_Base();
00050
00051 template<class Prop, class Allocator>
00052 void GetLU(Matrix<double, Prop, ColSparse, Allocator>& Lmat,
00053 Matrix<double, Prop, ColSparse, Allocator>& Umat,
00054 bool permuted = true);
00055 template<class Prop, class Allocator>
00056 void GetLU(Matrix<double, Prop, RowSparse, Allocator>& Lmat,
00057 Matrix<double, Prop, RowSparse, Allocator>& Umat,
00058 bool permuted = true);
00059 const Vector<int>& GetRowPermutation() const;
00060 const Vector<int>& GetColPermutation() const;
00061
00062 void Clear();
00063 void HideMessages();
00064 void ShowMessages();
00065
00066 };
00067
00069 template<class T>
00070 class MatrixSuperLU : public MatrixSuperLU_Base<T>
00071 {
00072 };
00073
00075 template<>
00076 class MatrixSuperLU<double> : public MatrixSuperLU_Base<double>
00077 {
00078 public:
00079 MatrixSuperLU() : MatrixSuperLU_Base<double>() {}
00080
00081 template<class Prop, class Storage, class Allocator>
00082 void FactorizeMatrix(Matrix<double, Prop, Storage, Allocator> & mat,
00083 bool keep_matrix = false);
00084
00085 template<class Allocator2>
00086 void Solve(Vector<double, VectFull, Allocator2>& x);
00087
00088 template<class Allocator2>
00089 void Solve(const SeldonTranspose& TransA,
00090 Vector<double, VectFull, Allocator2>& x);
00091 };
00092
00093
00095 template<>
00096 class MatrixSuperLU<complex<double> >
00097 : public MatrixSuperLU_Base<complex<double> >
00098 {
00099 public:
00100 MatrixSuperLU() : MatrixSuperLU_Base<complex<double> >() {}
00101
00102 template<class Prop, class Storage, class Allocator>
00103 void FactorizeMatrix(Matrix<complex<double>, Prop,
00104 Storage, Allocator> & mat,
00105 bool keep_matrix = false);
00106
00107 template<class Allocator2>
00108 void Solve(Vector<complex<double>, VectFull, Allocator2>& x);
00109
00110 template<class Allocator2>
00111 void Solve(const SeldonTranspose& TransA,
00112 Vector<complex<double>, VectFull, Allocator2>& x);
00113
00114 };
00115 }
00116
00117 #define SELDON_FILE_SUPERLU_HXX
00118 #endif