1SGTSVX(1) LAPACK routine (version 3.1) SGTSVX(1)
2
3
4
6 SGTSVX - the LU factorization to compute the solution to a real system
7 of linear equations A * X = B or A**T * X = B,
8
10 SUBROUTINE SGTSVX( FACT, TRANS, N, NRHS, DL, D, DU, DLF, DF, DUF, DU2,
11 IPIV, B, LDB, X, LDX, RCOND, FERR, BERR, WORK,
12 IWORK, INFO )
13
14 CHARACTER FACT, TRANS
15
16 INTEGER INFO, LDB, LDX, N, NRHS
17
18 REAL RCOND
19
20 INTEGER IPIV( * ), IWORK( * )
21
22 REAL B( LDB, * ), BERR( * ), D( * ), DF( * ), DL( * ),
23 DLF( * ), DU( * ), DU2( * ), DUF( * ), FERR( * ),
24 WORK( * ), X( LDX, * )
25
27 SGTSVX uses the LU factorization to compute the solution to a real sys‐
28 tem of linear equations A * X = B or A**T * X = B, where A is a tridi‐
29 agonal matrix of order N and X and B are N-by-NRHS matrices.
30
31 Error bounds on the solution and a condition estimate are also pro‐
32 vided.
33
34
36 The following steps are performed:
37
38 1. If FACT = 'N', the LU decomposition is used to factor the matrix A
39 as A = L * U, where L is a product of permutation and unit lower
40 bidiagonal matrices and U is upper triangular with nonzeros in
41 only the main diagonal and first two superdiagonals.
42
43 2. If some U(i,i)=0, so that U is exactly singular, then the routine
44 returns with INFO = i. Otherwise, the factored form of A is used
45 to estimate the condition number of the matrix A. If the
46 reciprocal of the condition number is less than machine precision,
47 INFO = N+1 is returned as a warning, but the routine still goes on
48 to solve for X and compute error bounds as described below.
49
50 3. The system of equations is solved for X using the factored form
51 of A.
52
53 4. Iterative refinement is applied to improve the computed solution
54 matrix and calculate error bounds and backward error estimates
55 for it.
56
57
59 FACT (input) CHARACTER*1
60 Specifies whether or not the factored form of A has been sup‐
61 plied on entry. = 'F': DLF, DF, DUF, DU2, and IPIV contain
62 the factored form of A; DL, D, DU, DLF, DF, DUF, DU2 and IPIV
63 will not be modified. = 'N': The matrix will be copied to
64 DLF, DF, and DUF and factored.
65
66 TRANS (input) CHARACTER*1
67 Specifies the form of the system of equations:
68 = 'N': A * X = B (No transpose)
69 = 'T': A**T * X = B (Transpose)
70 = 'C': A**H * X = B (Conjugate transpose = Transpose)
71
72 N (input) INTEGER
73 The order of the matrix A. N >= 0.
74
75 NRHS (input) INTEGER
76 The number of right hand sides, i.e., the number of columns of
77 the matrix B. NRHS >= 0.
78
79 DL (input) REAL array, dimension (N-1)
80 The (n-1) subdiagonal elements of A.
81
82 D (input) REAL array, dimension (N)
83 The n diagonal elements of A.
84
85 DU (input) REAL array, dimension (N-1)
86 The (n-1) superdiagonal elements of A.
87
88 DLF (input or output) REAL array, dimension (N-1)
89 If FACT = 'F', then DLF is an input argument and on entry con‐
90 tains the (n-1) multipliers that define the matrix L from the
91 LU factorization of A as computed by SGTTRF.
92
93 If FACT = 'N', then DLF is an output argument and on exit con‐
94 tains the (n-1) multipliers that define the matrix L from the
95 LU factorization of A.
96
97 DF (input or output) REAL array, dimension (N)
98 If FACT = 'F', then DF is an input argument and on entry con‐
99 tains the n diagonal elements of the upper triangular matrix U
100 from the LU factorization of A.
101
102 If FACT = 'N', then DF is an output argument and on exit con‐
103 tains the n diagonal elements of the upper triangular matrix U
104 from the LU factorization of A.
105
106 DUF (input or output) REAL array, dimension (N-1)
107 If FACT = 'F', then DUF is an input argument and on entry con‐
108 tains the (n-1) elements of the first superdiagonal of U.
109
110 If FACT = 'N', then DUF is an output argument and on exit con‐
111 tains the (n-1) elements of the first superdiagonal of U.
112
113 DU2 (input or output) REAL array, dimension (N-2)
114 If FACT = 'F', then DU2 is an input argument and on entry con‐
115 tains the (n-2) elements of the second superdiagonal of U.
116
117 If FACT = 'N', then DU2 is an output argument and on exit con‐
118 tains the (n-2) elements of the second superdiagonal of U.
119
120 IPIV (input or output) INTEGER array, dimension (N)
121 If FACT = 'F', then IPIV is an input argument and on entry con‐
122 tains the pivot indices from the LU factorization of A as com‐
123 puted by SGTTRF.
124
125 If FACT = 'N', then IPIV is an output argument and on exit con‐
126 tains the pivot indices from the LU factorization of A; row i
127 of the matrix was interchanged with row IPIV(i). IPIV(i) will
128 always be either i or i+1; IPIV(i) = i indicates a row inter‐
129 change was not required.
130
131 B (input) REAL array, dimension (LDB,NRHS)
132 The N-by-NRHS right hand side matrix B.
133
134 LDB (input) INTEGER
135 The leading dimension of the array B. LDB >= max(1,N).
136
137 X (output) REAL array, dimension (LDX,NRHS)
138 If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X.
139
140 LDX (input) INTEGER
141 The leading dimension of the array X. LDX >= max(1,N).
142
143 RCOND (output) REAL
144 The estimate of the reciprocal condition number of the matrix
145 A. If RCOND is less than the machine precision (in particular,
146 if RCOND = 0), the matrix is singular to working precision.
147 This condition is indicated by a return code of INFO > 0.
148
149 FERR (output) REAL array, dimension (NRHS)
150 The estimated forward error bound for each solution vector X(j)
151 (the j-th column of the solution matrix X). If XTRUE is the
152 true solution corresponding to X(j), FERR(j) is an estimated
153 upper bound for the magnitude of the largest element in (X(j) -
154 XTRUE) divided by the magnitude of the largest element in X(j).
155 The estimate is as reliable as the estimate for RCOND, and is
156 almost always a slight overestimate of the true error.
157
158 BERR (output) REAL array, dimension (NRHS)
159 The componentwise relative backward error of each solution vec‐
160 tor X(j) (i.e., the smallest relative change in any element of
161 A or B that makes X(j) an exact solution).
162
163 WORK (workspace) REAL array, dimension (3*N)
164
165 IWORK (workspace) INTEGER array, dimension (N)
166
167 INFO (output) INTEGER
168 = 0: successful exit
169 < 0: if INFO = -i, the i-th argument had an illegal value
170 > 0: if INFO = i, and i is
171 <= N: U(i,i) is exactly zero. The factorization has not been
172 completed unless i = N, but the factor U is exactly singular,
173 so the solution and error bounds could not be computed. RCOND
174 = 0 is returned. = N+1: U is nonsingular, but RCOND is less
175 than machine precision, meaning that the matrix is singular to
176 working precision. Nevertheless, the solution and error bounds
177 are computed because there are a number of situations where the
178 computed solution can be more accurate than the value of RCOND
179 would suggest.
180
181
182
183 LAPACK routine (version 3.1) November 2006 SGTSVX(1)