Amesos2 - Direct Sparse Solver Interfaces Version of the Day
|Amesos2 Solver Framework|
|Amesos2 Solver Interfaces|
|Supported Solver Parameters|
Perhaps the most interesting part of Amesos2 from a user's perspective, but the Amesos2 solver system was designed to be useful for both users and developers. The system can be split into two distinct but inter-related parts: The solver framework, and the solver interfaces.
The Amesos2::Solver class provides a uniform interface to the third-party library solvers. The interface is designed to be both simple to use for novice users, as well as powerful enough for advanced users. While a novice user might like to just give a linear system to Amesos2 and have it just solve it, an expert user might like to control how and when each step of the solution process is performed and do solves for multiple different RHS vectors.
An example of solving a system with Amesos2 using it's most basic interface:
RCP<MAT> A; RCP<MV> X; RCP<MV> B; // initialize A and B RCP<Solver<MAT,MV> > solver = Amesos2::create(A, X, B); // use default solver solver->solve(); // solution placed in X
Here is another more involved example:
RCP<MAT> A; // Get A from somewhere RCP<Solver<MAT,MV> > solver = Amesos2::create("SuperLU", A); Teuchos::ParameterList params("Amesos2"); params.sublist("SuperLU").set("IterRefine","DOUBLE"); params.sublist("SuperLU").set("ColPerm","MMD_AT_PLUS_A"); solver->setParameters(params); solver->symbolicFactorization().numericFactorization(); A = Teuchos::null; // no longer need A solver.setA(Teuchos::null); // tell the solver to release A too RCP<MV> X; RCP<MV> B; // do some other work, finally get B's values solver->solve(X,B); // solution placed in X // do some more work and get new values in B solver->solve(X,B);