|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
Partial specialization for stub=false (the default). More...
#include <Ifpack2_Details_DenseSolver_decl.hpp>

Public Types | |
Public typedefs | |
| typedef MatrixType | matrix_type |
| The first template parameter of this class. | |
| typedef MatrixType::scalar_type | scalar_type |
| The type of entries in the input (global) matrix. | |
| typedef MatrixType::local_ordinal_type | local_ordinal_type |
| The type of local indices in the input (global) matrix. | |
| typedef MatrixType::global_ordinal_type | global_ordinal_type |
| The type of global indices in the input (global) matrix. | |
| typedef MatrixType::node_type | node_type |
| The Kokkos Node type of the input (global) matrix. | |
| typedef ::Teuchos::ScalarTraits < scalar_type >::magnitudeType | magnitude_type |
The type of the absolute value (magnitude) of a scalar_type. | |
| typedef Tpetra::RowMatrix < scalar_type, local_ordinal_type, global_ordinal_type, node_type > | row_matrix_type |
| Specialization of Tpetra::RowMatrix used by this class. | |
| typedef Tpetra::Map < local_ordinal_type, global_ordinal_type, node_type > | map_type |
| Specialization of Tpetra::Map used by this class. | |
Public Member Functions | |
| void | setParameters (const ::Teuchos::ParameterList ¶ms) |
| Set the solvers's parameters. | |
| void | initialize () |
| Set up the graph structure of this preconditioner. | |
| bool | isInitialized () const |
| True if the preconditioner has been successfully initialized, else false. | |
| void | compute () |
| Set up the numerical values in this preconditioner. | |
| bool | isComputed () const |
| True if the preconditioner has been successfully computed, else false. | |
| magnitude_type TEUCHOS_DEPRECATED | computeCondEst (CondestType CT=Ifpack2::Cheap, local_ordinal_type MaxIters=1550, magnitude_type Tol=1e-9, const ::Teuchos::Ptr< const row_matrix_type > &Matrix=::Teuchos::null) |
| Compute the condition number estimate and return its value. | |
| magnitude_type TEUCHOS_DEPRECATED | getCondEst () const |
| Return the computed condition number estimate, or -0 if not computed. | |
| ::Teuchos::RCP< const row_matrix_type > | getMatrix () const |
| The input matrix given to the constructor. | |
| void | setMatrix (const ::Teuchos::RCP< const row_matrix_type > &A) |
| Change the matrix to precondition. | |
| int | getNumInitialize () const |
| The number of calls to initialize(). | |
| int | getNumCompute () const |
| The number of calls to compute(). | |
| int | getNumApply () const |
| The number of calls to apply(). | |
| double | getInitializeTime () const |
| The total time (in seconds) spent in initialize(). | |
| double | getComputeTime () const |
| The total time (in seconds) spent in compute(). | |
| double | getApplyTime () const |
| The total time (in seconds) spent in apply(). | |
Constructor and destructor | |
| DenseSolver (const ::Teuchos::RCP< const row_matrix_type > &matrix) | |
| Constructor. | |
| virtual | ~DenseSolver () |
| Destructor (declared virtual for memory safety of derived classes). | |
| ::Teuchos::RCP< const map_type > | getDomainMap () const |
| Implementation of Tpetra::Operator. | |
| ::Teuchos::RCP< const map_type > | getRangeMap () const |
| The range Map of this operator. | |
| void | apply (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y,::Teuchos::ETransp mode=::Teuchos::NO_TRANS, scalar_type alpha=::Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=::Teuchos::ScalarTraits< scalar_type >::zero()) const |
| Apply the preconditioner to X, putting the result in Y. | |
Implementation of ::Teuchos::Describable | |
| std::string | description () const |
| A one-line description of this object. | |
| void | describe (::Teuchos::FancyOStream &out, const ::Teuchos::EVerbosityLevel verbLevel=::Teuchos::Describable::verbLevel_default) const |
| Print the object with some verbosity level to the given FancyOStream. | |
Partial specialization for stub=false (the default).
| typedef MatrixType Ifpack2::Details::DenseSolver< MatrixType, false >::matrix_type |
The first template parameter of this class.
This must be either a Tpetra::RowMatrix specialization (preferred) or a Tpetra::CrsMatrix specialization.
| typedef MatrixType::scalar_type Ifpack2::Details::DenseSolver< MatrixType, false >::scalar_type |
The type of entries in the input (global) matrix.
| typedef MatrixType::local_ordinal_type Ifpack2::Details::DenseSolver< MatrixType, false >::local_ordinal_type |
The type of local indices in the input (global) matrix.
| typedef MatrixType::global_ordinal_type Ifpack2::Details::DenseSolver< MatrixType, false >::global_ordinal_type |
The type of global indices in the input (global) matrix.
| typedef MatrixType::node_type Ifpack2::Details::DenseSolver< MatrixType, false >::node_type |
The Kokkos Node type of the input (global) matrix.
| typedef ::Teuchos::ScalarTraits<scalar_type>::magnitudeType Ifpack2::Details::DenseSolver< MatrixType, false >::magnitude_type |
The type of the absolute value (magnitude) of a scalar_type.
Reimplemented from Ifpack2::Preconditioner< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type >.
| typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Ifpack2::Details::DenseSolver< MatrixType, false >::row_matrix_type |
Specialization of Tpetra::RowMatrix used by this class.
| typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> Ifpack2::Details::DenseSolver< MatrixType, false >::map_type |
Specialization of Tpetra::Map used by this class.
| Ifpack2::Details::DenseSolver< MatrixType, false >::DenseSolver | ( | const ::Teuchos::RCP< const row_matrix_type > & | matrix | ) |
Constructor.
| matrix | [in] The original input matrix. |
| Ifpack2::Details::DenseSolver< MatrixType, false >::~DenseSolver | ( | ) | [virtual] |
Destructor (declared virtual for memory safety of derived classes).
| Teuchos::RCP< const typename DenseSolver< MatrixType, false >::map_type > Ifpack2::Details::DenseSolver< MatrixType, false >::getDomainMap | ( | ) | const [virtual] |
Implementation of Tpetra::Operator.
The domain Map of this operator.
The domain Map describes the distribution of valid input vectors X to the apply() method.
| Teuchos::RCP< const typename DenseSolver< MatrixType, false >::map_type > Ifpack2::Details::DenseSolver< MatrixType, false >::getRangeMap | ( | ) | const [virtual] |
The range Map of this operator.
The range Map describes the distribution of valid output vectors Y to the apply() method.
| void Ifpack2::Details::DenseSolver< MatrixType, false >::apply | ( | const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | X, |
| Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | Y, | ||
| ::Teuchos::ETransp | mode = ::Teuchos::NO_TRANS, |
||
| scalar_type | alpha = ::Teuchos::ScalarTraits<scalar_type>::one(), |
||
| scalar_type | beta = ::Teuchos::ScalarTraits<scalar_type>::zero() |
||
| ) | const |
Apply the preconditioner to X, putting the result in Y.
If the result of applying this preconditioner to a vector X is \(M^{-1} \cdot X$, then this method computes \) Y + M^{-1} X \(. The typical case is \) = 0 \( and \) = 1 \(. void apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X, Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y, ::Teuchos::ETransp mode = ::Teuchos::NO_TRANS, scalar_type alpha = ::Teuchos::ScalarTraits<scalar_type>::one(), scalar_type beta = ::Teuchos::ScalarTraits<scalar_type>::zero()) const; //@} //! Set the solvers's parameters. void setParameters (const ::Teuchos::ParameterList& params); \brief Set up the graph structure of this preconditioner. If the graph structure of the constructor's input matrix has changed, or if you have not yet called initialize(), you must call initialize() before you may call compute() or apply(). Thus, initialize() corresponds to the "symbolic factorization" step of a sparse factorization, whether or not the specific preconditioner actually does a sparse factorization. void initialize (); //! True if the preconditioner has been successfully initialized, else false. bool isInitialized () const; \brief Set up the numerical values in this preconditioner. If the values of the constructor's input matrix have changed, or if you have not yet called compute(), you must call compute() before you may call apply(). Thus, compute() corresponds to the "numeric factorization" step of a sparse factorization, whether or not the specific preconditioner actually does a sparse factorization. void compute (); //! True if the preconditioner has been successfully computed, else false. bool isComputed () const; \brief Compute the condition number estimate and return its value. \warning This method is DEPRECATED. It was inherited from Ifpack, and Ifpack never clearly stated what this method computes. Furthermore, Ifpack's method just estimates the condition number of the matrix A, and ignores the preconditioner -- which is probably not what users thought it did. If there is sufficient interest, we might reintroduce this method with a different meaning and a better algorithm. virtual magnitude_type TEUCHOS_DEPRECATED computeCondEst (CondestType CT = Ifpack2::Cheap, local_ordinal_type MaxIters = 1550, magnitude_type Tol = 1e-9, const ::Teuchos::Ptr<const row_matrix_type>& Matrix = ::Teuchos::null); \brief Return the computed condition number estimate, or -1 if not computed. \warning This method is DEPRECATED. See warning for computeCondEst(). virtual magnitude_type TEUCHOS_DEPRECATED getCondEst() const; //! The input matrix given to the constructor. ::Teuchos::RCP<const row_matrix_type> getMatrix () const; //! Change the matrix to precondition. void setMatrix (const ::Teuchos::RCP<const row_matrix_type>& A); //! The number of calls to initialize(). int getNumInitialize () const; //! The number of calls to compute(). int getNumCompute () const; //! The number of calls to apply(). int getNumApply() const; //! The total time (in seconds) spent in initialize(). double getInitializeTime() const; //! The total time (in seconds) spent in compute(). double getComputeTime() const; //! The total time (in seconds) spent in apply(). double getApplyTime() const; //@} //! @name Implementation of ::Teuchos::Describable //@{ //! A one-line description of this object. std::string description () const; //! Print the object with some verbosity level to the given FancyOStream. void describe (::Teuchos::FancyOStream &out, const ::Teuchos::EVerbosityLevel verbLevel = ::Teuchos::Describable::verbLevel_default) const; //@} private: //! Implementation of describe() for "local" (per process) data. void describeLocal (::Teuchos::FancyOStream& out, const ::Teuchos::EVerbosityLevel verbLevel) const; //! Reset stored data. void reset (); \brief Extract the local dense matrix from the local sparse matrix. \param A_local_dense [out] The local dense matrix. \param A_local [out] The local sparse matrix; the result of applying a LocalFilter to the original input matrix A. (If A is already "local," then this need not necessarily be the result of a LocalFilter.) static void extract (::Teuchos::SerialDenseMatrix<int, scalar_type>& A_local_dense, const row_matrix_type& A_local); \brief Factor the local dense matrix A in place. \param A [in/out] On input: The local dense matrix to factor. On output: The resulting LU factorization. \param ipiv [out] The pivot array from the LU factorization (with partial pivoting). Call this after calling extract(). static void factor (::Teuchos::SerialDenseMatrix<int, scalar_type>& A, const ::Teuchos::ArrayView<int>& ipiv); //! Specialization of Tpetra::MultiVector used in implementation. typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MV; //! Specialization of Tpetra::Import used in implementation. typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type> import_type; //! Specialization of Tpetra::Export used in implementation. typedef Tpetra::Export<local_ordinal_type, global_ordinal_type, node_type> export_type; //! Specialization of ::Teuchos::ScalarTraits used in implementation. typedef ::Teuchos::ScalarTraits<scalar_type> STS; \brief Post-permutation, post-view version of apply(). apply() first does any necessary subset permutation and view creation (or copying data), then calls this method to solve the linear system with the diagonal block. \param X [in] Subset permutation of the input X of apply(). \param Y [in] Subset permutation of the input/output Y of apply(). void applyImpl (const MV& X, MV& Y, const ::Teuchos::ETransp mode, const scalar_type alpha, const scalar_type beta) const; //! The (original) input matrix. ::Teuchos::RCP<const row_matrix_type> A_; //! The result of a LocalFilter on A_. ::Teuchos::RCP<const row_matrix_type> A_local_; //! The local (dense) matrix, which compute() extracts and factor() factors in place. ::Teuchos::SerialDenseMatrix<int, scalar_type> A_local_dense_; //! Permutation array from LAPACK (GETRF). ::Teuchos::Array<int> ipiv_; //! The total time (in seconds) spent in initialize(). double initializeTime_; //! The total time (in seconds) spent in compute(). double computeTime_; //! The total time (in seconds) spent in apply(). mutable double applyTime_; //! Total number of successful initialize() calls. int numInitialize_; //! Total number of successful compute() calls. int numCompute_; //! Total number of successful apply() calls. mutable int numApply_; //! If \c true, the container has been successfully initialized. bool isInitialized_; //! If \c true, the container has been successfully computed. bool isComputed_; }; //! Partial specialization for stub=true. template<class MatrixType> class DenseSolver<MatrixType, true> : public Ifpack2::Preconditioner<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>, virtual public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type> > { public: //! \name Public typedefs //@{ \brief The first template parameter of this class. This must be either a Tpetra::RowMatrix specialization (preferred) or a Tpetra::CrsMatrix specialization. typedef MatrixType matrix_type; //! The type of entries in the input (global) matrix. typedef typename MatrixType::scalar_type scalar_type; //! The type of local indices in the input (global) matrix. typedef typename MatrixType::local_ordinal_type local_ordinal_type; //! The type of global indices in the input (global) matrix. typedef typename MatrixType::global_ordinal_type global_ordinal_type; //! The Kokkos Node type of the input (global) matrix. typedef typename MatrixType::node_type node_type; //! The type of the absolute value (magnitude) of a \c scalar_type. typedef typename ::Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type; //! Specialization of Tpetra::RowMatrix used by this class. typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> row_matrix_type; //! Specialization of Tpetra::Map used by this class. typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> map_type; //@} //! \name Constructor and destructor //@{ \brief Constructor. \param matrix [in] The original input matrix. DenseSolver (const ::Teuchos::RCP<const row_matrix_type>& matrix); //! Destructor (declared virtual for memory safety of derived classes). virtual ~DenseSolver (); //@} //! Implementation of Tpetra::Operator //@{ \brief The domain Map of this operator. The domain Map describes the distribution of valid input vectors X to the apply() method. ::Teuchos::RCP<const map_type> getDomainMap () const; \brief The range Map of this operator. The range Map describes the distribution of valid output vectors Y to the apply() method. ::Teuchos::RCP<const map_type> getRangeMap () const; \brief Apply the preconditioner to X, putting the result in Y. If the result of applying this preconditioner to a vector X is \)^{-1} X$, then this method computes \(\beta Y + \alpha M^{-1} \cdot X\). The typical case is \(\beta = 0\) and \(\alpha = 1\).
| void Ifpack2::Details::DenseSolver< MatrixType, false >::setParameters | ( | const ::Teuchos::ParameterList & | params | ) |
Set the solvers's parameters.
| void Ifpack2::Details::DenseSolver< MatrixType, false >::initialize | ( | ) | [virtual] |
Set up the graph structure of this preconditioner.
If the graph structure of the constructor's input matrix has changed, or if you have not yet called initialize(), you must call initialize() before you may call compute() or apply().
Thus, initialize() corresponds to the "symbolic factorization" step of a sparse factorization, whether or not the specific preconditioner actually does a sparse factorization.
| bool Ifpack2::Details::DenseSolver< MatrixType, false >::isInitialized | ( | ) | const [virtual] |
True if the preconditioner has been successfully initialized, else false.
| void Ifpack2::Details::DenseSolver< MatrixType, false >::compute | ( | ) | [virtual] |
Set up the numerical values in this preconditioner.
If the values of the constructor's input matrix have changed, or if you have not yet called compute(), you must call compute() before you may call apply().
Thus, compute() corresponds to the "numeric factorization" step of a sparse factorization, whether or not the specific preconditioner actually does a sparse factorization.
| bool Ifpack2::Details::DenseSolver< MatrixType, false >::isComputed | ( | ) | const [virtual] |
True if the preconditioner has been successfully computed, else false.
| DenseSolver< MatrixType, false >::magnitude_type Ifpack2::Details::DenseSolver< MatrixType, false >::computeCondEst | ( | CondestType | CT = Ifpack2::Cheap, |
| local_ordinal_type | MaxIters = 1550, |
||
| magnitude_type | Tol = 1e-9, |
||
| const ::Teuchos::Ptr< const row_matrix_type > & | Matrix = ::Teuchos::null |
||
| ) |
Compute the condition number estimate and return its value.
| DenseSolver< MatrixType, false >::magnitude_type Ifpack2::Details::DenseSolver< MatrixType, false >::getCondEst | ( | ) | const [virtual] |
Return the computed condition number estimate, or -0 if not computed.
| Teuchos::RCP< const typename DenseSolver< MatrixType, false >::row_matrix_type > Ifpack2::Details::DenseSolver< MatrixType, false >::getMatrix | ( | ) | const [virtual] |
The input matrix given to the constructor.
| void Ifpack2::Details::DenseSolver< MatrixType, false >::setMatrix | ( | const ::Teuchos::RCP< const row_matrix_type > & | A | ) |
Change the matrix to precondition.
| int Ifpack2::Details::DenseSolver< MatrixType, false >::getNumInitialize | ( | ) | const [virtual] |
| int Ifpack2::Details::DenseSolver< MatrixType, false >::getNumCompute | ( | ) | const [virtual] |
The number of calls to compute().
| int Ifpack2::Details::DenseSolver< MatrixType, false >::getNumApply | ( | ) | const [virtual] |
The number of calls to apply().
| double Ifpack2::Details::DenseSolver< MatrixType, false >::getInitializeTime | ( | ) | const [virtual] |
The total time (in seconds) spent in initialize().
| double Ifpack2::Details::DenseSolver< MatrixType, false >::getComputeTime | ( | ) | const [virtual] |
The total time (in seconds) spent in compute().
| double Ifpack2::Details::DenseSolver< MatrixType, false >::getApplyTime | ( | ) | const [virtual] |
The total time (in seconds) spent in apply().
| std::string Ifpack2::Details::DenseSolver< MatrixType, false >::description | ( | ) | const |
A one-line description of this object.
| void Ifpack2::Details::DenseSolver< MatrixType, false >::describe | ( | ::Teuchos::FancyOStream & | out, |
| const ::Teuchos::EVerbosityLevel | verbLevel = ::Teuchos::Describable::verbLevel_default |
||
| ) | const |
Print the object with some verbosity level to the given FancyOStream.
1.7.6.1