PlayaDenseSerialMatrix.hpp

00001 /* @HEADER@ */
00002 //
00003  /* @HEADER@ */
00004 
00005 
00006 
00007 #ifndef PLAYA_DENSE_SERIAL_MATRIX_H
00008 #define PLAYA_DENSE_SERIAL_MATRIX_H
00009 
00010 #include "PlayaDefs.hpp"
00011 #include "Teuchos_Array.hpp"
00012 #include "Teuchos_RCP.hpp"
00013 #include "PlayaPrintable.hpp"
00014 #include "Teuchos_Describable.hpp"
00015 #include "PlayaLinearOpWithSpacesDecl.hpp"
00016 #include "PlayaSerialVectorSpace.hpp"
00017 #include "PlayaLoadableMatrix.hpp"
00018 #include "PlayaSolverState.hpp"
00019 
00020 namespace Playa
00021 {
00022 using namespace Teuchos;
00023 
00024 template <class T> class LinearOperator;
00025 
00030 class DenseSerialMatrix : public LinearOpWithSpaces<double>,
00031                           public LoadableMatrix<double>,
00032                           public Playa::Printable
00033 {
00034 public:
00037   DenseSerialMatrix(
00038     const VectorSpace<double>& domain,
00039     const VectorSpace<double>& range);
00040 
00042   ~DenseSerialMatrix(){;}
00043 
00047   virtual void apply(Teuchos::ETransp transApplyType,
00048     const Vector<double>& in,
00049     Vector<double> out) const ;
00050 
00064   virtual void addToRow(int globalRowIndex,
00065     int nElemsToInsert,
00066     const int* globalColumnIndices,
00067     const double* elementValues) ;
00068 
00070   virtual void zero() ;
00071 
00072 
00073 
00075   void print(std::ostream& os) const ;
00076 
00078   const double * const dataPtr() const {return &(data_[0]);}
00079 
00081   double* dataPtr() {return &(data_[0]);}
00082 
00084   int numRows() const {return nRows_;}
00085 
00087   int numCols() const {return nCols_;}
00088 
00090   void setRow(int row, const Array<double>& rowVals);
00091 
00092 
00093 private:
00094 
00095   int nRows_;
00096   int nCols_;
00097   Array<double> data_;
00098 };
00099 
00100 
00102 void denseSVD(const LinearOperator<double>& A,
00103   LinearOperator<double>& U,  
00104   Vector<double>& Sigma,
00105   LinearOperator<double>& Vt);
00106 
00108 SolverState<double> denseSolve(const LinearOperator<double>& A,
00109   const Vector<double>& b,
00110   Vector<double>& x);
00111 
00112 }
00113 
00114 #endif

doxygen