NOX  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Types | Protected Attributes | List of all members
NOX::LAPACK::LinearSolver< T > Class Template Reference

A simple linear solver for use by NOX::LAPACK::Group. More...

#include <NOX_LAPACK_LinearSolver.H>

Inheritance diagram for NOX::LAPACK::LinearSolver< T >:
Inheritance graph
[legend]
Collaboration diagram for NOX::LAPACK::LinearSolver< T >:
Collaboration graph
[legend]

Public Member Functions

 LinearSolver (int n)
 Constructor.
 
 LinearSolver (const LinearSolver< T > &s)
 Copy constructor.
 
 ~LinearSolver ()
 Destructor.
 
LinearSolveroperator= (const LinearSolver< T > &s)
 Assignment.
 
Matrix< T > & getMatrix ()
 Return matrix.
 
const Matrix< T > & getMatrix () const
 Return matrix.
 
void reset ()
 Reset. More...
 
void apply (bool trans, int ncols, const T *input, T *output) const
 Apply matrix. More...
 
bool solve (bool trans, int ncols, T *output)
 Solve inverse. More...
 

Protected Types

typedef Teuchos::ScalarTraits
< T >::magnitudeType 
MT
 

Protected Attributes

Matrix< T > mat
 Matrix.
 
Matrix< T > lu
 LU factorization of matrix.
 
std::vector< int > pivots
 Pivots.
 
bool isValidLU
 Is LU factorization valid.
 
Teuchos::BLAS< int, T > blas
 BLAS wrappers.
 
Teuchos::LAPACK< int, T > lapack
 LAPACK wrappers.
 
int lwork
 Work array size for GELSS if linear solve fails.
 
int rank
 Rank param for GELSS if linear solve fails.
 
Teuchos::ArrayRCP< MT > sv
 Singular values for GELSS if linear solve fails.
 
Teuchos::ArrayRCP< T > work
 Work array for GELSS if linear solve fails.
 
Teuchos::ArrayRCP< MT > rwork
 Magnitude work array for complex-valued GELSS.
 

Detailed Description

template<typename T>
class NOX::LAPACK::LinearSolver< T >

A simple linear solver for use by NOX::LAPACK::Group.

This class provides a simple linear solver class that stores a NOX::LAPACK::Matrix and provides routines to apply the matrix and solve it using BLAS and LAPACK routines. It is templated so that it can be used to solve both real and complex matrices. It also stores an LU factorization of the matrix so repeated solves are more efficient. The group should signal that the matrix has changed by calling reset().

Member Function Documentation

template<typename T>
void NOX::LAPACK::LinearSolver< T >::apply ( bool  trans,
int  ncols,
const T *  input,
T *  output 
) const

Apply matrix.

Set trans to true to apply the transpose. ncols is the number of columns in input and output, which should be stored column-wise.

References Teuchos::CONJ_TRANS, Teuchos::NO_TRANS, and Teuchos::TRANS.

template<typename T >
void NOX::LAPACK::LinearSolver< T >::reset ( )

Reset.

Resets the LU factorization indicating the matrix is updated.

template<typename T>
bool NOX::LAPACK::LinearSolver< T >::solve ( bool  trans,
int  ncols,
T *  output 
)

Solve inverse.

Set trans to true to solve the transpose. ncols is the number of columns in output, which should be stored column- wise. The right-hand-side is passed through output, which is then overwritten with the result.


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