Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers. More...
#include <Amesos2_SolverCore_decl.hpp>
Public Types | |
typedef SolverCore < ConcreteSolver, Matrix, Vector > | type |
typedef Solver< Matrix, Vector > | super_type |
typedef ConcreteSolver< Matrix, Vector > | solver_type |
typedef Matrix | matrix_type |
typedef Vector | vector_type |
typedef MatrixAdapter < matrix_type >::scalar_t | scalar_type |
typedef MatrixAdapter < matrix_type > ::local_ordinal_t | local_ordinal_type |
typedef MatrixAdapter < matrix_type > ::global_ordinal_t | global_ordinal_type |
typedef MatrixAdapter < matrix_type >::global_size_t | global_size_type |
typedef MatrixAdapter < matrix_type >::node_t | node_type |
Public Member Functions | |
bool | matrixShapeOK () |
Returns true if the solver can handle this matrix shape. More... | |
void | setA (const Teuchos::RCP< const Matrix > a, EPhase keep_phase=CLEAN) |
Sets the matrix A of this solver. More... | |
void | setA (const Matrix *a, EPhase keep_phase=CLEAN) |
Sets the matrix A of this solver. More... | |
void | setX (const Teuchos::RCP< Vector > x) |
Sets the LHS vector X. | |
void | setX (Vector *x) |
Sets the LHS vector X using a raw pointer. | |
const Teuchos::RCP< Vector > | getX () |
Returns the vector that is the LHS of the linear system. | |
Vector * | getXRaw () |
Returns a raw pointer to the LHS of the linear system. | |
void | setB (const Teuchos::RCP< const Vector > b) |
Sets the RHS vector B. | |
void | setB (const Vector *b) |
Sets the RHS vector B using a raw pointer. | |
const Teuchos::RCP< const Vector > | getB () |
Returns the vector that is the RHS of the linear system. | |
const Vector * | getBRaw () |
Returns a raw pointer to the RHS of the linear system. | |
std::string | description () const |
Returns a short description of this Solver. | |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const |
void | printTiming (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const |
Prints timing information about the current solver. More... | |
void | getTiming (Teuchos::ParameterList &timingParameterList) const |
Extracts timing information from the current solver. More... | |
std::string | name () const |
Return the name of this solver. More... | |
Constructor/Destructor methods | |
SolverCore (Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B) | |
Initialize a Solver instance. More... | |
~SolverCore () | |
Destructor. | |
SolverCore (const solver_type &rhs) | |
Do not allow copying of this Solver object. | |
super_type & | operator= (const solver_type *rhs) |
Do not allow copying of this Solver by assignment. | |
Mathematical functions | |
super_type & | preOrdering () |
Pre-orders the matrix A for minimal fill-in. More... | |
super_type & | symbolicFactorization () |
Performs symbolic factorization on the matrix A. More... | |
super_type & | numericFactorization () |
Performs numeric factorization on the matrix A. More... | |
void | solve () |
Solves (or ) More... | |
void | solve (const Teuchos::Ptr< Vector > X, const Teuchos::Ptr< const Vector > B) const |
Solve using the given X and B vectors. More... | |
void | solve (Vector *X, const Vector *B) const |
Solve using the given X and B vectors. More... | |
Parameter methods | |
super_type & | setParameters (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) |
Set/update internal variables and solver options. More... | |
Teuchos::RCP< const Teuchos::ParameterList > | getValidParameters () const |
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept. More... | |
void | setParameterList (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) |
Set or update internal variables and solver options. More... | |
Teuchos::RCP < Teuchos::ParameterList > | getNonconstParameterList () |
This is a empty stub. More... | |
Teuchos::RCP < Teuchos::ParameterList > | unsetParameterList () |
This is an empty stub. More... | |
Accessor methods | |
Teuchos::RCP< const Teuchos::Comm< int > > | getComm () const |
Returns a pointer to the Teuchos::Comm communicator with this operator. | |
Status & | getStatus () const |
Returns a reference to this solver's internal status object. | |
Protected Member Functions | |
void | setNnzLU (size_t nnz) |
Set the number of non-zero values in the and factors. More... | |
Protected Attributes | |
Teuchos::RCP< const MatrixAdapter< Matrix > > | matrixA_ |
The LHS operator. | |
bool | matrix_loaded_ |
Teuchos::RCP< Vector > | multiVecX_ |
The LHS vector/multi-vector. | |
Teuchos::RCP< const Vector > | multiVecB_ |
The RHS vector/multi-vector. More... | |
global_size_type | globalNumRows_ |
Number of global rows in matrixA_ . | |
global_size_type | globalNumCols_ |
Number of global columns in matrixA_ . | |
global_size_type | globalNumNonZeros_ |
Number of global non-zero values in matrixA_ . | |
global_size_type | rowIndexBase_ |
Index base of rowmap of matrixA_ . | |
global_size_type | columnIndexBase_ |
Index base of column map of matrixA_ . | |
Status | status_ |
Holds status information about a solver. | |
Control | control_ |
Parameters for solving. | |
Timers | timers_ |
Various timing statistics. | |
int | rank_ |
The MPI rank of this image. | |
bool | root_ |
If true , then this is the root processor. | |
int | nprocs_ |
Number of process images in the matrix communicator. | |
Private Member Functions | |
void | loadA (EPhase current_phase) |
Refresh this solver's internal data about A. More... | |
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers.
Templated core-functionality class for Amesos2 solvers. Definitions.
The Amesos2::SolverCore class is the statically polymorphic parent class of each Amesos2 class named Amesos2_SolverName which interfaces with the third-party solver named SolverName.
Each concrete solver interface implements several private "sub-functions" that are called within common code for that function.
This static base class also provides a convenient way to handle the template parameters and private typedef'ing (with the help of the Matrix and MultiVector adapter classes) of the ordinal and scalar types that can be used elsewhere in the concrete solver code.
Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::SolverCore | ( | Teuchos::RCP< const Matrix > | A, |
Teuchos::RCP< Vector > | X, | ||
Teuchos::RCP< const Vector > | B | ||
) |
Initialize a Solver instance.
A single constructor is supported, which accepts Teuchos::RCP objects that point to a matrix-esque A, and vector-esque LHS object and RHS object B. This is the only constructor used by Amesos2::create.
std::invalid_argument | The shape of the matrix A is not supported by the underlying solver. |
References Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::matrixShapeOK().
|
virtual |
Pre-orders the matrix A for minimal fill-in.
Rearranges the rows and columns of the matrix A to minimize the amount of fill-in of the non-zero entries of the matrix. Pre-ordering may or may not be supported by the underlying solver. If not supported, a call to this method simply does nothing.
this
. Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Performs symbolic factorization on the matrix A.
In addition to performing symbolic factorization on the matrix A, the call to symbolicFactorization() implies that no change will be made to the non-zero structure of the underlying matrix without a subsequent call to symbolicFactorization().
this
. Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Performs numeric factorization on the matrix A.
In addition to performing numeric factorization on the matrix A, the call to numericFactorization() implies that no change will be made to the underlying matrix values without a subsequent call to numericFactorization().
this
Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Solves (or )
Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Solve using the given X and B vectors.
This overload of solve uses the given X and B vectors when solving. This X and B are used in place of any X and B that were given upon construction of the Amesos2 solver instance and are used only for this solve.
If a permanent change of X and B are required, see the setX() and setB() methods.
X
contains the solution to the systemX
and B
given at construction time (if any) are unchanged. Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Solver< Matrix, Vector >::numericFactorization().
|
virtual |
Solve using the given X and B vectors.
This overload of solve uses the given X and B vectors when solving. This X and B are used in place of any X and B that were given upon construction of the Amesos2 solver instance and are used only for this solve.
If a permanent change of X and B are required, see the setX() and setB() methods.
X
contains the solution to the systemX
and B
given at construction time (if any) are unchanged. Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Returns true
if the solver can handle this matrix shape.
Returns true if the matrix shape is one that the underlying concrete sparse direct solver can handle. Classes that work only on square matrices should return false for rectangular matrices. Classes that work only on symmetric matrices would return false for non-symmetric matrices. etc.
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::SolverCore().
|
virtual |
Sets the matrix A of this solver.
[in] | a | An RCP to a matrix will will be used for future computation steps |
[in] | keep_phase | This parameter tells the solver what state it should keep. For example, you may want to replace the matrix but keep the symbolic factorization because you know the structure of the new matrix is the same as the structure of the old matrix. In this case you would pass Amesos2::SYMBFACT as this parameter. |
The default value for the second parameter is Amesos2::CLEAN, which means that the internal state of the solver will be completely reset. It will be as if no previous computational steps were performed.
Implements Amesos2::Solver< Matrix, Vector >.
|
inlinevirtual |
Sets the matrix A of this solver.
[in] | a | An raw C pointer to a matrix will will be used for future computation steps. |
[in] | keep_phase | This parameter tells the solver what state it should keep. For example, you may want to replace the matrix but keep the symbolic factorization because you know the structure of the new matrix is the same as the structure of the old matrix. In this case you would pass Amesos2::SYMBFACT as this parameter. |
The default value for the second parameter is Amesos2::CLEAN, which means that the internal state of the solver will be completely reset. It will be as if no previous computational steps were performed.
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setA().
|
virtual |
Set/update internal variables and solver options.
The setParameters method is consistent over all concrete solvers. It accepts general status and control parameters, as well as parameters specific to a given solver. If the solver does not recognize the parameter, then it will simply be ignored
parameterList
. Parameters not specified in parameterList
revert to their default values.this
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::Lapack< Matrix, Vector >::Lapack(), Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setParameterList(), Amesos2::Superludist< Matrix, Vector >::Superludist(), and Amesos2::Superlumt< Matrix, Vector >::Superlumt().
|
virtual |
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
"YES"
and "NO"
as well as true
and false
). Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::Lapack< Matrix, Vector >::Lapack(), Amesos2::Superludist< Matrix, Vector >::Superludist(), and Amesos2::Superlumt< Matrix, Vector >::Superlumt().
|
inline |
Set or update internal variables and solver options.
Redefined from Teuchos::ParameterListAcceptor
setParameters()
[in] | parameterList |
|
inline |
This is a empty stub.
|
inline |
This is an empty stub.
|
virtual |
Prints the status information about the current solver with some level of verbosity
Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Util::printLine().
|
virtual |
Prints timing information about the current solver.
The Amesos2::SolverCore
base class takes care of tracking total time spent in the Amesos2 interface. Concrete solver interface class are responsible for reporting other timing statistics, which include time spent in:
Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Util::printLine().
|
virtual |
Extracts timing information from the current solver.
Results are placed into the parameter list timingParameterList
.
[out] | timingParameterList | Accepts timing information from the current solver |
Implements Amesos2::Solver< Matrix, Vector >.
|
virtual |
Return the name of this solver.
The name is given by the underlying concrete solver instance
std::string
which is the name of this solver Implements Amesos2::Solver< Matrix, Vector >.
|
private |
Refresh this solver's internal data about A.
Called whenever it would be necessary to refresh a solver's internal storage of the matrix A, which is whenever a phase is called that is equal to or below the current call.
For example, say a user has just previously called solve(), then calls numericFactorization(). Since the solve phase is greater than the numericFactorization phase, this is an indication that the internal store of A needs refreshing, since the user (assuming the user know what she's doing) wouldn't otherwise need to call numericFactorization following a solve.
|
inlineprotected |
Set the number of non-zero values in the and factors.
Concrete solver classes may call this method if they wish to (or are able to) report the number of conbined non-zero count for the and factors.
|
protected |
If true
indicates that the current matrix A has been loaded into internal solver structures.
|
protected |
The RHS vector/multi-vector.
We point to a const Vector because Amesos2 should never directly modify B.
Referenced by Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::getB(), Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::getBRaw(), and Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setB().