Go to the documentation of this file.00001 #ifndef TSF_DENSE_SERIAL_MATRIX_H
00002 #define TSF_DENSE_SERIAL_MATRIX_H
00003
00004 #include "SundanceDefs.hpp"
00005 #include "Teuchos_Array.hpp"
00006 #include "Teuchos_RCP.hpp"
00007 #include "SundancePrintable.hpp"
00008 #include "Teuchos_Describable.hpp"
00009 #include "TSFSimplifiedLinearOpBaseDecl.hpp"
00010 #include "TSFSerialVectorSpace.hpp"
00011 #include "TSFLoadableMatrix.hpp"
00012 #include "TSFSolverState.hpp"
00013
00014 namespace TSFExtended
00015 {
00016 using namespace Teuchos;
00017
00018 template <class T> class LinearOperator;
00019
00020
00021
00022
00023
00024 class DenseSerialMatrix : public SimplifiedLinearOpBase<double>,
00025 public LoadableMatrix<double>,
00026 public Sundance::Printable
00027 {
00028 public:
00029
00030
00031 DenseSerialMatrix(
00032 const RCP<const SerialVectorSpace>& domain,
00033 const RCP<const SerialVectorSpace>& range);
00034
00035
00036 ~DenseSerialMatrix(){;}
00037
00038
00039
00040
00041 virtual void applyOp(const Thyra::EOpTransp M_trans,
00042 const Vector<double>& in,
00043 Vector<double> out) const ;
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 virtual void addToRow(int globalRowIndex,
00059 int nElemsToInsert,
00060 const int* globalColumnIndices,
00061 const double* elementValues) ;
00062
00063
00064 virtual void zero() ;
00065
00066
00067
00068
00069 void print(std::ostream& os) const ;
00070
00071
00072
00073
00074
00075 RCP< const VectorSpaceBase<double> > range() const
00076 {return range_;}
00077
00078
00079
00080 RCP< const VectorSpaceBase<double> > domain() const
00081 {return domain_;}
00082
00083
00084 const double * const dataPtr() const {return &(data_[0]);}
00085
00086
00087 double* dataPtr() {return &(data_[0]);}
00088
00089
00090 int numRows() const {return nRows_;}
00091
00092
00093 int numCols() const {return nCols_;}
00094
00095
00096 void setRow(int row, const Array<double>& rowVals);
00097
00098
00099 private:
00100
00101 RCP<const SerialVectorSpace> domain_;
00102 RCP<const SerialVectorSpace> range_;
00103
00104 int nRows_;
00105 int nCols_;
00106 Array<double> data_;
00107 };
00108
00109
00110
00111 void denseSVD(const LinearOperator<double>& A,
00112 LinearOperator<double>& U,
00113 Vector<double>& Sigma,
00114 LinearOperator<double>& Vt);
00115
00116
00117 SolverState<double> denseSolve(const LinearOperator<double>& A,
00118 const Vector<double>& b,
00119 Vector<double>& x);
00120
00121 }
00122
00123 #endif