Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
Namespaces | Functions
Ifpack2_PowerMethod.hpp File Reference

Definition of power methods. More...

#include "Kokkos_ArithTraits.hpp"
#include "Teuchos_FancyOStream.hpp"
#include "Teuchos_oblackholestream.hpp"
#include "Tpetra_Details_residual.hpp"
#include <cmath>
#include <iostream>

Go to the source code of this file.

Namespaces

namespace  Ifpack2
 Preconditioners and smoothers for Tpetra sparse matrices.
 

Functions

template<class OperatorType , class V >
V::scalar_type Ifpack2::PowerMethod::powerMethodWithInitGuess (const OperatorType &A, const V &D_inv, const int numIters, Teuchos::RCP< V > x, Teuchos::RCP< V > y, const typename Teuchos::ScalarTraits< typename V::scalar_type >::magnitudeType tolerance=1e-7, const int eigNormalizationFreq=1, Teuchos::RCP< Teuchos::FancyOStream > out=Teuchos::null, const bool computeSpectralRadius=true)
 Use the power method to estimate the maximum eigenvalue of A*D_inv, given an initial guess vector x.
 
template<class V >
void Ifpack2::PowerMethod::computeInitialGuessForPowerMethod (V &x, const bool nonnegativeRealParts)
 Fill x with random initial guess for power method.
 
template<class OperatorType , class V >
V::scalar_type Ifpack2::PowerMethod::powerMethod (const OperatorType &A, const V &D_inv, const int numIters, Teuchos::RCP< V > y, const typename Teuchos::ScalarTraits< typename V::scalar_type >::magnitudeType tolerance=1e-7, const int eigNormalizationFreq=1, Teuchos::RCP< Teuchos::FancyOStream > out=Teuchos::null, const bool computeSpectralRadius=true)
 Use the power method to estimate the maximum eigenvalue of A*D_inv.
 

Detailed Description

Definition of power methods.

Author
Graham Harper

This file describes power methods for use throughout Ifpack2

Function Documentation

◆ powerMethodWithInitGuess()

template<class OperatorType , class V >
V::scalar_type Ifpack2::PowerMethod::powerMethodWithInitGuess ( const OperatorType & A,
const V & D_inv,
const int numIters,
Teuchos::RCP< V > x,
Teuchos::RCP< V > y,
const typename Teuchos::ScalarTraits< typename V::scalar_type >::magnitudeType tolerance = 1e-7,
const int eigNormalizationFreq = 1,
Teuchos::RCP< Teuchos::FancyOStream > out = Teuchos::null,
const bool computeSpectralRadius = true )

Use the power method to estimate the maximum eigenvalue of A*D_inv, given an initial guess vector x.

Parameters
A[in] The Operator to use.
D_inv[in] Vector to use as implicit right scaling of A.
numIters[in] Maximum number of iterations of the power method.
x[in/out] On input: Initial guess Vector for the power method. Its Map must be the same as that of the domain Map of A. This method may use this Vector as scratch space.
y[out] The resulting eigenvector.
tolerance[in] The relative eigenvalue tolerance. (default: 1e-7)
eigNormalizationFreq[in] The frequency of normalization. (default: 1)
out[in] The stream to send verbose output to. (default: null)
computeSpectralRadius[in] Compute the absolute value of the dominant eigenvalue of \(D^{-1}A\) if true. Compute the dominant eigenvalue of \(D^{-1}A\) if false. (default: true)
Returns
Estimate of the maximum eigenvalue of A*D_inv.

◆ computeInitialGuessForPowerMethod()

template<class V >
void Ifpack2::PowerMethod::computeInitialGuessForPowerMethod ( V & x,
const bool nonnegativeRealParts )

Fill x with random initial guess for power method.

Parameters
x[out] Initial guess vector; a domain Map vector of the matrix.
nonnegativeRealParts[in] Whether to force all entries of x (on output) to have nonnegative real parts. Defaults to false (don't force).

This is an implementation detail of powerMethod() below. For a justification of the second parameter, see Github Issues #64 and #567.

◆ powerMethod()

template<class OperatorType , class V >
V::scalar_type Ifpack2::PowerMethod::powerMethod ( const OperatorType & A,
const V & D_inv,
const int numIters,
Teuchos::RCP< V > y,
const typename Teuchos::ScalarTraits< typename V::scalar_type >::magnitudeType tolerance = 1e-7,
const int eigNormalizationFreq = 1,
Teuchos::RCP< Teuchos::FancyOStream > out = Teuchos::null,
const bool computeSpectralRadius = true )

Use the power method to estimate the maximum eigenvalue of A*D_inv.

Parameters
A[in] The Operator to use.
D_inv[in] Vector to use as implicit right scaling of A.
numIters[in] Maximum number of iterations of the power method.
y[out] The resulting eigenvector.
tolerance[in] The relative eigenvalue tolerance. (default: 1e-7)
eigNormalizationFreq[in] The frequency of normalization. (default: 1)
out[in] The stream to send verbose output to. (default: null)
computeSpectralRadius[in] Compute the absolute value of the dominant eigenvalue of \(D^{-1}A\) if true. Compute the dominant eigenvalue of \(D^{-1}A\) if false. (default: true)
Returns
Estimate of the maximum eigenvalue of A*D_inv.