NOX
Development
|
A simple linear solver for use by NOX::LAPACK::Group. More...
#include <NOX_LAPACK_LinearSolver.H>
Public Member Functions | |
LinearSolver (int n) | |
Constructor. | |
LinearSolver (const LinearSolver< T > &s) | |
Copy constructor. | |
~LinearSolver () | |
Destructor. | |
LinearSolver & | operator= (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. | |
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().
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.
void NOX::LAPACK::LinearSolver< T >::reset | ( | ) |
Reset.
Resets the LU factorization indicating the matrix is updated.
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.