SGI Techpubs Library

Linux  »  Books  »  End-User  »  
SCSL User's Guide
(document number: 007-4325-001 / published: 2003-12-30)    table of contents  |  additional info  |  download
find in page | jump to first hit | clear highlight

Chapter 4. Using Sparse Linear Equation Solvers

Many techniques exist for solving sparse linear systems. The appropriate technique depends on many factors, including the mathematical and structural properties of matrix A, the dimension of A, and the number of right-hand sides b.

SGI provides two direct solvers, PSLDLT and PSLDU, and one iterative solver, DITERATIVE, for sparse linear systems of equations. These solvers are optimized and parallelized for SGI platforms.

Direct solvers of dense linear systems of equations are described on the INTRO_LAPACK(3s) man page.

This section describes some of the properties that are useful in determining a good solution technique, with some common sources of matrices with these properties.

Sparse Matrices

A linear system can be described as , where A is an n-by-n matrix, and x and b are n dimensional vectors. A system of this kind is considered sparse if the matrix A has a small percentage of nonzero terms (less than 10%, often less than 1%). Large sparse linear systems occur frequently in engineering and scientific applications, and the solution of these systems (finding x given A and b) is an important and costly step.

If matrix A has a regular pattern, such as a banded or block structure, good performance can easily be obtained when solving the linear system. Good performance is much more difficult to obtain in problems in which A has no discernible pattern. The goal of the routines described in this section is to solve sparse linear systems efficiently, especially those where matrix A has no known regular pattern.

The following list defines the different types of sparse matrices:

  • symmetric positive definite matrix: A matrix A is symmetric if (that is, if the coefficients of A are such that for all i and j).

    A matrix A is defined to be symmetric positive definite (SPD) if A is symmetric and for all vectors . It is usually difficult to directly verify that a matrix is SPD; however, it can often be determined by considering the problem source. For example, many finite difference or finite volume approximations of partial differential equations (PDEs) with Dirichlet or mixed boundary conditions and other mild assumptions generate SPD matrices. Also, finite element approximations with a symmetric bilinear form and equivalent test and basis functions generate SPD matrices.

    SPD matrices occur frequently in applications. Optimal techniques exist to solve the related linear systems. Common sources of SPD matrices are finite element analysis of structures, the pressure correction phase of a segregated fluid dynamics simulation, and the analysis of electrical networks.

  • Diagonally dominant matrix: A matrix A is (strictly) diagonally dominant if for all i. If A is diagonally dominant, operations that involve A are often numerically stable. Common sources of diagonally-dominant matrices are simple reservoir simulation models and the velocity equations of a segregated fluid dynamics solver.

  • Structurally symmetric matrix: If the nonzero pattern of A is symmetric, a matrix A is structurally symmetric ; that is, if and only if . The integer complexity of a solver for a structurally symmetric matrix is greatly reduced compared to a more general solver. If A is diagonally dominant, many of the optimal solution techniques for SPD matrices can be used. Common sources of these matrices are the same as those for diagonally dominant matrices.

  • Banded matrix: If for , matrix A is banded. If k is small in relation to the problem dimension n, special techniques exist for solving the related linear systems. Systems of this form usually occur in special domains with a particular ordering of the grid or node points.

  • Tridiagonal matrix: If for , matrix A is tridiagonal. Tridiagonal matrices occur frequently in fluid dynamics and reservoir simulation.

During a simulation, an application often generates many sparse linear systems that must be solved. These are usually related to some linear approximation of a nonlinear function or some time-marching scheme for a time-dependent problem. In these cases, the linear systems are often related and information from the previous solution can be used to solve the next linear system.

For example, consider Newton's method for a nonlinear PDE. In this case, the linear system is generated by evaluating the Jacobian at a certain point. A subsequent matrix, , is generated using the Jacobian at a nearby point. Thus, the two matrices and are close to each other, and this fact is used in the solver technique. The structure of and is usually identical and all structural preprocessing can be done once for all related matrices.

Solution Techniques

Solution techniques for sparse linear systems can usually be divided into two broad classes: direct methods and iterative methods. The following subsections provide an overview of both classes and provide brief algorithmic descriptions.

Direct Methods

The DPSLDLT and ZPSLDLT routines solve sparse symmetric linear systems of the form AX=b where A is a symmetric input matrix, b is an input vector of length n, and x is a vector of unknowns of length n. This solver uses a direct method. A is factored into A = L D LT where L is a lower triangular matrix with unit diagonal and D is a diagonal matrix.

This solver supports both real and complex double precision data types and is available in the multi-processing versions of SCSL. See the man pages for details.

DPSLDU and ZPSLDU solve sparse unsymmetric linear systems of the form Ax=b where A is an input matrix with symmetric non-zero pattern but unsymmetric non-zero values, b is an input vector of length n, and x is a vector of unknowns of length n.

The unsymmetric solver uses a direct method. A is factored into A = L D U where L is a lower triangular matrix with unit diagonal, D is a diagonal matrix, and U is an upper triangular matrix with unit diagonal.

The unsymmetric solver supports both real and complex double precision data types and is available in the multi-processing versions of SCSL. See the man pages for details.

How Direct Solvers Work

Direct solution methods transform matrix A into a product of several other operators so that each of the resulting operators is easy to invert for a given right-hand side b. For example, the LU factorization of A generates lower and upper triangular matrices, L and U, respectively, such that .

To find , compute followed by , both of which are straightforward computations. Direct methods are usually popular because they are considered to be very reliable. This is true if the problem dimension and the condition number of A are not too large. See Matrix Computations , by Golub and Van Loan for details about error bounds.

Direct methods for dense, tridiagonal, and banded matrices are quite straightforward to implement and use the three basic steps of LU factorization as mentioned previously; they may also solve for a given right-hand side without factorization. However, for general sparse matrices, the situation is considerably more complicated; in particular, the factors L and U can become extremely dense. If pivoting is required, implementing sparse factorization can use a lot of time searching lists of numbers and creating a great deal of computational overhead.

Efficient implementations can be developed, especially for SPD and symmetric pattern, positive definite matrices. See Computer Solution of Large Sparse Positive Definite Systems, by George and Liu, for details.

The following algorithm shows the basic steps of the sparse Cholesky solver:

Structural preprocessing phase:

  1. Find P so that has factor L with near minimal fill.

  2. Compute symbolic factorization, that is, find structure of L.

  3. Find optimal memory use and node execution sequence.

    Numerical factorization phase:

  4. Compute L such that .

    Solution phase:

  5. Given b, compute .

In this case, A is SPD, and L and D can be found such that , where L is a lower triangle with unit diagonal, and D is diagonal.

Steps 1 through 3 require only the nonzero structure of A. Therefore, if two matrices and have the same structure, these steps can be skipped for . Furthermore, if the same matrix A is used for more than one right-hand side b, step 5 can be repeated (or if all right-hand sides are available at once, they can be solved for simultaneously).

Iterative Solvers

The DITERATIVE solver solves sparse linear systems of the form Ax=b where A is a sparse input matrix in Compressed Sparse Column (CSC) format or Compressed Sparse Row (CSR) format, b is an input vector of length n, and x is a vector of unknowns in length n.

The iterative solver uses one of four preconditioned iterative methods:

  • conjugate gradient (CG) and conjugate residual (CR) for symmetric systems

  • conjugate gradient squared (CGS) and BiCGSTAB, a variant of CGS with smoother convergence properties, for unsymmetric systems.

Four different types of preconditioners are available:

  • Jacobi

  • symmetric successive over-relaxation (SSOR)

  • ILDLT (incomplete LDLT) by pattern

  • ILDLT by value

The ILDLT preconditioners are only available for symmetric matrices and ILDLT by value is currently not parallelized.

Note that the iterative solver supports only real double precision data. See the ITERATIVE(3s) man page for details.

How Iterative Methods Work

Iterative solution methods comprise a wide variety of techniques. The solvers presented in this subsection are all in the general class of preconditioned conjugate gradient (CG) methods. These methods attempt to solve by solving an equivalent system , where M is some approximation to A which is inexpensive to construct and can be easily used to compute z such that .

This is left preconditioning. It is also possible to apply the preconditioner on the right side of A or on both sides. After the preconditioner is constructed and an initial approximation, to x is given, the iterative method generates a sequence of vectors such that converges to x. Each is chosen to satisfy some orthogonality or minimization condition, or both.

Unlike direct methods, iterative methods are more special-purpose. No general, effective iterative algorithms exist for an arbitrary sparse linear system. However, for certain classes of problems, an appropriate iterative method can be used to yield an approximate solution significantly faster than direct methods. Also, iterative methods usually require less memory than direct methods, thus making them the only feasible approach for large problems. See Matrix Computations, by Golub and Van Loan, for an introduction to these methods.

The standard preconditioned CG method, shown in the following algorithm, illustrates the basic phases common to all CG type methods used in the solvers:

Preprocessing phase:

  1. Compute structure of preconditioner M.

  2. Compute values of preconditioner M.

  3. Analyze structure of A to optimize performance of sparse matrix vector product, .

    Iterative phase:

  4. Do k=0, ...

  5. End Do

Iterative methods are very flexible. Like direct solvers, if two matrices A1 and A2 have the same structure, the structural preprocessing needs to be done only once. If there are multiple right-hand sides, Steps 1 through 3 can be skipped after the first right-hand side.

SCSL User's Guide
(document number: 007-4325-001 / published: 2003-12-30)    table of contents  |  additional info  |  download

    Front Matter
    About This Guide
    Chapter 1. Introduction
    Chapter 2. Basic Linear Algebra Subprogram (BLAS) Routines
    Chapter 3. LAPACK
    Chapter 4. Using Sparse Linear Equation Solvers
    Chapter 5. Signal Processing Routines
    Appendix A. Supported SCSL Routines
    Glossary
    Index


home/search | what's new | help