LAPACK  3.8.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

Download SSYTRS_AA + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 SSYTRS_AA solves a system of linear equations A*X = B with a real
 symmetric matrix A using the factorization A = U*T*U**T 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*U**T;
          = '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).
[in]WORK
          WORK is DOUBLE array, dimension (MAX(1,LWORK))
[in]LWORK
          LWORK is INTEGER, LWORK >= MAX(1,3*N-2).

 \param[out] INFO
 \verbatim
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017

Definition at line 131 of file ssytrs_aa.f.

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