Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_DiagPreconditioner.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef STOKHOS_DIAGPRECONDITIONER_HPP
11 #define STOKHOS_DIAGPRECONDITIONER_HPP
12 
13 #include "Teuchos_RCP.hpp"
14 #include "Stokhos_Operator.hpp"
16 
17 namespace Stokhos {
18 
19  template <typename ordinal_type, typename value_type>
21  public Stokhos::Operator<ordinal_type,value_type> {
22  public:
23 
27 
29  virtual ~DiagPreconditioner() {}
30 
34  ordinal_type m) const {
35  ordinal_type n=Input.numRows();
36  for (ordinal_type i=0; i<n; i++){
37  Result(i,0)=Input(i,0)/A(i,i);
38  }
39  return 0;
40  }
41 
42  protected:
44  }; // class DiagPreconditioner
45 
46 } // namespace Stokhos
47 
48 #endif // STOKHOS_DIAGPRECONDITIONER_HPP
49 
DiagPreconditioner(const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &A_)
Constructor.
virtual ordinal_type ApplyInverse(const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &Input, Teuchos::SerialDenseMatrix< ordinal_type, value_type > &Result, ordinal_type m) const
Returns the result of a Operator inverse applied to a Teuchos::SerialDenseMatrix Input in Result...
const Teuchos::SerialDenseMatrix< ordinal_type, value_type > & A
int n
OrdinalType numRows() const