45#ifndef STOKHOS_JACOBIPRECONDITIONER_HPP
46#define STOKHOS_JACOBIPRECONDITIONER_HPP
48#include "Teuchos_RCP.hpp"
50#include "Teuchos_SerialDenseMatrix.hpp"
54 template <
typename ordinal_type,
typename value_type>
62 const Teuchos::SerialDenseMatrix<ordinal_type, value_type>& A_) :
A(A_) {}
68 const Teuchos::SerialDenseMatrix<ordinal_type, value_type>& Input,
69 Teuchos::SerialDenseMatrix<ordinal_type, value_type>& Result,
70 ordinal_type m)
const {
71 ordinal_type n=Input.numRows();
72 Teuchos::SerialDenseMatrix<ordinal_type, value_type> G(Teuchos::Copy,
A);
73 Teuchos::SerialDenseMatrix<ordinal_type, value_type> z(n,1);
74 for (ordinal_type
j=0;
j<m;
j++){
76 for (ordinal_type i=0; i<n; i++)
77 z(i,0)=Input(i,0)/
A(i,i);
81 for (ordinal_type i=0; i<n; i++){
82 for (ordinal_type
j=0;
j<n;
j++){
86 G(i,
j)=-
A(i,
j)/
A(i,i);
92 Result.multiply(Teuchos::NO_TRANS,Teuchos::NO_TRANS,1.0, G, z, 1.0);
101 const Teuchos::SerialDenseMatrix<ordinal_type, value_type>&
A;
virtual ~JacobiPreconditioner()
Destructor.
const Teuchos::SerialDenseMatrix< ordinal_type, value_type > & A
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.
JacobiPreconditioner(const Teuchos::SerialDenseMatrix< ordinal_type, value_type > &A_)
Constructor.
Top-level namespace for Stokhos classes and functions.