 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ ssytrs_aa()

 subroutine ssytrs_aa ( character UPLO, integer N, integer NRHS, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, real, dimension( ldb, * ) B, integer LDB, real, dimension( * ) WORK, integer LWORK, integer INFO )

SSYTRS_AA

Purpose:
``` SSYTRS_AA solves a system of linear equations A*X = B with a real
symmetric matrix A using the factorization A = U**T*T*U or
A = L*T*L**T computed by SSYTRF_AA.```
Parameters
 [in] UPLO ``` UPLO is CHARACTER*1 Specifies whether the details of the factorization are stored as an upper or lower triangular matrix. = 'U': Upper triangular, form is A = U**T*T*U; = 'L': Lower triangular, form is A = L*T*L**T.``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] NRHS ``` NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0.``` [in] A ``` A is REAL array, dimension (LDA,N) Details of factors computed by SSYTRF_AA.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).``` [in] IPIV ``` IPIV is INTEGER array, dimension (N) Details of the interchanges as computed by SSYTRF_AA.``` [in,out] B ``` B is REAL array, dimension (LDB,NRHS) On entry, the right hand side matrix B. On exit, the solution matrix X.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).``` [out] WORK ` WORK is REAL array, dimension (MAX(1,LWORK))` [in] LWORK ``` LWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,3*N-2).``` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value```

Definition at line 129 of file ssytrs_aa.f.

131 *
132 * -- LAPACK computational routine --
133 * -- LAPACK is a software package provided by Univ. of Tennessee, --
134 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
135 *
136  IMPLICIT NONE
137 *
138 * .. Scalar Arguments ..
139  CHARACTER UPLO
140  INTEGER N, NRHS, LDA, LDB, LWORK, INFO
141 * ..
142 * .. Array Arguments ..
143  INTEGER IPIV( * )
144  REAL A( LDA, * ), B( LDB, * ), WORK( * )
145 * ..
146 *
147 * =====================================================================
148 *
149  REAL ONE
150  parameter( one = 1.0e+0 )
151 * ..
152 * .. Local Scalars ..
153  LOGICAL LQUERY, UPPER
154  INTEGER K, KP, LWKOPT
155 * ..
156 * .. External Functions ..
157  LOGICAL LSAME
158  EXTERNAL lsame
159 * ..
160 * .. External Subroutines ..
161  EXTERNAL sgtsv, sswap, slacpy, strsm, xerbla
162 * ..
163 * .. Intrinsic Functions ..
164  INTRINSIC max
165 * ..
166 * .. Executable Statements ..
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  lquery = ( lwork.EQ.-1 )
171  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
172  info = -1
173  ELSE IF( n.LT.0 ) THEN
174  info = -2
175  ELSE IF( nrhs.LT.0 ) THEN
176  info = -3
177  ELSE IF( lda.LT.max( 1, n ) ) THEN
178  info = -5
179  ELSE IF( ldb.LT.max( 1, n ) ) THEN
180  info = -8
181  ELSE IF( lwork.LT.max( 1, 3*n-2 ) .AND. .NOT.lquery ) THEN
182  info = -10
183  END IF
184  IF( info.NE.0 ) THEN
185  CALL xerbla( 'SSYTRS_AA', -info )
186  RETURN
187  ELSE IF( lquery ) THEN
188  lwkopt = (3*n-2)
189  work( 1 ) = lwkopt
190  RETURN
191  END IF
192 *
193 * Quick return if possible
194 *
195  IF( n.EQ.0 .OR. nrhs.EQ.0 )
196  \$ RETURN
197 *
198  IF( upper ) THEN
199 *
200 * Solve A*X = B, where A = U**T*T*U.
201 *
202 * 1) Forward substitution with U**T
203 *
204  IF( n.GT.1 ) THEN
205 *
206 * Pivot, P**T * B -> B
207 *
208  k = 1
209  DO WHILE ( k.LE.n )
210  kp = ipiv( k )
211  IF( kp.NE.k )
212  \$ CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
213  k = k + 1
214  END DO
215 *
216 * Compute U**T \ B -> B [ (U**T \P**T * B) ]
217 *
218  CALL strsm( 'L', 'U', 'T', 'U', n-1, nrhs, one, a( 1, 2 ),
219  \$ lda, b( 2, 1 ), ldb)
220  END IF
221 *
222 * 2) Solve with triangular matrix T
223 *
224 * Compute T \ B -> B [ T \ (U**T \P**T * B) ]
225 *
226  CALL slacpy( 'F', 1, n, a(1, 1), lda+1, work(n), 1)
227  IF( n.GT.1 ) THEN
228  CALL slacpy( 'F', 1, n-1, a(1, 2), lda+1, work(1), 1)
229  CALL slacpy( 'F', 1, n-1, a(1, 2), lda+1, work(2*n), 1)
230  END IF
231  CALL sgtsv(n, nrhs, work(1), work(n), work(2*n), b, ldb,
232  \$ info)
233 *
234 * 3) Backward substitution with U
235 *
236  IF( n.GT.1 ) THEN
237 *
238 *
239 * Compute U \ B -> B [ U \ (T \ (U**T \P**T * B) ) ]
240 *
241  CALL strsm( 'L', 'U', 'N', 'U', n-1, nrhs, one, a( 1, 2 ),
242  \$ lda, b(2, 1), ldb)
243 *
244 * Pivot, P * B -> B [ P * (U \ (T \ (U**T \P**T * B) )) ]
245 *
246  k = n
247  DO WHILE ( k.GE.1 )
248  kp = ipiv( k )
249  IF( kp.NE.k )
250  \$ CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
251  k = k - 1
252  END DO
253  END IF
254 *
255  ELSE
256 *
257 * Solve A*X = B, where A = L*T*L**T.
258 *
259 * 1) Forward substitution with L
260 *
261  IF( n.GT.1 ) THEN
262 *
263 * Pivot, P**T * B -> B
264 *
265  k = 1
266  DO WHILE ( k.LE.n )
267  kp = ipiv( k )
268  IF( kp.NE.k )
269  \$ CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
270  k = k + 1
271  END DO
272 *
273 * Compute L \ B -> B [ (L \P**T * B) ]
274 *
275  CALL strsm( 'L', 'L', 'N', 'U', n-1, nrhs, one, a( 2, 1),
276  \$ lda, b(2, 1), ldb)
277  END IF
278 *
279 * 2) Solve with triangular matrix T
280 *
281 * Compute T \ B -> B [ T \ (L \P**T * B) ]
282 *
283  CALL slacpy( 'F', 1, n, a(1, 1), lda+1, work(n), 1)
284  IF( n.GT.1 ) THEN
285  CALL slacpy( 'F', 1, n-1, a(2, 1), lda+1, work(1), 1)
286  CALL slacpy( 'F', 1, n-1, a(2, 1), lda+1, work(2*n), 1)
287  END IF
288  CALL sgtsv(n, nrhs, work(1), work(n), work(2*n), b, ldb,
289  \$ info)
290 *
291 * 3) Backward substitution with L**T
292 *
293  IF( n.GT.1 ) THEN
294 *
295 * Compute L**T \ B -> B [ L**T \ (T \ (L \P**T * B) ) ]
296 *
297  CALL strsm( 'L', 'L', 'T', 'U', n-1, nrhs, one, a( 2, 1 ),
298  \$ lda, b( 2, 1 ), ldb)
299 *
300 * Pivot, P * B -> B [ P * (L**T \ (T \ (L \P**T * B) )) ]
301 *
302  k = n
303  DO WHILE ( k.GE.1 )
304  kp = ipiv( k )
305  IF( kp.NE.k )
306  \$ CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
307  k = k - 1
308  END DO
309  END IF
310 *
311  END IF
312 *
313  RETURN
314 *
315 * End of SSYTRS_AA
316 *
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:103
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine sgtsv(N, NRHS, DL, D, DU, B, LDB, INFO)
SGTSV computes the solution to system of linear equations A * X = B for GT matrices
Definition: sgtsv.f:127
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:82
subroutine strsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRSM
Definition: strsm.f:181
Here is the call graph for this function:
Here is the caller graph for this function: