Go to the documentation of this file.00001 #ifndef TSFLAPACKGENERALMATRIX_H
00002 #define TSFLAPACKGENERALMATRIX_H
00003
00004 #include "SundanceDefs.hpp"
00005 #include "TSFDenseSerialVector.hpp"
00006 #include "Teuchos_Array.hpp"
00007
00008 namespace TSFExtended
00009 {
00010
00011
00012
00013
00014 class LAPACKGeneralMatrix
00015 {
00016 public:
00017
00018
00019 LAPACKGeneralMatrix(int nRow, int nCol);
00020
00021
00022 LAPACKGeneralMatrix();
00023
00024
00025 inline double& operator[](int i) {return data_[i];}
00026 inline const double& operator[](int i) const {return data_[i];}
00027
00028 inline double& operator()(int i, int j)
00029 {return data_[i+nRows_*j];}
00030 inline const double& operator()(int i, int j) const
00031 {return data_[i+nRows_*j];}
00032
00033 inline int getNumRows() const
00034 {
00035 return nRows_;
00036 }
00037
00038 inline int getNumCols() const
00039 {
00040 return nCols_;
00041 }
00042
00043
00044
00045
00046 void apply(const DenseSerialVector& in,
00047 DenseSerialVector& out) const ;
00048
00049
00050
00051
00052
00053
00054 void applyInverse(const DenseSerialVector& in,
00055 DenseSerialVector& out) const ;
00056
00057
00058
00059
00060 void applyAdjoint(const DenseSerialVector& in,
00061 DenseSerialVector& out) const ;
00062
00063
00064 void applyInverseAdjoint(const DenseSerialVector& in,
00065 DenseSerialVector& out) const ;
00066
00067
00068
00069
00070
00071 void setElement(int i, int j, const double& aij) ;
00072
00073
00074 void zero() ;
00075
00076
00077 void factor() const ;
00078
00079
00080 void print(std::ostream& os) const ;
00081
00082
00083
00084 protected:
00085
00086
00087 void mvMult(bool transpose, const DenseSerialVector& in,
00088 DenseSerialVector& out) const ;
00089
00090
00091 void solve(bool transpose, const DenseSerialVector& in,
00092 DenseSerialVector& out) const ;
00093
00094
00095 int nRows_;
00096
00097 int nCols_;
00098
00099 DenseSerialVector data_;
00100
00101 mutable Teuchos::Array<int> iPiv_;
00102
00103 mutable bool isFactored_;
00104
00105 mutable DenseSerialVector factorData_;
00106
00107 };
00108
00109 }
00110
00111 #endif