Amesos_BaseSolver Class Reference

Amesos_BaseSolver: A pure virtual class for direct solution of real-valued double-precision operators. More...

#include <Amesos_BaseSolver.h>

Inheritance diagram for Amesos_BaseSolver:

[legend]
List of all members.

Public Member Functions

Destructor.
virtual ~Amesos_BaseSolver ()
 Destructor.
Atribute set methods.
virtual int SetUseTranspose (bool UseTranspose)=0
 If set true, X will be set to the solution of AT X = B (not A X = B).
virtual int SetParameters (Teuchos::ParameterList &ParameterList)=0
 Updates internal variables.
Mathematical functions.
virtual int SymbolicFactorization ()=0
 Performs SymbolicFactorization on the matrix A.
virtual int NumericFactorization ()=0
 Performs NumericFactorization on the matrix A.
virtual int Solve ()=0
 Solves A X = B (or AT x = B).
Atribute access functions
virtual const Epetra_LinearProblemGetProblem () const =0
 Returns the Epetra_LinearProblem.
virtual bool MatrixShapeOK () const =0
 Returns true if the solver can handle this matrix shape.
virtual bool UseTranspose () const =0
 Returns the current UseTranspose setting.
virtual const Epetra_CommComm () const =0
 Returns a pointer to the Epetra_Comm communicator associated with this operator.

Detailed Description

Amesos_BaseSolver: A pure virtual class for direct solution of real-valued double-precision operators.

The Amesos_BaseSolver class is a pure virtual class (specifies interface only) that enables the use of real-valued double-precision direct sparse solvers. Every Amesos class named Amesos_SolverName implements Amesos_BaseSolver.

Usage Examples

Basic calling sequence

The basic calling sequence solves A x = b or AT x = b without specifying how A has changed between each call to Solve().

    Epetra_LinearProblem Problem(A,X,B);
    Amesos_SolverName Solver(Problem);
    Problem.SetTranspose( false ); 
    while( ... ) {

      Code which may change A or B

   Solver.SymbolicFactorization() ; 
   Solver.NumericFactorization() ; 
   Solver.Solve() ; 

Re-using the symbolic factorization

The following calling sequence performs multiple solves of A x = b or AT x = b in cases where the non-zero structure of A remains unchanged between each call to Solve().

    Epetra_LinearProblem Problem(A,X,B);
    Amesos_SolverName Solver(Problem);
    Problem.SetTranspose( false ); 
    Solver.SymbolicFactorization() ; 
    while( ... ) {

      Code which may change B or the non-zero values 
      (but not the non-zero structure) of A

    Solver.NumericFactorization() ; 
    Solver.Solve() ; 

Re-using the numeric factorization

The following calling sequence performs multiple solves of A x = b or AT x = b provided that A remains unchanged between each call to Solve().

    Epetra_LinearProblem Problem(A,X,B);
    Amesos_SolverName Solver(Problem);
    Problem.SetTranspose( false ); 
    Solver.NumericFactorization() ; 
    while( ... ) {

      Code which may change B but not A

    Solver.Solve() ; 

Constructor requirements

Every Amesos_SolverName class should accept an Epetra_LinearProblem

Mathematical methods

Three mathematical methods are defined in the base class Amesos_BaseSolver: SymbolicFactorization(), NumericFactorization() and Solve(). A call to NumericFactorization() without a previous call to SymbolicFactorization() will perform both numeric and symbolic Factorization. A call to Solve() without a previous call to NumericFactorization() will perform both a numeric factorization (including a symbolic factorization if necessary) and a solve.

Switching concrete classes

Different concrete classes, each based on a different third party solver, will have different performance characteristics and will accept different parameters.

Changing the underlying matrix operator.

In the basic calling sequence (no calls to SymbolicFactorization() or NumericFactorization()), the underlying matrix can be modified between any two calls to Solve() - any class implementing this interface must perform the solve based on the values in the matrix at the time that Solve() is called.

Once SymbolicFactorization() has been called, classes implementing this interface may assume that any change made to the non-zero structure of the underlying matrix will be accompanied by a call to SymbolicFactorization() prior to a subsequent call to NumericFactorization or Solve().

Named Parameters

Parameters can be changed or added at any time by calling SetParameters(ParamList) with the new parameters specified in ParamList.

It is left to the user to be sure that changes made to the parameters are appropriate for the concrete class that they are using.

Examples of appropriate changes in parameters include:

Examples of inappropriate changes in parameters include:

Results of making inappropriate changes in parameters is unpredictable and could include an error return, a bogus result or ignoring the parameter change.

Transpose solve

Any class implementing Amesos_BaseSolver should handle calls to SetTranspose() at any point. Some third party libraries are able to solve AT x = b and Ax = b using the same factorization. Others will require a new factorization anytime that a call to SetTranspose() changes the intended solve from AT x = b to Ax = b or vice-versa.

Performance expectations

The following is a list of performance guidelines that classes which implement the Amesos_BaseSolver class are expected to maintain.

Memory usage:

For serial codes, no more than one extra copy of the original matrix should be required. Except that some codes require matrix transpostion which requires additional copies of the input matrix.

For distributed memory codes, no serial copies of the original matrix should be required.

Communication:

Communication should be kept to a minimum, storing data on the process where it will be used where possible.

Computation:

Theta(n) compuational requirements (i.e. those which grow at least linearly with the number of rows in the matrix) should not be repeated unnecessarily. Constant order, i.e. O(1), computational tasks may be repeated.

Robustness requirements

Failures should be caught either by EPETRA_CHK_ERR() or through calls to assert.

Because we do not check to see if a matrix has changed between the call to SymbolicFactorization() and the call to NumericFactorization(), it is possible that a change to the matrix will cause a potentially catastrophic error.

Adding concrete classes which implement the Amesos_BaseSolver class

See amesos/configuration for a list of files added or modified to create the Amesos_Umfpack concrete class.


Member Function Documentation

virtual bool Amesos_BaseSolver::MatrixShapeOK  )  const [pure virtual]
 

Returns true if the solver can handle this matrix shape.

Returns true if the matrix shape is one that the underlying 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 whould return false for non-symmetric matrices.

Implemented in Amesos_Dscpack, Amesos_EpetraBaseSolver, Amesos_Klu, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.

virtual int Amesos_BaseSolver::NumericFactorization  )  [pure virtual]
 

Performs NumericFactorization on the matrix A.

In addition to performing numeric factorization (and symbolic factorization if necessary) on the matrix A, the call to NumericFactorization() implies that no change will be made to the underlying matrix without a subsequent call to NumericFactorization().

<br >Preconditions:

<br >Postconditions:

  • Numeric Factorization will be performed (or marked to be performed) allowing Solve() to be performed correctly despite a potential change in in the matrix values (though not in the non-zero structure).

Returns:
Integer error code, set to 0 if successful.

Implemented in Amesos_Dscpack, Amesos_Klu, Amesos_Mumps, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.

virtual int Amesos_BaseSolver::SetParameters Teuchos::ParameterList ParameterList  )  [pure virtual]
 

Updates internal variables.

<br >Preconditions:

  • None.

<br >Postconditions:

  • Internal variables controlling the factorization and solve will be updated and take effect on all subseuent calls to NumericFactorization() and Solve().
  • All parameters whose value are to differ from the default values must be included in ParameterList. Parameters not specified in ParameterList revert to their default values.

Returns:
Integer error code, set to 0 if successful.

Implemented in Amesos_Dscpack, Amesos_Klu, Amesos_Mumps, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.

virtual int Amesos_BaseSolver::SetUseTranspose bool  UseTranspose  )  [pure virtual]
 

If set true, X will be set to the solution of AT X = B (not A X = B).

If the implementation of this interface does not support transpose use, this method should return a value of -1.

<br >Preconditions:

<br >Postconditions:

  • The next factorization and solve will be performed with the new value of UseTranspose.

Parameters:
In UseTranspose -If true, solve AT X = B, otherwise solve A X = B.
Returns:
Integer error code, set to 0 if successful. Set to -1 if this implementation does not support transpose.

Implemented in Amesos_Dscpack, Amesos_Klu, Amesos_Mumps, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.

virtual int Amesos_BaseSolver::Solve  )  [pure virtual]
 

Solves A X = B (or AT x = B).

<br >Preconditions:

<br >Postconditions:

  • X will be set such that A X = B (or AT X = B), within the limits of the accuracy of the underlying solver.

Returns:
Integer error code, set to 0 if successful.

Implemented in Amesos_Dscpack, Amesos_Klu, Amesos_Mumps, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.

virtual int Amesos_BaseSolver::SymbolicFactorization  )  [pure virtual]
 

Performs SymbolicFactorization 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().

<br >Preconditions:

<br >Postconditions:

Returns:
Integer error code, set to 0 if successful.

Implemented in Amesos_Dscpack, Amesos_Klu, Amesos_Mumps, Amesos_Scalapack, Amesos_Superlu, Amesos_Superludist, and Amesos_Umfpack.


The documentation for this class was generated from the following file:
Generated on Thu Sep 18 12:42:57 2008 for Amesos by doxygen 1.3.9.1