maspack.solvers
Interface DirectSolver

All Known Implementing Classes:
MatlabSolver, PardisoSolver, UmfpackSolver

public interface DirectSolver


Method Summary
 void analyze(Matrix M, int size, int type)
          Performs prefactor analysis on a specified matrix.
 void analyzeAndFactor(Matrix M)
          Factors a matrix.
 void autoFactorAndSolve(VectorNd x, VectorNd b, int tolExp)
          Factors a previously analyzed matrix M and then solves the system
 void dispose()
          Releases all internal resources allocated by this solver.
 void factor()
          Factors a previously analyzed matrix.
 boolean hasAutoIterativeSolving()
          Returns true if this solver supports automatic iterative solving using a recent directly-factored matrix as a preconditioner.
 void solve(VectorNd x, VectorNd b)
          Solves the system
 

Method Detail

analyze

void analyze(Matrix M,
             int size,
             int type)
Performs prefactor analysis on a specified matrix. The matrix reference is stored and used by later calls to factor(). If size is less than the actual matrix size, then the analysis is done on the principal submatrix of M defined by the first size rows and columns.

Parameters:
M - matrix to analyze
size - size of the matrix to factor.
type - or-ed flags giving information about the matrix type. Typical flags are SYMMETRIC or POSITIVE_DEFINITE
Throws:
java.lang.IllegalArgumentException - if the matrix is not square, or the matrix type is not supported by the solver.
NumericException - if the analysis failed for numeric reasons.

factor

void factor()
Factors a previously analyzed matrix.

Throws:
java.lang.IllegalStateException - if no previous call to analyze has been made.
NumericException - if the factor failed for numeric reasons.

analyzeAndFactor

void analyzeAndFactor(Matrix M)
Factors a matrix. This is equivalent to the two calls
   analyze (M, M.rowSize(), 0)
   factor()
 

Parameters:
M - matrix to factor
Throws:
java.lang.IllegalArgumentException - if the matrix is not square, or general matrices are not supported by the solver.
NumericException - if the analysis or factoring failed for numeric reasons.

solve

void solve(VectorNd x,
           VectorNd b)
Solves the system
  M x = b
 
where M was specified using previous calls to analyze or factor.

Parameters:
x - vector in which result is returned
b - right hand vector of matrix equation
Throws:
java.lang.IllegalStateException - if no previous call to analyze or factor has been made.
NumericException - if the solve failed for numeric reasons.

autoFactorAndSolve

void autoFactorAndSolve(VectorNd x,
                        VectorNd b,
                        int tolExp)
Factors a previously analyzed matrix M and then solves the system
 M x = b
 
This is equivalent to
 factor()
 solve (x, b) 
 
but is included because it may be faster depending on the underlying implementation. If auto-iterative solving is available (as determined by hasAutoIterativeSolving), this method also allows the solver to automatically employ iterative solving using a recent direct factorization as a preconditioner. To enable auto-iterative solving, the argument tolExp should be set to a positive value giving the (negative) exponent of the desired relative residual.

Parameters:
x - vector in which result is returned
b - right hand vector of matrix equation
tolExp - if positive, enables auto-iterative solving with the specified value giving the (negative) exponent of the desired relative residual.
Throws:
NumericException - if the factoring or solving failed for numeric reasons

hasAutoIterativeSolving

boolean hasAutoIterativeSolving()
Returns true if this solver supports automatic iterative solving using a recent directly-factored matrix as a preconditioner. If this feature is available, it may be invoked using the autoFactorAndSolve method.

Returns:
true if auto-iterative solving is available

dispose

void dispose()
Releases all internal resources allocated by this solver.