Amesos2 - Direct Sparse Solver Interfaces Version of the Day
Amesos2_Factory.hpp File Reference

Contains declarations for Amesos2::create and Amesos2::query. More...

#include "Amesos2_config.h"
#include "Teuchos_CompilerCodeTweakMacros.hpp"
#include "Amesos2_Solver.hpp"
#include "Amesos2_SolverTraits.hpp"
#include "Teuchos_ScalarTraits.hpp"
#include "Amesos2_MultiVecAdapter.hpp"
#include "Amesos2_MatrixTraits.hpp"
#include "Amesos2_ctassert.hpp"
#include "Amesos2_KLU2.hpp"
#include "Amesos2_Superludist.hpp"
#include "Amesos2_Superlumt.hpp"
#include "Amesos2_Superlu.hpp"
Include dependency graph for Amesos2_Factory.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Amesos2::throw_no_scalar_support_exception< ConcreteSolver, Matrix, Vector >
struct  Amesos2::handle_solver_scalar_type_support< ConcreteSolver, Matrix, Vector >
struct  Amesos2::handle_solver_matrix_and_type_support< ConcreteSolver, Matrix, Vector >

Functions

std::string Amesos2::tolower (const std::string &s)
template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create (const Matrix *A, Vector *X, const Vector *B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create (Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create (const char *solverName, const Matrix *A, Vector *X, const Vector *B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create (const char *solverName, const Teuchos::RCP< const Matrix > A, const Teuchos::RCP< Vector > X, const Teuchos::RCP< const Vector > B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create (const std::string &solverName, const Matrix *A, Vector *X, const Vector *B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create (const std::string &solverName, const Teuchos::RCP< const Matrix > A, const Teuchos::RCP< Vector > X, const Teuchos::RCP< const Vector > B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.
template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create (const std::string &solverName, const Matrix *A)
 Creates an Amesos2 Solver interface with Matrix A.
template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create (const std::string &solverName, const Teuchos::RCP< const Matrix > A)
 Creates an Amesos2 Solver interface with Matrix A.
bool Amesos2::query (const char *solverName)
 Queries the Factory for support of the named third-party library.
bool Amesos2::query (const std::string &solverName)
 Queries the Factory for support of the named third-party library.
template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create (Matrix *A, Vector *X, Vector *B)
template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create (const std::string &solverName, const Matrix *A, Vector *X, const Vector *B)
 Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Detailed Description

Contains declarations for Amesos2::create and Amesos2::query.

Author
Eric Bavier etbav.nosp@m.ie@s.nosp@m.andia.nosp@m..gov
Date
Tue Jun 7 16:25:16 2011

Amesos2 defines the nonmember factory method Amesos2::create for creating instances of Amesos2 solvers. If a users asks Amesos2::create to create a solver with a matrix whose scalar type is not supported by that solver, then a runtime std::invalid_argument exception will be thrown.

The Amesos2::query function can be used to ask Amesos2 at runtime whether a particular solver is supported.

Attention
Users should favor these factory methods for creating Amesos2 solver instances over explicitly instantiating their own.
Note
A solver's third-party library must be enabled in the Trilinos build, and Amesos2 must be also told to enable it. Put Amesos2_ENABLE_SOLVERNAME:BOOL=ON in your Trilinos configuration script to do this, where SOLVERNAME is the name of the solver you would like to enable.

Example Usage

typedef Tpetra::CrsMatrix<double,int> MAT;
typedef Tpetra::MultiVector<double,int> VEC;
// ... Create A of type RCP<MAT>, and X and B of type RCP<VEC> ...
RCP<Amesos2::Solver<MAT,VEC> > solver = Amesos2::create<MAT,VEC>("SuperLU", A, X, B);
Solver< Matrix, Vector > * create(const Matrix *A, Vector *X, const Vector *B)
Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Function Documentation

◆ create() [1/9]

template<class Matrix, class Vector>
Solver< Matrix, Vector > * create ( const Matrix * A,
Vector * X,
const Vector * B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

This is the default option which interfaces with the native KLU2 solver.

Parameters
[in]Apointer to a matrix of coefficients
[in]Xpointer to LHS solution vector
[in]Bpointer to RHS vector
Returns
A C pointer to a KLU2 solver interface.

◆ create() [2/9]

template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create ( Teuchos::RCP< const Matrix > A,
Teuchos::RCP< Vector > X,
Teuchos::RCP< const Vector > B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

This is the default option which interfaces with the native KLU2 solver.

Parameters
[in]ATeuchos::RCP to the coefficient matrix
[in]XTeuchos::RCP to LHS solution vector
[in]BTeuchos::RCP to RHS vector
Returns
A Teuchos::RCP to a KLU2 solver interface.

◆ create() [3/9]

template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create ( const char * solverName,
const Matrix * A,
Vector * X,
const Vector * B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Parameters
[in]solverNameA C character string with the name of the underlying third-party solver desired.
[in]Apointer to a matrix of coefficients
[in]Xpointer to LHS solution vector
[in]Bpointer to RHS vector
Returns
A C pointer to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ create() [4/9]

template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create ( const char * solverName,
const Teuchos::RCP< const Matrix > A,
const Teuchos::RCP< Vector > X,
const Teuchos::RCP< const Vector > B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]ATeuchos::RCP to the coefficient matrix
[in]XTeuchos::RCP to LHS solution vector
[in]BTeuchos::RCP to RHS vector
Returns
A Teuchos::RCP to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ create() [5/9]

template<class Matrix, class Vector>
Solver< Matrix, Vector > * create ( const std::string & solverName,
const Matrix * A,
Vector * X,
const Vector * B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]AC pointer to the coefficient matrix
[in]XC pointer to LHS solution vector
[in]BC pointer to RHS vector
Returns
A C pointer to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ create() [6/9]

template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create ( const std::string & solverName,
const Teuchos::RCP< const Matrix > A,
const Teuchos::RCP< Vector > X,
const Teuchos::RCP< const Vector > B )
related

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]ATeuchos::RCP to the coefficient matrix
[in]XTeuchos::RCP to LHS solution vector
[in]BTeuchos::RCP to RHS vector
Returns
A Teuchos::RCP to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ create() [7/9]

template<class Matrix, class Vector>
Solver< Matrix, Vector > * Amesos2::create ( const std::string & solverName,
const Matrix * A )
related

Creates an Amesos2 Solver interface with Matrix A.

Suitable for cases where numeric factorization must be performed before the X and B vectors are known. Before a solve, the setX() and setB() functions should be used to set X and B, or the overloaded solve(X,B) method should be used.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]AC pointer to the coefficient matrix
Returns
A C pointer to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ create() [8/9]

template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create ( const std::string & solverName,
const Teuchos::RCP< const Matrix > A )
related

Creates an Amesos2 Solver interface with Matrix A.

Suitable for cases where numeric factorization must be performed before the X and B vectors are known. Before a solve, the setX() and setB() functions should be used to set X and B, or the overloaded solve(X,B) method should be used.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]ATeuchos::RCP to the coefficient matrix
Returns
A Teuchos::RCP to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.

◆ query() [1/2]

bool query ( const char * solverName)
related

Queries the Factory for support of the named third-party library.

Returns
true if the solver is supported.

◆ query() [2/2]

bool query ( const std::string & solverName)
related

Queries the Factory for support of the named third-party library.

Returns
true if the solver is supported.

◆ create() [9/9]

template<class Matrix, class Vector>
Teuchos::RCP< Solver< Matrix, Vector > > Amesos2::create ( const std::string & solverName,
const Matrix * A,
Vector * X,
const Vector * B )

Creates an Amesos2 Solver interface with Matrix A, LHS vector X, and RHS vector B.

Parameters
[in]solverNameThe name of the desired third-party solver
[in]AC pointer to the coefficient matrix
[in]XC pointer to LHS solution vector
[in]BC pointer to RHS vector
Returns
A C pointer to an Amesos2 solver interface.
Exceptions
std::invalid_argumentThe third-party solver named by solverName is not supported.