112 SUBROUTINE ssptrs( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
120 INTEGER INFO, LDB, N, NRHS
124 REAL AP( * ), B( LDB, * )
131 parameter( one = 1.0e+0 )
136 REAL AK, AKM1, AKM1K, BK, BKM1, DENOM
151 upper = lsame( uplo,
'U' )
152 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
154 ELSE IF( n.LT.0 )
THEN
156 ELSE IF( nrhs.LT.0 )
THEN
158 ELSE IF( ldb.LT.max( 1, n ) )
THEN
162 CALL xerbla(
'SSPTRS', -info )
168 IF( n.EQ.0 .OR. nrhs.EQ.0 )
181 kc = n*( n+1 ) / 2 + 1
190 IF( ipiv( k ).GT.0 )
THEN
198 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
203 CALL sger( k-1, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
208 CALL sscal( nrhs, one / ap( kc+k-1 ), b( k, 1 ), ldb )
218 $
CALL sswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
223 CALL sger( k-2, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
225 CALL sger( k-2, nrhs, -one, ap( kc-( k-1 ) ), 1,
226 $ b( k-1, 1 ), ldb, b( 1, 1 ), ldb )
231 akm1 = ap( kc-1 ) / akm1k
232 ak = ap( kc+k-1 ) / akm1k
233 denom = akm1*ak - one
235 bkm1 = b( k-1, j ) / akm1k
236 bk = b( k, j ) / akm1k
237 b( k-1, j ) = ( ak*bkm1-bk ) / denom
238 b( k, j ) = ( akm1*bk-bkm1 ) / denom
261 IF( ipiv( k ).GT.0 )
THEN
268 CALL sgemv(
'Transpose', k-1, nrhs, -one, b, ldb,
270 $ 1, one, b( k, 1 ), ldb )
276 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
286 CALL sgemv(
'Transpose', k-1, nrhs, -one, b, ldb,
288 $ 1, one, b( k, 1 ), ldb )
289 CALL sgemv(
'Transpose', k-1, nrhs, -one, b, ldb,
290 $ ap( kc+k ), 1, one, b( k+1, 1 ), ldb )
296 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
322 IF( ipiv( k ).GT.0 )
THEN
330 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
336 $
CALL sger( n-k, nrhs, -one, ap( kc+1 ), 1, b( k, 1 ),
337 $ ldb, b( k+1, 1 ), ldb )
341 CALL sscal( nrhs, one / ap( kc ), b( k, 1 ), ldb )
352 $
CALL sswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
358 CALL sger( n-k-1, nrhs, -one, ap( kc+2 ), 1, b( k,
360 $ ldb, b( k+2, 1 ), ldb )
361 CALL sger( n-k-1, nrhs, -one, ap( kc+n-k+2 ), 1,
362 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
368 akm1 = ap( kc ) / akm1k
369 ak = ap( kc+n-k+1 ) / akm1k
370 denom = akm1*ak - one
372 bkm1 = b( k, j ) / akm1k
373 bk = b( k+1, j ) / akm1k
374 b( k, j ) = ( ak*bkm1-bk ) / denom
375 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
377 kc = kc + 2*( n-k ) + 1
390 kc = n*( n+1 ) / 2 + 1
399 IF( ipiv( k ).GT.0 )
THEN
407 $
CALL sgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
408 $ ldb, ap( kc+1 ), 1, one, b( k, 1 ), ldb )
414 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
424 CALL sgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
425 $ ldb, ap( kc+1 ), 1, one, b( k, 1 ), ldb )
426 CALL sgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
427 $ ldb, ap( kc-( n-k ) ), 1, one, b( k-1, 1 ),
435 $
CALL sswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )