CALL SOLVELIN
(x, status, A, b, method) ;
The SOLVELIN subroutine uses direct decomposition to solve sparse symmetric linear systems.
The SOLVELIN subroutine returns the following values:
is the solution to .
is the final status of the solution.
The input arguments to the SOLVELIN subroutine are as follows:
is the sparse coefficient matrix in the equation . You can use SPARSE function to convert a matrix from dense to sparse storage.
is the right side of the equation .
is the name of the decomposition to be used.
The input matrix represents the coefficient matrix in sparse format; it is an by 3 matrix, where is the number of nonzero elements. The first column contains the nonzero values, while the second and third columns contain the row and column locations for the nonzero elements, respectively. Since is assumed to be symmetric, only the elements on and below the diagonal should be specified, and it is an error to specify elements above the diagonal.
The solution to the system is returned in . Your program should also check the returned to make sure that a solution was found.
indicates success.
indicates the matrix A is not positive-definite.
indicates the system ran out of memory.
If the SOLVELIN subroutine is unable to solve your system, you can try the iterative method subroutine ITSOLVER.
Two different factorization methods are available from the call, Cholesky and Symbolic LDL, specified as ’CHOL’ or ’LDL’ with the parameter. Both these factorizations are applicable only to positive-definite symmetric systems; if your system is not positive-definite or not symmetric, you can use an ITSOLVER call.
The following example uses SOLVELIN to solve the system:
|
/* value row column */ A = { 3 1 1, 1.1 2 1, 4 2 2, 1 3 2, 3.2 4 2, 10 3 3, 3 4 4}; /* right hand side */ b = {1, 1, 1, 1}; call solvelin(x, status, A, b, 'LDL'); print status x;
Figure 23.322: Solving a Sparse Linear System
status | x |
---|---|
0 | 2.68 |
-6.4 | |
0.74 | |
7.16 |