CHSOL Function

Solves a symmetric positive definite system of real or complex linear equations Ax = b.

Usage

result = CHSOL(b[, a])

Input Parameters

b—One-dimensional matrix containing the right-hand side.

a—Two-dimensional matrix containing the coefficient matrix. Matrix A (i, j) contains the jth coefficient of the ith equation.

Returned Value

result—The solution of the linear system Ax = b.

Input Keywords

Double—If present and nonzero, double precision is used.

Output Keywords

Factor—Specifies a named variable in which the LLH factorization of A is stored. The lower-triangular part of this matrix contains L, and the upper-triangular part contains LH. Keywords Condition and Factor cannot be used together.

Condition—Specifies a named variable into which an estimate of the L1 condition number is stored. This keyword cannot be used with Factor. Keywords Condition and Factor cannot be used together.

Inverse—Specifies a named variable into which the inverse of the matrix A is stored. This keyword is not allowed if A is complex.

Discussion

Function CHSOL solves a system of linear algebraic equations having a symmetric positive definite coefficient matrix A. The function first computes the Cholesky factorization LLH of A. The solution of the linear system is found by solving the two simpler systems, y = L–1b and x = LHy. An estimate of the L1 condition number of A is computed using the same algorithm as in Dongarra et al. (1979). If the estimated condition number is greater than 1/e (where e is the machine precision), a warning message is issued. This indicates that very small changes in A may produce large changes in the solution x.

Function CHSOL fails if L, the lower-triangular matrix in the factorization, has a zero diagonal element.

Example 1

; Define the coefficient matrix.
RM, a, 3, 3
row 0:  1  -3  2
row 1: -3  10 -5
row 2:  2  -5  6
; Define the right-hand side.
RM, b, 3, 1
row 0:  27
row 1: -78
row 2:  64
; Call CHSOL to compute the solution.
x = CHSOL(b, a)
PM, x, Title = 'Solution'
; PV-WAVE prints the following:
; Solution
; 1.00000
; -4.00000
; 7.00000
PM, a # x - b, Title = 'Residual'
; PV-WAVE prints the following:
; Residual
; 0.00000
; 0.00000
; 0.00000

Example 2

In this example, a system of five linear equations with Hermitian positive definite coefficient matrix is solved. The equations are as follows:

2x0 + (–1 + i ) x1 = 1 + 5i

(–1 – i ) x0 + 4x1 + (1 + 2i ) x2 = 12 – 6i

(–1 – 2i ) x1 + 10x2 + 4ix3 = 1 + (–16i )

(–4ix2) + 6x3 + (i + 1)x4 = –3 –3i

(1 – i ) x3 + 9x4 = 25 + 16i

; Input the complex matrix A.
RM, a, 5, 5, /Complex
row 0: 2       (-1,1) 0      0      0
row 1: (-1,-1) 4      (1,2)  0      0
row 2: 0       (1,-2) 10     (0,4)  0
row 3: 0       0      (0,-4) 6      (1,1)
row 4: 0       0      0      (1,-1) 9
; Input the right-hand side.
RM, b, 5, 1, /Complex
row 0: (1, 5)
row 1: (12, -6)
row 2: (1, -16)
row 3: (-3, -3)
row 4: (25, 16)
; Compute the solution.
x = CHSOL(b, a)
; Output the results.
PM, x, Title = 'Solution', Format = '('(',f8.5,',',f8.5,')')'
; PV-WAVE prints the following: 
; Solution
; ( 2.00000, 1.00000)
; ( 3.00000,-0.00000)
; (-1.00000,-1.00000)
; ( 0.00000,-2.00000)
; ( 3.00000, 2.00000)
PM, a # x-b, Title = 'Residual', Format='('(',f8.5,',',f8.5,')')'
; PV-WAVE prints the following: 
; Residual
; ( 0.00000, 0.00000)
; ( 0.00000,-0.00000)
; ( 0.00000, 0.00000)
; ( 0.00000, 0.00000)
; ( 0.00000, 0.00000)

Warning Errors

MATH_ILL_CONDITIONED—Input matrix is too ill-conditioned. An estimate of the reciprocal of its L1 condition number is #. The solution might not be accurate.

Fatal Errors

MATH_NONPOSITIVE_MATRIX—Leading # by # submatrix of the input matrix is not positive definite.

MATH_SINGULAR_MATRIX—Input matrix is singular.

MATH_SINGULAR_TRI_MATRIX—Input triangular matrix is singular. The index of the first zero diagonal element is #.