Belos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Private Member Functions | Private Attributes | List of all members
Belos::LSQRIter< ScalarType, MV, OP > Class Template Reference

Implementation of the LSQR iteration. More...

#include <BelosLSQRIter.hpp>

Inheritance diagram for Belos::LSQRIter< ScalarType, MV, OP >:
Inheritance graph
[legend]

Public Types

typedef Belos::MultiVecTraits
< ScalarType, MV > 
MVT
 
typedef Belos::OperatorTraits
< ScalarType, MV, OP > 
OPT
 
typedef Teuchos::ScalarTraits
< ScalarType > 
SCT
 
typedef SCT::magnitudeType MagnitudeType
 

Private Member Functions

void setStateSize ()
 Method for initalizing the state storage needed by LSQR. More...
 

Private Attributes

const Teuchos::RCP
< Belos::LinearProblem
< ScalarType, MV, OP > > 
lp_
 
const Teuchos::RCP
< Belos::OutputManager
< ScalarType > > 
om_
 
const Teuchos::RCP
< Belos::StatusTest
< ScalarType, MV, OP > > 
stest_
 
bool initialized_
 
bool stateStorageInitialized_
 
int iter_
 
Teuchos::RCP< MV > U_
 
Teuchos::RCP< MV > V_
 
Teuchos::RCP< MV > W_
 
MagnitudeType lambda_
 
ScalarType resid_norm_
 
ScalarType frob_mat_norm_
 
ScalarType mat_cond_num_
 
ScalarType mat_resid_norm_
 
ScalarType sol_norm_
 
ScalarType bnorm_
 

Constructors/Destructor

 LSQRIter (const Teuchos::RCP< Belos::LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< Belos::OutputManager< ScalarType > > &printer, const Teuchos::RCP< Belos::StatusTest< ScalarType, MV, OP > > &tester, Teuchos::ParameterList &params)
 LSQRIter constructor with linear problem, solver utilities, and parameter list of solver options. More...
 
virtual ~LSQRIter ()
 Destructor. More...
 

Solver methods

void iterate ()
 This method performs LSQR iterations until the status test indicates the need to stop or an error occurs (in which case, an std::exception is thrown). More...
 
void initializeLSQR (LSQRIterationState< ScalarType, MV > &newstate)
 Initialize the solver to an iterate, completing the initial state. More...
 
void initialize ()
 The solver is initialized using initializeLSQR. More...
 
LSQRIterationState< ScalarType,
MV > 
getState () const
 Get the current state of the linear solver. More...
 

Status methods

int getNumIters () const
 Get the current iteration count. More...
 
void resetNumIters (int iter=0)
 Reset the iteration count. More...
 
Teuchos::RCP< const MV > getNativeResiduals (std::vector< MagnitudeType > *) const
 Get the norms of the residuals native to the solver. More...
 
Teuchos::RCP< MV > getCurrentUpdate () const
 Get the current update to the linear system. More...
 

Accessor methods

const Belos::LinearProblem
< ScalarType, MV, OP > & 
getProblem () const
 Get a constant reference to the linear problem. More...
 
int getBlockSize () const
 Get the blocksize to be used by the iterative solver in solving this linear problem. More...
 
void setBlockSize (int blockSize)
 Set the blocksize to be used by the iterative solver to solve this linear problem. More...
 
bool isInitialized ()
 States whether the solver has been initialized or not. More...
 

Detailed Description

template<class ScalarType, class MV, class OP>
class Belos::LSQRIter< ScalarType, MV, OP >

Implementation of the LSQR iteration.

Author
David Day

Definition at line 75 of file BelosLSQRIter.hpp.

Member Typedef Documentation

template<class ScalarType, class MV, class OP>
typedef Belos::MultiVecTraits<ScalarType,MV> Belos::LSQRIter< ScalarType, MV, OP >::MVT

Definition at line 82 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
typedef Belos::OperatorTraits<ScalarType,MV,OP> Belos::LSQRIter< ScalarType, MV, OP >::OPT

Definition at line 83 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
typedef Teuchos::ScalarTraits<ScalarType> Belos::LSQRIter< ScalarType, MV, OP >::SCT

Definition at line 84 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
typedef SCT::magnitudeType Belos::LSQRIter< ScalarType, MV, OP >::MagnitudeType

Definition at line 85 of file BelosLSQRIter.hpp.

Constructor & Destructor Documentation

template<class ScalarType , class MV , class OP >
Belos::LSQRIter< ScalarType, MV, OP >::LSQRIter ( const Teuchos::RCP< Belos::LinearProblem< ScalarType, MV, OP > > &  problem,
const Teuchos::RCP< Belos::OutputManager< ScalarType > > &  printer,
const Teuchos::RCP< Belos::StatusTest< ScalarType, MV, OP > > &  tester,
Teuchos::ParameterList params 
)

LSQRIter constructor with linear problem, solver utilities, and parameter list of solver options.

This constructor takes pointers required by the linear solver iteration, in addition to a parameter list of options for the linear solver.

Definition at line 287 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
virtual Belos::LSQRIter< ScalarType, MV, OP >::~LSQRIter ( )
inlinevirtual

Destructor.

Definition at line 106 of file BelosLSQRIter.hpp.

Member Function Documentation

template<class ScalarType , class MV , class OP >
void Belos::LSQRIter< ScalarType, MV, OP >::iterate ( )
virtual

This method performs LSQR iterations until the status test indicates the need to stop or an error occurs (in which case, an std::exception is thrown).

iterate() first determine whether the solver is initialized; if not, it will call initialize() without arguments. After initialization, iterate() iterates LSQR until the status test is Passed, and then returns to the caller.

The status test is queried at the beginning of the iteration.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 433 of file BelosLSQRIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::LSQRIter< ScalarType, MV, OP >::initializeLSQR ( LSQRIterationState< ScalarType, MV > &  newstate)

Initialize the solver to an iterate, completing the initial state.

The LSQRIter contains a certain amount of state, consisting of two bidiagonalization vectors, a descent direction, a damping value, and various estimates of errors and the like.

Note
For any pointer in newstate which directly points to the multivectors in the solver, the data is not copied.

Definition at line 344 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
void Belos::LSQRIter< ScalarType, MV, OP >::initialize ( )
inlinevirtual

The solver is initialized using initializeLSQR.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 139 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
LSQRIterationState<ScalarType,MV> Belos::LSQRIter< ScalarType, MV, OP >::getState ( ) const
inline

Get the current state of the linear solver.

The data is only valid if isInitialized() == true.

Returns
A LSQRIterationState object containing const pointers to the current solver state.

Definition at line 152 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
int Belos::LSQRIter< ScalarType, MV, OP >::getNumIters ( ) const
inlinevirtual

Get the current iteration count.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 174 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
void Belos::LSQRIter< ScalarType, MV, OP >::resetNumIters ( int  iter = 0)
inlinevirtual

Reset the iteration count.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 177 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
Teuchos::RCP<const MV> Belos::LSQRIter< ScalarType, MV, OP >::getNativeResiduals ( std::vector< MagnitudeType > *  ) const
inline

Get the norms of the residuals native to the solver.

Returns
This method returns a null pointer because residuals aren't used with LSQR.

Definition at line 181 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
Teuchos::RCP<MV> Belos::LSQRIter< ScalarType, MV, OP >::getCurrentUpdate ( ) const
inlinevirtual

Get the current update to the linear system.

Note
This method returns a null pointer because the linear problem is current.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 186 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
const Belos::LinearProblem<ScalarType,MV,OP>& Belos::LSQRIter< ScalarType, MV, OP >::getProblem ( ) const
inlinevirtual

Get a constant reference to the linear problem.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 194 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
int Belos::LSQRIter< ScalarType, MV, OP >::getBlockSize ( ) const
inlinevirtual

Get the blocksize to be used by the iterative solver in solving this linear problem.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 197 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
void Belos::LSQRIter< ScalarType, MV, OP >::setBlockSize ( int  blockSize)
inlinevirtual

Set the blocksize to be used by the iterative solver to solve this linear problem.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 202 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
bool Belos::LSQRIter< ScalarType, MV, OP >::isInitialized ( )
inlinevirtual

States whether the solver has been initialized or not.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 208 of file BelosLSQRIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::LSQRIter< ScalarType, MV, OP >::setStateSize ( )
private

Method for initalizing the state storage needed by LSQR.

Definition at line 310 of file BelosLSQRIter.hpp.

Member Data Documentation

template<class ScalarType, class MV, class OP>
const Teuchos::RCP<Belos::LinearProblem<ScalarType,MV,OP> > Belos::LSQRIter< ScalarType, MV, OP >::lp_
private

Definition at line 223 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
const Teuchos::RCP<Belos::OutputManager<ScalarType> > Belos::LSQRIter< ScalarType, MV, OP >::om_
private

Definition at line 224 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
const Teuchos::RCP<Belos::StatusTest<ScalarType,MV,OP> > Belos::LSQRIter< ScalarType, MV, OP >::stest_
private

Definition at line 225 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
bool Belos::LSQRIter< ScalarType, MV, OP >::initialized_
private

Definition at line 235 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
bool Belos::LSQRIter< ScalarType, MV, OP >::stateStorageInitialized_
private

Definition at line 240 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
int Belos::LSQRIter< ScalarType, MV, OP >::iter_
private

Definition at line 243 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
Teuchos::RCP<MV> Belos::LSQRIter< ScalarType, MV, OP >::U_
private

Definition at line 250 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
Teuchos::RCP<MV> Belos::LSQRIter< ScalarType, MV, OP >::V_
private

Definition at line 253 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
Teuchos::RCP<MV> Belos::LSQRIter< ScalarType, MV, OP >::W_
private

Definition at line 256 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
MagnitudeType Belos::LSQRIter< ScalarType, MV, OP >::lambda_
private

Definition at line 259 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::resid_norm_
private

Definition at line 262 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::frob_mat_norm_
private

Definition at line 265 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::mat_cond_num_
private

Definition at line 268 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::mat_resid_norm_
private

Definition at line 271 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::sol_norm_
private

Definition at line 274 of file BelosLSQRIter.hpp.

template<class ScalarType, class MV, class OP>
ScalarType Belos::LSQRIter< ScalarType, MV, OP >::bnorm_
private

Definition at line 277 of file BelosLSQRIter.hpp.


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