Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
Belos::details::ProjectedLeastSquaresProblem< Scalar > Class Template Reference

"Container" for the GMRES projected least-squares problem. More...

#include <BelosProjectedLeastSquaresSolver.hpp>

Public Types

typedef Scalar scalar_type
 The type of the entries in the projected least-squares problem. More...
 
typedef Teuchos::ScalarTraits
< Scalar >::magnitudeType 
magnitude_type
 The type of the magnitude of scalar_type values. More...
 

Public Member Functions

 ProjectedLeastSquaresProblem (const int maxNumIterations)
 Constructor. More...
 
void reset (const typename Teuchos::ScalarTraits< Scalar >::magnitudeType beta)
 Reset the projected least-squares problem. More...
 
void reallocateAndReset (const typename Teuchos::ScalarTraits< Scalar >::magnitudeType beta, const int maxNumIterations)
 (Re)allocate and reset the projected least-squares problem. More...
 

Public Attributes

Teuchos::SerialDenseMatrix
< int, Scalar > 
H
 The upper Hessenberg matrix from GMRES. More...
 
Teuchos::SerialDenseMatrix
< int, Scalar > 
R
 Upper triangular factor from the QR factorization of H. More...
 
Teuchos::SerialDenseMatrix
< int, Scalar > 
y
 Current solution of the projected least-squares problem. More...
 
Teuchos::SerialDenseMatrix
< int, Scalar > 
z
 Current right-hand side of the projected least-squares problem. More...
 
Teuchos::Array< Scalar > theCosines
 Array of cosines from the computed Givens rotations. More...
 
Teuchos::Array< Scalar > theSines
 Array of sines from the computed Givens rotations. More...
 

Detailed Description

template<class Scalar>
class Belos::details::ProjectedLeastSquaresProblem< Scalar >

"Container" for the GMRES projected least-squares problem.

Author
Mark Hoemmen

See the documentation of ProjectedLeastSquaresSolver to learn how to use this class in a GMRES or Flexible GMRES iterative linear solver.

Definition at line 127 of file BelosProjectedLeastSquaresSolver.hpp.

Member Typedef Documentation

template<class Scalar>
Belos::details::ProjectedLeastSquaresProblem< Scalar >::scalar_type

The type of the entries in the projected least-squares problem.

Definition at line 131 of file BelosProjectedLeastSquaresSolver.hpp.

The type of the magnitude of scalar_type values.

Definition at line 134 of file BelosProjectedLeastSquaresSolver.hpp.

Constructor & Destructor Documentation

template<class Scalar>
Belos::details::ProjectedLeastSquaresProblem< Scalar >::ProjectedLeastSquaresProblem ( const int  maxNumIterations)
inline

Constructor.

Reserve space for a projected least-squares problem of dimension at most (maxNumIterations+1) by maxNumIterations. "Iterations" refers to GMRES iterations. We assume that after the first iteration (not counting the computation of the initial residual as an iteration), the projected least-squares problem has dimension 2 by 1.

Definition at line 205 of file BelosProjectedLeastSquaresSolver.hpp.

Member Function Documentation

template<class Scalar>
void Belos::details::ProjectedLeastSquaresProblem< Scalar >::reset ( const typename Teuchos::ScalarTraits< Scalar >::magnitudeType  beta)
inline

Reset the projected least-squares problem.

"Reset" means that the right-hand side of the projected least-squares problem is restored to $\beta e_1$. The value $\beta$ is typically the norm of the initial or restarted residual vector.

This method does not reallocate or resize any of the matrices or vectors. Since this class keeps the original upper Hessenberg matrix, the application may choose to recompute its QR factorization up to the desired point and apply the resulting Givens rotations to the right-hand size z resulting from this reset operation. Alternately, the application may simply overwrite the upper Hessenberg matrix's entries with new data.

Parameters
beta[in] The initial residual norm of the (non-projected) linear system $Ax=b$.

Definition at line 233 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
void Belos::details::ProjectedLeastSquaresProblem< Scalar >::reallocateAndReset ( const typename Teuchos::ScalarTraits< Scalar >::magnitudeType  beta,
const int  maxNumIterations 
)
inline

(Re)allocate and reset the projected least-squares problem.

"(Re)allocate" means to (re)size H, R, y, and z to their appropriate maximum dimensions, given the maximum number of iterations that GMRES may execute. "Reset" means to do what the reset() method does. Reallocation happens first, then reset.

Parameters
beta[in] The initial residual norm of the (non-projected) linear system $Ax=b$.
maxNumIterations[in] The maximum number of iterations that GMRES may execute.

Definition at line 260 of file BelosProjectedLeastSquaresSolver.hpp.

Member Data Documentation

template<class Scalar>
Teuchos::SerialDenseMatrix<int,Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::H

The upper Hessenberg matrix from GMRES.

This matrix's number of rows is one more than its number of columns. The updating methods never modify H; they just copy out the relevant data into R. This allows GMRES implementations to implement features like backtracking (throwing away iterations).

Definition at line 143 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
Teuchos::SerialDenseMatrix<int,Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::R

Upper triangular factor from the QR factorization of H.

R is a matrix with the same dimensions as H. It is used for computing and storing the incrementally computed upper triangular factor from the QR factorization of H. R must have the same dimensions as H (the number of rows is one more than the number of columns).

H[0:k, 0:k-1] (inclusive zero-based index ranges) is the upper Hessenberg matrix for the first k iterations of GMRES (where k = 0, 1, 2, ...).

Definition at line 156 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
Teuchos::SerialDenseMatrix<int,Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::y

Current solution of the projected least-squares problem.

The vector (matrix with one column) y has the same number of rows as H. It is used to store the solution of the projected least-squares problem at each step. The vector should have one more entry than necessary for the solution, because of the way we solve the least-squares problem. (Most of the methods require copying the right-hand side vector into y, and the right-hand side has one more entry than the solution.)

Definition at line 168 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
Teuchos::SerialDenseMatrix<int,Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::z

Current right-hand side of the projected least-squares problem.

The vector (one-column matrix) z has the same number of rows as H. It stores the current right-hand side of the projected least-squares problem. The z vector may be updated either progressively (if a Givens rotation method is used) or all at once (if an LAPACK factorization method is used).

Definition at line 178 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
Teuchos::Array<Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::theCosines

Array of cosines from the computed Givens rotations.

This array is only filled in if a Givens rotation method is used for updating the least-squares problem.

In the complex-arithmetic case, it is possible to compute entirely real-valued cosines. However, we choose to represent them as the original scalar type, rather than the magnitude type.

Definition at line 189 of file BelosProjectedLeastSquaresSolver.hpp.

template<class Scalar>
Teuchos::Array<Scalar> Belos::details::ProjectedLeastSquaresProblem< Scalar >::theSines

Array of sines from the computed Givens rotations.

This array is only filled in if a Givens rotation method is used for updating the least-squares problem.

Definition at line 195 of file BelosProjectedLeastSquaresSolver.hpp.


The documentation for this class was generated from the following file:

Generated on Thu Nov 21 2024 09:25:08 for Belos by doxygen 1.8.5