LAPACK  3.6.0
LAPACK: Linear Algebra PACKage
Collaboration diagram for real:

Functions

subroutine sla_syamv (UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
 SLA_SYAMV computes a matrix-vector product using a symmetric indefinite matrix to calculate error bounds. More...
 
real function sla_syrcond (UPLO, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)
 SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix. More...
 
subroutine sla_syrfsx_extended (PREC_TYPE, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
 SLA_SYRFSX_EXTENDED improves the computed solution to a system of linear equations for symmetric indefinite matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution. More...
 
real function sla_syrpvgrw (UPLO, N, INFO, A, LDA, AF, LDAF, IPIV, WORK)
 SLA_SYRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric indefinite matrix. More...
 
subroutine slasyf (UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
 SLASYF computes a partial factorization of a real symmetric matrix using the Bunch-Kaufman diagonal pivoting method. More...
 
subroutine slasyf_rook (UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
 SLASYF_ROOK computes a partial factorization of a real symmetric matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method. More...
 
subroutine ssycon (UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
 SSYCON More...
 
subroutine ssycon_rook (UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
 SSYCON_ROOK More...
 
subroutine ssyconv (UPLO, WAY, N, A, LDA, IPIV, E, INFO)
 SSYCONV More...
 
subroutine ssyequb (UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO)
 SSYEQUB More...
 
subroutine ssygs2 (ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
 SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorization results obtained from spotrf (unblocked algorithm). More...
 
subroutine ssygst (ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
 SSYGST More...
 
subroutine ssyrfs (UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
 SSYRFS More...
 
subroutine ssyrfsx (UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV, S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO)
 SSYRFSX More...
 
subroutine ssytd2 (UPLO, N, A, LDA, D, E, TAU, INFO)
 SSYTD2 reduces a symmetric matrix to real symmetric tridiagonal form by an orthogonal similarity transformation (unblocked algorithm). More...
 
subroutine ssytf2 (UPLO, N, A, LDA, IPIV, INFO)
 SSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting method (unblocked algorithm). More...
 
subroutine ssytf2_rook (UPLO, N, A, LDA, IPIV, INFO)
 SSYTF2_ROOK computes the factorization of a real symmetric indefinite matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method (unblocked algorithm). More...
 
subroutine ssytrd (UPLO, N, A, LDA, D, E, TAU, WORK, LWORK, INFO)
 SSYTRD More...
 
subroutine ssytrf (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
 SSYTRF More...
 
subroutine ssytrf_rook (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
 SSYTRF_ROOK More...
 
subroutine ssytri (UPLO, N, A, LDA, IPIV, WORK, INFO)
 SSYTRI More...
 
subroutine ssytri2 (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
 SSYTRI2 More...
 
subroutine ssytri2x (UPLO, N, A, LDA, IPIV, WORK, NB, INFO)
 SSYTRI2X More...
 
subroutine ssytri_rook (UPLO, N, A, LDA, IPIV, WORK, INFO)
 SSYTRI_ROOK More...
 
subroutine ssytrs (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
 SSYTRS More...
 
subroutine ssytrs2 (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, INFO)
 SSYTRS2 More...
 
subroutine ssytrs_rook (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
 SSYTRS_ROOK More...
 
subroutine stgsyl (TRANS, IJOB, M, N, A, LDA, B, LDB, C, LDC, D, LDD, E, LDE, F, LDF, SCALE, DIF, WORK, LWORK, IWORK, INFO)
 STGSYL More...
 
subroutine strsyl (TRANA, TRANB, ISGN, M, N, A, LDA, B, LDB, C, LDC, SCALE, INFO)
 STRSYL More...
 

Detailed Description

This is the group of real computational functions for SY matrices

Function Documentation

subroutine sla_syamv ( integer  UPLO,
integer  N,
real  ALPHA,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  X,
integer  INCX,
real  BETA,
real, dimension( * )  Y,
integer  INCY 
)

SLA_SYAMV computes a matrix-vector product using a symmetric indefinite matrix to calculate error bounds.

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

Purpose:
 SLA_SYAMV  performs the matrix-vector operation

         y := alpha*abs(A)*abs(x) + beta*abs(y),

 where alpha and beta are scalars, x and y are vectors and A is an
 n by n symmetric matrix.

 This function is primarily used in calculating error bounds.
 To protect against underflow during evaluation, components in
 the resulting vector are perturbed away from zero by (N+1)
 times the underflow threshold.  To prevent unnecessarily large
 errors for block-structure embedded in general matrices,
 "symbolically" zero components are not perturbed.  A zero
 entry is considered "symbolic" if all multiplications involved
 in computing that entry have at least one zero multiplicand.
Parameters
[in]UPLO
          UPLO is INTEGER
           On entry, UPLO specifies whether the upper or lower
           triangular part of the array A is to be referenced as
           follows:

              UPLO = BLAS_UPPER   Only the upper triangular part of A
                                  is to be referenced.

              UPLO = BLAS_LOWER   Only the lower triangular part of A
                                  is to be referenced.

           Unchanged on exit.
[in]N
          N is INTEGER
           On entry, N specifies the number of columns of the matrix A.
           N must be at least zero.
           Unchanged on exit.
[in]ALPHA
          ALPHA is REAL .
           On entry, ALPHA specifies the scalar alpha.
           Unchanged on exit.
[in]A
          A is REAL array of DIMENSION ( LDA, n ).
           Before entry, the leading m by n part of the array A must
           contain the matrix of coefficients.
           Unchanged on exit.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in the calling (sub) program. LDA must be at least
           max( 1, n ).
           Unchanged on exit.
[in]X
          X is REAL array, dimension
           ( 1 + ( n - 1 )*abs( INCX ) )
           Before entry, the incremented array X must contain the
           vector x.
           Unchanged on exit.
[in]INCX
          INCX is INTEGER
           On entry, INCX specifies the increment for the elements of
           X. INCX must not be zero.
           Unchanged on exit.
[in]BETA
          BETA is REAL .
           On entry, BETA specifies the scalar beta. When BETA is
           supplied as zero then Y need not be set on input.
           Unchanged on exit.
[in,out]Y
          Y is REAL array, dimension
           ( 1 + ( n - 1 )*abs( INCY ) )
           Before entry with BETA non-zero, the incremented array Y
           must contain the vector y. On exit, Y is overwritten by the
           updated vector y.
[in]INCY
          INCY is INTEGER
           On entry, INCY specifies the increment for the elements of
           Y. INCY must not be zero.
           Unchanged on exit.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012
Further Details:
  Level 2 Blas routine.

  -- Written on 22-October-1986.
     Jack Dongarra, Argonne National Lab.
     Jeremy Du Croz, Nag Central Office.
     Sven Hammarling, Nag Central Office.
     Richard Hanson, Sandia National Labs.
  -- Modified for the absolute-value product, April 2006
     Jason Riedy, UC Berkeley

Definition at line 179 of file sla_syamv.f.

179 *
180 * -- LAPACK computational routine (version 3.4.2) --
181 * -- LAPACK is a software package provided by Univ. of Tennessee, --
182 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
183 * September 2012
184 *
185 * .. Scalar Arguments ..
186  REAL alpha, beta
187  INTEGER incx, incy, lda, n, uplo
188 * ..
189 * .. Array Arguments ..
190  REAL a( lda, * ), x( * ), y( * )
191 * ..
192 *
193 * =====================================================================
194 *
195 * .. Parameters ..
196  REAL one, zero
197  parameter( one = 1.0e+0, zero = 0.0e+0 )
198 * ..
199 * .. Local Scalars ..
200  LOGICAL symb_zero
201  REAL temp, safe1
202  INTEGER i, info, iy, j, jx, kx, ky
203 * ..
204 * .. External Subroutines ..
205  EXTERNAL xerbla, slamch
206  REAL slamch
207 * ..
208 * .. External Functions ..
209  EXTERNAL ilauplo
210  INTEGER ilauplo
211 * ..
212 * .. Intrinsic Functions ..
213  INTRINSIC max, abs, sign
214 * ..
215 * .. Executable Statements ..
216 *
217 * Test the input parameters.
218 *
219  info = 0
220  IF ( uplo.NE.ilauplo( 'U' ) .AND.
221  $ uplo.NE.ilauplo( 'L' ) ) THEN
222  info = 1
223  ELSE IF( n.LT.0 )THEN
224  info = 2
225  ELSE IF( lda.LT.max( 1, n ) )THEN
226  info = 5
227  ELSE IF( incx.EQ.0 )THEN
228  info = 7
229  ELSE IF( incy.EQ.0 )THEN
230  info = 10
231  END IF
232  IF( info.NE.0 )THEN
233  CALL xerbla( 'SSYMV ', info )
234  RETURN
235  END IF
236 *
237 * Quick return if possible.
238 *
239  IF( ( n.EQ.0 ).OR.( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
240  $ RETURN
241 *
242 * Set up the start points in X and Y.
243 *
244  IF( incx.GT.0 )THEN
245  kx = 1
246  ELSE
247  kx = 1 - ( n - 1 )*incx
248  END IF
249  IF( incy.GT.0 )THEN
250  ky = 1
251  ELSE
252  ky = 1 - ( n - 1 )*incy
253  END IF
254 *
255 * Set SAFE1 essentially to be the underflow threshold times the
256 * number of additions in each row.
257 *
258  safe1 = slamch( 'Safe minimum' )
259  safe1 = (n+1)*safe1
260 *
261 * Form y := alpha*abs(A)*abs(x) + beta*abs(y).
262 *
263 * The O(N^2) SYMB_ZERO tests could be replaced by O(N) queries to
264 * the inexact flag. Still doesn't help change the iteration order
265 * to per-column.
266 *
267  iy = ky
268  IF ( incx.EQ.1 ) THEN
269  IF ( uplo .EQ. ilauplo( 'U' ) ) THEN
270  DO i = 1, n
271  IF ( beta .EQ. zero ) THEN
272  symb_zero = .true.
273  y( iy ) = 0.0
274  ELSE IF ( y( iy ) .EQ. zero ) THEN
275  symb_zero = .true.
276  ELSE
277  symb_zero = .false.
278  y( iy ) = beta * abs( y( iy ) )
279  END IF
280  IF ( alpha .NE. zero ) THEN
281  DO j = 1, i
282  temp = abs( a( j, i ) )
283  symb_zero = symb_zero .AND.
284  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
285 
286  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
287  END DO
288  DO j = i+1, n
289  temp = abs( a( i, j ) )
290  symb_zero = symb_zero .AND.
291  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
292 
293  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
294  END DO
295  END IF
296 
297  IF ( .NOT.symb_zero )
298  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
299 
300  iy = iy + incy
301  END DO
302  ELSE
303  DO i = 1, n
304  IF ( beta .EQ. zero ) THEN
305  symb_zero = .true.
306  y( iy ) = 0.0
307  ELSE IF ( y( iy ) .EQ. zero ) THEN
308  symb_zero = .true.
309  ELSE
310  symb_zero = .false.
311  y( iy ) = beta * abs( y( iy ) )
312  END IF
313  IF ( alpha .NE. zero ) THEN
314  DO j = 1, i
315  temp = abs( a( i, j ) )
316  symb_zero = symb_zero .AND.
317  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
318 
319  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
320  END DO
321  DO j = i+1, n
322  temp = abs( a( j, i ) )
323  symb_zero = symb_zero .AND.
324  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
325 
326  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
327  END DO
328  END IF
329 
330  IF ( .NOT.symb_zero )
331  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
332 
333  iy = iy + incy
334  END DO
335  END IF
336  ELSE
337  IF ( uplo .EQ. ilauplo( 'U' ) ) THEN
338  DO i = 1, n
339  IF ( beta .EQ. zero ) THEN
340  symb_zero = .true.
341  y( iy ) = 0.0
342  ELSE IF ( y( iy ) .EQ. zero ) THEN
343  symb_zero = .true.
344  ELSE
345  symb_zero = .false.
346  y( iy ) = beta * abs( y( iy ) )
347  END IF
348  jx = kx
349  IF ( alpha .NE. zero ) THEN
350  DO j = 1, i
351  temp = abs( a( j, i ) )
352  symb_zero = symb_zero .AND.
353  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
354 
355  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
356  jx = jx + incx
357  END DO
358  DO j = i+1, n
359  temp = abs( a( i, j ) )
360  symb_zero = symb_zero .AND.
361  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
362 
363  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
364  jx = jx + incx
365  END DO
366  END IF
367 
368  IF ( .NOT.symb_zero )
369  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
370 
371  iy = iy + incy
372  END DO
373  ELSE
374  DO i = 1, n
375  IF ( beta .EQ. zero ) THEN
376  symb_zero = .true.
377  y( iy ) = 0.0
378  ELSE IF ( y( iy ) .EQ. zero ) THEN
379  symb_zero = .true.
380  ELSE
381  symb_zero = .false.
382  y( iy ) = beta * abs( y( iy ) )
383  END IF
384  jx = kx
385  IF ( alpha .NE. zero ) THEN
386  DO j = 1, i
387  temp = abs( a( i, j ) )
388  symb_zero = symb_zero .AND.
389  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
390 
391  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
392  jx = jx + incx
393  END DO
394  DO j = i+1, n
395  temp = abs( a( j, i ) )
396  symb_zero = symb_zero .AND.
397  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
398 
399  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
400  jx = jx + incx
401  END DO
402  END IF
403 
404  IF ( .NOT.symb_zero )
405  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
406 
407  iy = iy + incy
408  END DO
409  END IF
410 
411  END IF
412 *
413  RETURN
414 *
415 * End of SLA_SYAMV
416 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function ilauplo(UPLO)
ILAUPLO
Definition: ilauplo.f:60
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62

Here is the call graph for this function:

Here is the caller graph for this function:

real function sla_syrcond ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
integer  CMODE,
real, dimension( * )  C,
integer  INFO,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK 
)

SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.

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

Purpose:
    SLA_SYRCOND estimates the Skeel condition number of  op(A) * op2(C)
    where op2 is determined by CMODE as follows
    CMODE =  1    op2(C) = C
    CMODE =  0    op2(C) = I
    CMODE = -1    op2(C) = inv(C)
    The Skeel condition number cond(A) = norminf( |inv(A)||A| )
    is computed by computing scaling factors R such that
    diag(R)*A*op2(C) is row equilibrated and computing the standard
    infinity-norm condition number.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
       = 'U':  Upper triangle of A is stored;
       = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
     On entry, the N-by-N matrix A.
[in]LDA
          LDA is INTEGER
     The leading dimension of the array A.  LDA >= max(1,N).
[in]AF
          AF is REAL array, dimension (LDAF,N)
     The block diagonal matrix D and the multipliers used to
     obtain the factor U or L as computed by SSYTRF.
[in]LDAF
          LDAF is INTEGER
     The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     Details of the interchanges and the block structure of D
     as determined by SSYTRF.
[in]CMODE
          CMODE is INTEGER
     Determines op2(C) in the formula op(A) * op2(C) as follows:
     CMODE =  1    op2(C) = C
     CMODE =  0    op2(C) = I
     CMODE = -1    op2(C) = inv(C)
[in]C
          C is REAL array, dimension (N)
     The vector C in the formula op(A) * op2(C).
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit.
     i > 0:  The ith argument is invalid.
[in]WORK
          WORK is REAL array, dimension (3*N).
     Workspace.
[in]IWORK
          IWORK is INTEGER array, dimension (N).
     Workspace.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 148 of file sla_syrcond.f.

148 *
149 * -- LAPACK computational routine (version 3.4.2) --
150 * -- LAPACK is a software package provided by Univ. of Tennessee, --
151 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152 * September 2012
153 *
154 * .. Scalar Arguments ..
155  CHARACTER uplo
156  INTEGER n, lda, ldaf, info, cmode
157 * ..
158 * .. Array Arguments
159  INTEGER iwork( * ), ipiv( * )
160  REAL a( lda, * ), af( ldaf, * ), work( * ), c( * )
161 * ..
162 *
163 * =====================================================================
164 *
165 * .. Local Scalars ..
166  CHARACTER normin
167  INTEGER kase, i, j
168  REAL ainvnm, smlnum, tmp
169  LOGICAL up
170 * ..
171 * .. Local Arrays ..
172  INTEGER isave( 3 )
173 * ..
174 * .. External Functions ..
175  LOGICAL lsame
176  INTEGER isamax
177  REAL slamch
178  EXTERNAL lsame, isamax, slamch
179 * ..
180 * .. External Subroutines ..
181  EXTERNAL slacn2, slatrs, srscl, xerbla, ssytrs
182 * ..
183 * .. Intrinsic Functions ..
184  INTRINSIC abs, max
185 * ..
186 * .. Executable Statements ..
187 *
188  sla_syrcond = 0.0
189 *
190  info = 0
191  IF( n.LT.0 ) THEN
192  info = -2
193  ELSE IF( lda.LT.max( 1, n ) ) THEN
194  info = -4
195  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
196  info = -6
197  END IF
198  IF( info.NE.0 ) THEN
199  CALL xerbla( 'SLA_SYRCOND', -info )
200  RETURN
201  END IF
202  IF( n.EQ.0 ) THEN
203  sla_syrcond = 1.0
204  RETURN
205  END IF
206  up = .false.
207  IF ( lsame( uplo, 'U' ) ) up = .true.
208 *
209 * Compute the equilibration matrix R such that
210 * inv(R)*A*C has unit 1-norm.
211 *
212  IF ( up ) THEN
213  DO i = 1, n
214  tmp = 0.0
215  IF ( cmode .EQ. 1 ) THEN
216  DO j = 1, i
217  tmp = tmp + abs( a( j, i ) * c( j ) )
218  END DO
219  DO j = i+1, n
220  tmp = tmp + abs( a( i, j ) * c( j ) )
221  END DO
222  ELSE IF ( cmode .EQ. 0 ) THEN
223  DO j = 1, i
224  tmp = tmp + abs( a( j, i ) )
225  END DO
226  DO j = i+1, n
227  tmp = tmp + abs( a( i, j ) )
228  END DO
229  ELSE
230  DO j = 1, i
231  tmp = tmp + abs( a( j, i ) / c( j ) )
232  END DO
233  DO j = i+1, n
234  tmp = tmp + abs( a( i, j ) / c( j ) )
235  END DO
236  END IF
237  work( 2*n+i ) = tmp
238  END DO
239  ELSE
240  DO i = 1, n
241  tmp = 0.0
242  IF ( cmode .EQ. 1 ) THEN
243  DO j = 1, i
244  tmp = tmp + abs( a( i, j ) * c( j ) )
245  END DO
246  DO j = i+1, n
247  tmp = tmp + abs( a( j, i ) * c( j ) )
248  END DO
249  ELSE IF ( cmode .EQ. 0 ) THEN
250  DO j = 1, i
251  tmp = tmp + abs( a( i, j ) )
252  END DO
253  DO j = i+1, n
254  tmp = tmp + abs( a( j, i ) )
255  END DO
256  ELSE
257  DO j = 1, i
258  tmp = tmp + abs( a( i, j) / c( j ) )
259  END DO
260  DO j = i+1, n
261  tmp = tmp + abs( a( j, i) / c( j ) )
262  END DO
263  END IF
264  work( 2*n+i ) = tmp
265  END DO
266  ENDIF
267 *
268 * Estimate the norm of inv(op(A)).
269 *
270  smlnum = slamch( 'Safe minimum' )
271  ainvnm = 0.0
272  normin = 'N'
273 
274  kase = 0
275  10 CONTINUE
276  CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
277  IF( kase.NE.0 ) THEN
278  IF( kase.EQ.2 ) THEN
279 *
280 * Multiply by R.
281 *
282  DO i = 1, n
283  work( i ) = work( i ) * work( 2*n+i )
284  END DO
285 
286  IF ( up ) THEN
287  CALL ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
288  ELSE
289  CALL ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
290  ENDIF
291 *
292 * Multiply by inv(C).
293 *
294  IF ( cmode .EQ. 1 ) THEN
295  DO i = 1, n
296  work( i ) = work( i ) / c( i )
297  END DO
298  ELSE IF ( cmode .EQ. -1 ) THEN
299  DO i = 1, n
300  work( i ) = work( i ) * c( i )
301  END DO
302  END IF
303  ELSE
304 *
305 * Multiply by inv(C**T).
306 *
307  IF ( cmode .EQ. 1 ) THEN
308  DO i = 1, n
309  work( i ) = work( i ) / c( i )
310  END DO
311  ELSE IF ( cmode .EQ. -1 ) THEN
312  DO i = 1, n
313  work( i ) = work( i ) * c( i )
314  END DO
315  END IF
316 
317  IF ( up ) THEN
318  CALL ssytrs( 'U', n, 1, af, ldaf, ipiv, work, n, info )
319  ELSE
320  CALL ssytrs( 'L', n, 1, af, ldaf, ipiv, work, n, info )
321  ENDIF
322 *
323 * Multiply by R.
324 *
325  DO i = 1, n
326  work( i ) = work( i ) * work( 2*n+i )
327  END DO
328  END IF
329 *
330  GO TO 10
331  END IF
332 *
333 * Compute the estimate of the reciprocal condition number.
334 *
335  IF( ainvnm .NE. 0.0 )
336  $ sla_syrcond = ( 1.0 / ainvnm )
337 *
338  RETURN
339 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SSYTRS
Definition: ssytrs.f:122
real function sla_syrcond(UPLO, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)
SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.
Definition: sla_syrcond.f:148
subroutine slatrs(UPLO, TRANS, DIAG, NORMIN, N, A, LDA, X, SCALE, CNORM, INFO)
SLATRS solves a triangular system of equations with the scale factor set to prevent overflow...
Definition: slatrs.f:240
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine srscl(N, SA, SX, INCX)
SRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: srscl.f:86
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine sla_syrfsx_extended ( integer  PREC_TYPE,
character  UPLO,
integer  N,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
logical  COLEQU,
real, dimension( * )  C,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldy, * )  Y,
integer  LDY,
real, dimension( * )  BERR_OUT,
integer  N_NORMS,
real, dimension( nrhs, * )  ERR_BNDS_NORM,
real, dimension( nrhs, * )  ERR_BNDS_COMP,
real, dimension( * )  RES,
real, dimension( * )  AYB,
real, dimension( * )  DY,
real, dimension( * )  Y_TAIL,
real  RCOND,
integer  ITHRESH,
real  RTHRESH,
real  DZ_UB,
logical  IGNORE_CWISE,
integer  INFO 
)

SLA_SYRFSX_EXTENDED improves the computed solution to a system of linear equations for symmetric indefinite matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.

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

Purpose:
 SLA_SYRFSX_EXTENDED improves the computed solution to a system of
 linear equations by performing extra-precise iterative refinement
 and provides error bounds and backward error estimates for the solution.
 This subroutine is called by SSYRFSX to perform iterative refinement.
 In addition to normwise error bound, the code provides maximum
 componentwise error bound if possible. See comments for ERR_BNDS_NORM
 and ERR_BNDS_COMP for details of the error bounds. Note that this
 subroutine is only resonsible for setting the second fields of
 ERR_BNDS_NORM and ERR_BNDS_COMP.
Parameters
[in]PREC_TYPE
          PREC_TYPE is INTEGER
     Specifies the intermediate precision to be used in refinement.
     The value is defined by ILAPREC(P) where P is a CHARACTER and
     P    = 'S':  Single
          = 'D':  Double
          = 'I':  Indigenous
          = 'X', 'E':  Extra
[in]UPLO
          UPLO is CHARACTER*1
       = 'U':  Upper triangle of A is stored;
       = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
     The number of linear equations, i.e., 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.
[in]A
          A is REAL array, dimension (LDA,N)
     On entry, the N-by-N matrix A.
[in]LDA
          LDA is INTEGER
     The leading dimension of the array A.  LDA >= max(1,N).
[in]AF
          AF is REAL array, dimension (LDAF,N)
     The block diagonal matrix D and the multipliers used to
     obtain the factor U or L as computed by SSYTRF.
[in]LDAF
          LDAF is INTEGER
     The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     Details of the interchanges and the block structure of D
     as determined by SSYTRF.
[in]COLEQU
          COLEQU is LOGICAL
     If .TRUE. then column equilibration was done to A before calling
     this routine. This is needed to compute the solution and error
     bounds correctly.
[in]C
          C is REAL array, dimension (N)
     The column scale factors for A. If COLEQU = .FALSE., C
     is not accessed. If C is input, each element of C should be a power
     of the radix to ensure a reliable solution and error estimates.
     Scaling by powers of the radix does not cause rounding errors unless
     the result underflows or overflows. Rounding errors during scaling
     lead to refining with a matrix that is not equivalent to the
     input matrix, producing error estimates that may not be
     reliable.
[in]B
          B is REAL array, dimension (LDB,NRHS)
     The right-hand-side matrix B.
[in]LDB
          LDB is INTEGER
     The leading dimension of the array B.  LDB >= max(1,N).
[in,out]Y
          Y is REAL array, dimension (LDY,NRHS)
     On entry, the solution matrix X, as computed by SSYTRS.
     On exit, the improved solution matrix Y.
[in]LDY
          LDY is INTEGER
     The leading dimension of the array Y.  LDY >= max(1,N).
[out]BERR_OUT
          BERR_OUT is REAL array, dimension (NRHS)
     On exit, BERR_OUT(j) contains the componentwise relative backward
     error for right-hand-side j from the formula
         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
     where abs(Z) is the componentwise absolute value of the matrix
     or vector Z. This is computed by SLA_LIN_BERR.
[in]N_NORMS
          N_NORMS is INTEGER
     Determines which error bounds to return (see ERR_BNDS_NORM
     and ERR_BNDS_COMP).
     If N_NORMS >= 1 return normwise error bounds.
     If N_NORMS >= 2 return componentwise error bounds.
[in,out]ERR_BNDS_NORM
          ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     normwise relative error, which is defined as follows:

     Normwise relative error in the ith solution vector:
             max_j (abs(XTRUE(j,i) - X(j,i)))
            ------------------------------
                  max_j abs(X(j,i))

     The array is indexed by the type of error information as described
     below. There currently are up to three pieces of information
     returned.

     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_NORM(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated normwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*A, where S scales each row by a power of the
              radix so all absolute row sums of Z are approximately 1.

     This subroutine is only responsible for setting the second field
     above.
     See Lapack Working Note 165 for further details and extra
     cautions.
[in,out]ERR_BNDS_COMP
          ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     componentwise relative error, which is defined as follows:

     Componentwise relative error in the ith solution vector:
                    abs(XTRUE(j,i) - X(j,i))
             max_j ----------------------
                         abs(X(j,i))

     The array is indexed by the right-hand side i (on which the
     componentwise relative error depends), and the type of error
     information as described below. There currently are up to three
     pieces of information returned for each right-hand side. If
     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
     the first (:,N_ERR_BNDS) entries are returned.

     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_COMP(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated componentwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*(A*diag(x)), where x is the solution for the
              current right-hand side and S scales each row of
              A*diag(x) by a power of the radix so all absolute row
              sums of Z are approximately 1.

     This subroutine is only responsible for setting the second field
     above.
     See Lapack Working Note 165 for further details and extra
     cautions.
[in]RES
          RES is REAL array, dimension (N)
     Workspace to hold the intermediate residual.
[in]AYB
          AYB is REAL array, dimension (N)
     Workspace. This can be the same workspace passed for Y_TAIL.
[in]DY
          DY is REAL array, dimension (N)
     Workspace to hold the intermediate solution.
[in]Y_TAIL
          Y_TAIL is REAL array, dimension (N)
     Workspace to hold the trailing bits of the intermediate solution.
[in]RCOND
          RCOND is REAL
     Reciprocal scaled condition number.  This is an estimate of the
     reciprocal Skeel condition number of the matrix A after
     equilibration (if done).  If this is less than the machine
     precision (in particular, if it is zero), the matrix is singular
     to working precision.  Note that the error may still be small even
     if this number is very small and the matrix appears ill-
     conditioned.
[in]ITHRESH
          ITHRESH is INTEGER
     The maximum number of residual computations allowed for
     refinement. The default is 10. For 'aggressive' set to 100 to
     permit convergence using approximate factorizations or
     factorizations other than LU. If the factorization uses a
     technique other than Gaussian elimination, the guarantees in
     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
[in]RTHRESH
          RTHRESH is REAL
     Determines when to stop refinement if the error estimate stops
     decreasing. Refinement will stop when the next solution no longer
     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
     default value is 0.5. For 'aggressive' set to 0.9 to permit
     convergence on extremely ill-conditioned matrices. See LAWN 165
     for more details.
[in]DZ_UB
          DZ_UB is REAL
     Determines when to start considering componentwise convergence.
     Componentwise convergence is only considered after each component
     of the solution Y is stable, which we definte as the relative
     change in each component being less than DZ_UB. The default value
     is 0.25, requiring the first bit to be stable. See LAWN 165 for
     more details.
[in]IGNORE_CWISE
          IGNORE_CWISE is LOGICAL
     If .TRUE. then ignore componentwise convergence. Default value
     is .FALSE..
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit.
       < 0:  if INFO = -i, the ith argument to SLA_SYRFSX_EXTENDED had an illegal
             value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 398 of file sla_syrfsx_extended.f.

398 *
399 * -- LAPACK computational routine (version 3.4.2) --
400 * -- LAPACK is a software package provided by Univ. of Tennessee, --
401 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
402 * September 2012
403 *
404 * .. Scalar Arguments ..
405  INTEGER info, lda, ldaf, ldb, ldy, n, nrhs, prec_type,
406  $ n_norms, ithresh
407  CHARACTER uplo
408  LOGICAL colequ, ignore_cwise
409  REAL rthresh, dz_ub
410 * ..
411 * .. Array Arguments ..
412  INTEGER ipiv( * )
413  REAL a( lda, * ), af( ldaf, * ), b( ldb, * ),
414  $ y( ldy, * ), res( * ), dy( * ), y_tail( * )
415  REAL c( * ), ayb( * ), rcond, berr_out( * ),
416  $ err_bnds_norm( nrhs, * ),
417  $ err_bnds_comp( nrhs, * )
418 * ..
419 *
420 * =====================================================================
421 *
422 * .. Local Scalars ..
423  INTEGER uplo2, cnt, i, j, x_state, z_state
424  REAL yk, dyk, ymin, normy, normx, normdx, dxrat,
425  $ dzrat, prevnormdx, prev_dz_z, dxratmax,
426  $ dzratmax, dx_x, dz_z, final_dx_x, final_dz_z,
427  $ eps, hugeval, incr_thresh
428  LOGICAL incr_prec, upper
429 * ..
430 * .. Parameters ..
431  INTEGER unstable_state, working_state, conv_state,
432  $ noprog_state, y_prec_state, base_residual,
433  $ extra_residual, extra_y
434  parameter( unstable_state = 0, working_state = 1,
435  $ conv_state = 2, noprog_state = 3 )
436  parameter( base_residual = 0, extra_residual = 1,
437  $ extra_y = 2 )
438  INTEGER final_nrm_err_i, final_cmp_err_i, berr_i
439  INTEGER rcond_i, nrm_rcond_i, nrm_err_i, cmp_rcond_i
440  INTEGER cmp_err_i, piv_growth_i
441  parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
442  $ berr_i = 3 )
443  parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
444  parameter( cmp_rcond_i = 7, cmp_err_i = 8,
445  $ piv_growth_i = 9 )
446  INTEGER la_linrx_itref_i, la_linrx_ithresh_i,
447  $ la_linrx_cwise_i
448  parameter( la_linrx_itref_i = 1,
449  $ la_linrx_ithresh_i = 2 )
450  parameter( la_linrx_cwise_i = 3 )
451  INTEGER la_linrx_trust_i, la_linrx_err_i,
452  $ la_linrx_rcond_i
453  parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
454  parameter( la_linrx_rcond_i = 3 )
455 * ..
456 * .. External Functions ..
457  LOGICAL lsame
458  EXTERNAL ilauplo
459  INTEGER ilauplo
460 * ..
461 * .. External Subroutines ..
462  EXTERNAL saxpy, scopy, ssytrs, ssymv, blas_ssymv_x,
463  $ blas_ssymv2_x, sla_syamv, sla_wwaddw,
464  $ sla_lin_berr
465  REAL slamch
466 * ..
467 * .. Intrinsic Functions ..
468  INTRINSIC abs, max, min
469 * ..
470 * .. Executable Statements ..
471 *
472  info = 0
473  upper = lsame( uplo, 'U' )
474  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
475  info = -2
476  ELSE IF( n.LT.0 ) THEN
477  info = -3
478  ELSE IF( nrhs.LT.0 ) THEN
479  info = -4
480  ELSE IF( lda.LT.max( 1, n ) ) THEN
481  info = -6
482  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
483  info = -8
484  ELSE IF( ldb.LT.max( 1, n ) ) THEN
485  info = -13
486  ELSE IF( ldy.LT.max( 1, n ) ) THEN
487  info = -15
488  END IF
489  IF( info.NE.0 ) THEN
490  CALL xerbla( 'SLA_SYRFSX_EXTENDED', -info )
491  RETURN
492  END IF
493  eps = slamch( 'Epsilon' )
494  hugeval = slamch( 'Overflow' )
495 * Force HUGEVAL to Inf
496  hugeval = hugeval * hugeval
497 * Using HUGEVAL may lead to spurious underflows.
498  incr_thresh = REAL( n )*eps
499 
500  IF ( lsame( uplo, 'L' ) ) THEN
501  uplo2 = ilauplo( 'L' )
502  ELSE
503  uplo2 = ilauplo( 'U' )
504  ENDIF
505 
506  DO j = 1, nrhs
507  y_prec_state = extra_residual
508  IF ( y_prec_state .EQ. extra_y ) THEN
509  DO i = 1, n
510  y_tail( i ) = 0.0
511  END DO
512  END IF
513 
514  dxrat = 0.0
515  dxratmax = 0.0
516  dzrat = 0.0
517  dzratmax = 0.0
518  final_dx_x = hugeval
519  final_dz_z = hugeval
520  prevnormdx = hugeval
521  prev_dz_z = hugeval
522  dz_z = hugeval
523  dx_x = hugeval
524 
525  x_state = working_state
526  z_state = unstable_state
527  incr_prec = .false.
528 
529  DO cnt = 1, ithresh
530 *
531 * Compute residual RES = B_s - op(A_s) * Y,
532 * op(A) = A, A**T, or A**H depending on TRANS (and type).
533 *
534  CALL scopy( n, b( 1, j ), 1, res, 1 )
535  IF (y_prec_state .EQ. base_residual) THEN
536  CALL ssymv( uplo, n, -1.0, a, lda, y(1,j), 1,
537  $ 1.0, res, 1 )
538  ELSE IF (y_prec_state .EQ. extra_residual) THEN
539  CALL blas_ssymv_x( uplo2, n, -1.0, a, lda,
540  $ y( 1, j ), 1, 1.0, res, 1, prec_type )
541  ELSE
542  CALL blas_ssymv2_x(uplo2, n, -1.0, a, lda,
543  $ y(1, j), y_tail, 1, 1.0, res, 1, prec_type)
544  END IF
545 
546 ! XXX: RES is no longer needed.
547  CALL scopy( n, res, 1, dy, 1 )
548  CALL ssytrs( uplo, n, 1, af, ldaf, ipiv, dy, n, info )
549 *
550 * Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
551 *
552  normx = 0.0
553  normy = 0.0
554  normdx = 0.0
555  dz_z = 0.0
556  ymin = hugeval
557 
558  DO i = 1, n
559  yk = abs( y( i, j ) )
560  dyk = abs( dy( i ) )
561 
562  IF ( yk .NE. 0.0 ) THEN
563  dz_z = max( dz_z, dyk / yk )
564  ELSE IF ( dyk .NE. 0.0 ) THEN
565  dz_z = hugeval
566  END IF
567 
568  ymin = min( ymin, yk )
569 
570  normy = max( normy, yk )
571 
572  IF ( colequ ) THEN
573  normx = max( normx, yk * c( i ) )
574  normdx = max( normdx, dyk * c( i ) )
575  ELSE
576  normx = normy
577  normdx = max(normdx, dyk)
578  END IF
579  END DO
580 
581  IF ( normx .NE. 0.0 ) THEN
582  dx_x = normdx / normx
583  ELSE IF ( normdx .EQ. 0.0 ) THEN
584  dx_x = 0.0
585  ELSE
586  dx_x = hugeval
587  END IF
588 
589  dxrat = normdx / prevnormdx
590  dzrat = dz_z / prev_dz_z
591 *
592 * Check termination criteria.
593 *
594  IF ( ymin*rcond .LT. incr_thresh*normy
595  $ .AND. y_prec_state .LT. extra_y )
596  $ incr_prec = .true.
597 
598  IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
599  $ x_state = working_state
600  IF ( x_state .EQ. working_state ) THEN
601  IF ( dx_x .LE. eps ) THEN
602  x_state = conv_state
603  ELSE IF ( dxrat .GT. rthresh ) THEN
604  IF ( y_prec_state .NE. extra_y ) THEN
605  incr_prec = .true.
606  ELSE
607  x_state = noprog_state
608  END IF
609  ELSE
610  IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
611  END IF
612  IF ( x_state .GT. working_state ) final_dx_x = dx_x
613  END IF
614 
615  IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
616  $ z_state = working_state
617  IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
618  $ z_state = working_state
619  IF ( z_state .EQ. working_state ) THEN
620  IF ( dz_z .LE. eps ) THEN
621  z_state = conv_state
622  ELSE IF ( dz_z .GT. dz_ub ) THEN
623  z_state = unstable_state
624  dzratmax = 0.0
625  final_dz_z = hugeval
626  ELSE IF ( dzrat .GT. rthresh ) THEN
627  IF ( y_prec_state .NE. extra_y ) THEN
628  incr_prec = .true.
629  ELSE
630  z_state = noprog_state
631  END IF
632  ELSE
633  IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
634  END IF
635  IF ( z_state .GT. working_state ) final_dz_z = dz_z
636  END IF
637 
638  IF ( x_state.NE.working_state.AND.
639  $ ( ignore_cwise.OR.z_state.NE.working_state ) )
640  $ GOTO 666
641 
642  IF ( incr_prec ) THEN
643  incr_prec = .false.
644  y_prec_state = y_prec_state + 1
645  DO i = 1, n
646  y_tail( i ) = 0.0
647  END DO
648  END IF
649 
650  prevnormdx = normdx
651  prev_dz_z = dz_z
652 *
653 * Update soluton.
654 *
655  IF (y_prec_state .LT. extra_y) THEN
656  CALL saxpy( n, 1.0, dy, 1, y(1,j), 1 )
657  ELSE
658  CALL sla_wwaddw( n, y(1,j), y_tail, dy )
659  END IF
660 
661  END DO
662 * Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT.
663  666 CONTINUE
664 *
665 * Set final_* when cnt hits ithresh.
666 *
667  IF ( x_state .EQ. working_state ) final_dx_x = dx_x
668  IF ( z_state .EQ. working_state ) final_dz_z = dz_z
669 *
670 * Compute error bounds.
671 *
672  IF ( n_norms .GE. 1 ) THEN
673  err_bnds_norm( j, la_linrx_err_i ) =
674  $ final_dx_x / (1 - dxratmax)
675  END IF
676  IF ( n_norms .GE. 2 ) THEN
677  err_bnds_comp( j, la_linrx_err_i ) =
678  $ final_dz_z / (1 - dzratmax)
679  END IF
680 *
681 * Compute componentwise relative backward error from formula
682 * max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
683 * where abs(Z) is the componentwise absolute value of the matrix
684 * or vector Z.
685 *
686 * Compute residual RES = B_s - op(A_s) * Y,
687 * op(A) = A, A**T, or A**H depending on TRANS (and type).
688  CALL scopy( n, b( 1, j ), 1, res, 1 )
689  CALL ssymv( uplo, n, -1.0, a, lda, y(1,j), 1, 1.0, res, 1 )
690 
691  DO i = 1, n
692  ayb( i ) = abs( b( i, j ) )
693  END DO
694 *
695 * Compute abs(op(A_s))*abs(Y) + abs(B_s).
696 *
697  CALL sla_syamv( uplo2, n, 1.0,
698  $ a, lda, y(1, j), 1, 1.0, ayb, 1 )
699 
700  CALL sla_lin_berr( n, n, 1, res, ayb, berr_out( j ) )
701 *
702 * End of loop for each RHS.
703 *
704  END DO
705 *
706  RETURN
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine sla_lin_berr(N, NZ, NRHS, RES, AYB, BERR)
SLA_LIN_BERR computes a component-wise relative backward error.
Definition: sla_lin_berr.f:103
integer function ilauplo(UPLO)
ILAUPLO
Definition: ilauplo.f:60
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssymv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SSYMV
Definition: ssymv.f:154
subroutine ssytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SSYTRS
Definition: ssytrs.f:122
subroutine sla_wwaddw(N, X, Y, W)
SLA_WWADDW adds a vector into a doubled-single vector.
Definition: sla_wwaddw.f:83
subroutine sla_syamv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SLA_SYAMV computes a matrix-vector product using a symmetric indefinite matrix to calculate error bou...
Definition: sla_syamv.f:179
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

real function sla_syrpvgrw ( character*1  UPLO,
integer  N,
integer  INFO,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
real, dimension( * )  WORK 
)

SLA_SYRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric indefinite matrix.

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

Purpose:
 SLA_SYRPVGRW computes the reciprocal pivot growth factor
 norm(A)/norm(U). The "max absolute element" norm is used. If this is
 much less than 1, the stability of the LU factorization of the
 (equilibrated) matrix A could be poor. This also means that the
 solution X, estimated condition numbers, and error bounds could be
 unreliable.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
       = 'U':  Upper triangle of A is stored;
       = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]INFO
          INFO is INTEGER
     The value of INFO returned from SSYTRF, .i.e., the pivot in
     column INFO is exactly 0.
[in]A
          A is REAL array, dimension (LDA,N)
     On entry, the N-by-N matrix A.
[in]LDA
          LDA is INTEGER
     The leading dimension of the array A.  LDA >= max(1,N).
[in]AF
          AF is REAL array, dimension (LDAF,N)
     The block diagonal matrix D and the multipliers used to
     obtain the factor U or L as computed by SSYTRF.
[in]LDAF
          LDAF is INTEGER
     The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     Details of the interchanges and the block structure of D
     as determined by SSYTRF.
[in]WORK
          WORK is REAL array, dimension (2*N)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 124 of file sla_syrpvgrw.f.

124 *
125 * -- LAPACK computational routine (version 3.4.2) --
126 * -- LAPACK is a software package provided by Univ. of Tennessee, --
127 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128 * September 2012
129 *
130 * .. Scalar Arguments ..
131  CHARACTER*1 uplo
132  INTEGER n, info, lda, ldaf
133 * ..
134 * .. Array Arguments ..
135  INTEGER ipiv( * )
136  REAL a( lda, * ), af( ldaf, * ), work( * )
137 * ..
138 *
139 * =====================================================================
140 *
141 * .. Local Scalars ..
142  INTEGER ncols, i, j, k, kp
143  REAL amax, umax, rpvgrw, tmp
144  LOGICAL upper
145 * ..
146 * .. Intrinsic Functions ..
147  INTRINSIC abs, max, min
148 * ..
149 * .. External Functions ..
150  EXTERNAL lsame, slaset
151  LOGICAL lsame
152 * ..
153 * .. Executable Statements ..
154 *
155  upper = lsame( 'Upper', uplo )
156  IF ( info.EQ.0 ) THEN
157  IF ( upper ) THEN
158  ncols = 1
159  ELSE
160  ncols = n
161  END IF
162  ELSE
163  ncols = info
164  END IF
165 
166  rpvgrw = 1.0
167  DO i = 1, 2*n
168  work( i ) = 0.0
169  END DO
170 *
171 * Find the max magnitude entry of each column of A. Compute the max
172 * for all N columns so we can apply the pivot permutation while
173 * looping below. Assume a full factorization is the common case.
174 *
175  IF ( upper ) THEN
176  DO j = 1, n
177  DO i = 1, j
178  work( n+i ) = max( abs( a( i, j ) ), work( n+i ) )
179  work( n+j ) = max( abs( a( i, j ) ), work( n+j ) )
180  END DO
181  END DO
182  ELSE
183  DO j = 1, n
184  DO i = j, n
185  work( n+i ) = max( abs( a( i, j ) ), work( n+i ) )
186  work( n+j ) = max( abs( a( i, j ) ), work( n+j ) )
187  END DO
188  END DO
189  END IF
190 *
191 * Now find the max magnitude entry of each column of U or L. Also
192 * permute the magnitudes of A above so they're in the same order as
193 * the factor.
194 *
195 * The iteration orders and permutations were copied from ssytrs.
196 * Calls to SSWAP would be severe overkill.
197 *
198  IF ( upper ) THEN
199  k = n
200  DO WHILE ( k .LT. ncols .AND. k.GT.0 )
201  IF ( ipiv( k ).GT.0 ) THEN
202 ! 1x1 pivot
203  kp = ipiv( k )
204  IF ( kp .NE. k ) THEN
205  tmp = work( n+k )
206  work( n+k ) = work( n+kp )
207  work( n+kp ) = tmp
208  END IF
209  DO i = 1, k
210  work( k ) = max( abs( af( i, k ) ), work( k ) )
211  END DO
212  k = k - 1
213  ELSE
214 ! 2x2 pivot
215  kp = -ipiv( k )
216  tmp = work( n+k-1 )
217  work( n+k-1 ) = work( n+kp )
218  work( n+kp ) = tmp
219  DO i = 1, k-1
220  work( k ) = max( abs( af( i, k ) ), work( k ) )
221  work( k-1 ) = max( abs( af( i, k-1 ) ), work( k-1 ) )
222  END DO
223  work( k ) = max( abs( af( k, k ) ), work( k ) )
224  k = k - 2
225  END IF
226  END DO
227  k = ncols
228  DO WHILE ( k .LE. n )
229  IF ( ipiv( k ).GT.0 ) THEN
230  kp = ipiv( k )
231  IF ( kp .NE. k ) THEN
232  tmp = work( n+k )
233  work( n+k ) = work( n+kp )
234  work( n+kp ) = tmp
235  END IF
236  k = k + 1
237  ELSE
238  kp = -ipiv( k )
239  tmp = work( n+k )
240  work( n+k ) = work( n+kp )
241  work( n+kp ) = tmp
242  k = k + 2
243  END IF
244  END DO
245  ELSE
246  k = 1
247  DO WHILE ( k .LE. ncols )
248  IF ( ipiv( k ).GT.0 ) THEN
249 ! 1x1 pivot
250  kp = ipiv( k )
251  IF ( kp .NE. k ) THEN
252  tmp = work( n+k )
253  work( n+k ) = work( n+kp )
254  work( n+kp ) = tmp
255  END IF
256  DO i = k, n
257  work( k ) = max( abs( af( i, k ) ), work( k ) )
258  END DO
259  k = k + 1
260  ELSE
261 ! 2x2 pivot
262  kp = -ipiv( k )
263  tmp = work( n+k+1 )
264  work( n+k+1 ) = work( n+kp )
265  work( n+kp ) = tmp
266  DO i = k+1, n
267  work( k ) = max( abs( af( i, k ) ), work( k ) )
268  work( k+1 ) = max( abs( af(i, k+1 ) ), work( k+1 ) )
269  END DO
270  work( k ) = max( abs( af( k, k ) ), work( k ) )
271  k = k + 2
272  END IF
273  END DO
274  k = ncols
275  DO WHILE ( k .GE. 1 )
276  IF ( ipiv( k ).GT.0 ) THEN
277  kp = ipiv( k )
278  IF ( kp .NE. k ) THEN
279  tmp = work( n+k )
280  work( n+k ) = work( n+kp )
281  work( n+kp ) = tmp
282  END IF
283  k = k - 1
284  ELSE
285  kp = -ipiv( k )
286  tmp = work( n+k )
287  work( n+k ) = work( n+kp )
288  work( n+kp ) = tmp
289  k = k - 2
290  ENDIF
291  END DO
292  END IF
293 *
294 * Compute the *inverse* of the max element growth factor. Dividing
295 * by zero would imply the largest entry of the factor's column is
296 * zero. Than can happen when either the column of A is zero or
297 * massive pivots made the factor underflow to zero. Neither counts
298 * as growth in itself, so simply ignore terms with zero
299 * denominators.
300 *
301  IF ( upper ) THEN
302  DO i = ncols, n
303  umax = work( i )
304  amax = work( n+i )
305  IF ( umax /= 0.0 ) THEN
306  rpvgrw = min( amax / umax, rpvgrw )
307  END IF
308  END DO
309  ELSE
310  DO i = 1, ncols
311  umax = work( i )
312  amax = work( n+i )
313  IF ( umax /= 0.0 ) THEN
314  rpvgrw = min( amax / umax, rpvgrw )
315  END IF
316  END DO
317  END IF
318 
319  sla_syrpvgrw = rpvgrw
real function sla_syrpvgrw(UPLO, N, INFO, A, LDA, AF, LDAF, IPIV, WORK)
SLA_SYRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric indefinite m...
Definition: sla_syrpvgrw.f:124
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: slaset.f:112

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine slasyf ( character  UPLO,
integer  N,
integer  NB,
integer  KB,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real, dimension( ldw, * )  W,
integer  LDW,
integer  INFO 
)

SLASYF computes a partial factorization of a real symmetric matrix using the Bunch-Kaufman diagonal pivoting method.

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

Purpose:
 SLASYF computes a partial factorization of a real symmetric matrix A
 using the Bunch-Kaufman diagonal pivoting method. The partial
 factorization has the form:

 A  =  ( I  U12 ) ( A11  0  ) (  I       0    )  if UPLO = 'U', or:
       ( 0  U22 ) (  0   D  ) ( U12**T U22**T )

 A  =  ( L11  0 ) (  D   0  ) ( L11**T L21**T )  if UPLO = 'L'
       ( L21  I ) (  0  A22 ) (  0       I    )

 where the order of D is at most NB. The actual order is returned in
 the argument KB, and is either NB or NB-1, or N if N <= NB.

 SLASYF is an auxiliary routine called by SSYTRF. It uses blocked code
 (calling Level 3 BLAS) to update the submatrix A11 (if UPLO = 'U') or
 A22 (if UPLO = 'L').
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]NB
          NB is INTEGER
          The maximum number of columns of the matrix A that should be
          factored.  NB should be at least 2 to allow for 2-by-2 pivot
          blocks.
[out]KB
          KB is INTEGER
          The number of columns of A that were actually factored.
          KB is either NB-1 or NB, or N if N <= NB.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.
          On exit, A contains details of the partial factorization.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D.

          If UPLO = 'U':
             Only the last KB elements of IPIV are set.

             If IPIV(k) > 0, then rows and columns k and IPIV(k) were
             interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) = IPIV(k-1) < 0, then rows and columns
             k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
             is a 2-by-2 diagonal block.

          If UPLO = 'L':
             Only the first KB elements of IPIV are set.

             If IPIV(k) > 0, then rows and columns k and IPIV(k) were
             interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) = IPIV(k+1) < 0, then rows and columns
             k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1)
             is a 2-by-2 diagonal block.
[out]W
          W is REAL array, dimension (LDW,NB)
[in]LDW
          LDW is INTEGER
          The leading dimension of the array W.  LDW >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          > 0: if INFO = k, D(k,k) is exactly zero.  The factorization
               has been completed, but the block diagonal matrix D is
               exactly singular.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2013
Contributors:
  November 2013,  Igor Kozachenko,
                  Computer Science Division,
                  University of California, Berkeley

Definition at line 178 of file slasyf.f.

178 *
179 * -- LAPACK computational routine (version 3.5.0) --
180 * -- LAPACK is a software package provided by Univ. of Tennessee, --
181 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
182 * November 2013
183 *
184 * .. Scalar Arguments ..
185  CHARACTER uplo
186  INTEGER info, kb, lda, ldw, n, nb
187 * ..
188 * .. Array Arguments ..
189  INTEGER ipiv( * )
190  REAL a( lda, * ), w( ldw, * )
191 * ..
192 *
193 * =====================================================================
194 *
195 * .. Parameters ..
196  REAL zero, one
197  parameter( zero = 0.0e+0, one = 1.0e+0 )
198  REAL eight, sevten
199  parameter( eight = 8.0e+0, sevten = 17.0e+0 )
200 * ..
201 * .. Local Scalars ..
202  INTEGER imax, j, jb, jj, jmax, jp, k, kk, kkw, kp,
203  $ kstep, kw
204  REAL absakk, alpha, colmax, d11, d21, d22, r1,
205  $ rowmax, t
206 * ..
207 * .. External Functions ..
208  LOGICAL lsame
209  INTEGER isamax
210  EXTERNAL lsame, isamax
211 * ..
212 * .. External Subroutines ..
213  EXTERNAL scopy, sgemm, sgemv, sscal, sswap
214 * ..
215 * .. Intrinsic Functions ..
216  INTRINSIC abs, max, min, sqrt
217 * ..
218 * .. Executable Statements ..
219 *
220  info = 0
221 *
222 * Initialize ALPHA for use in choosing pivot block size.
223 *
224  alpha = ( one+sqrt( sevten ) ) / eight
225 *
226  IF( lsame( uplo, 'U' ) ) THEN
227 *
228 * Factorize the trailing columns of A using the upper triangle
229 * of A and working backwards, and compute the matrix W = U12*D
230 * for use in updating A11
231 *
232 * K is the main loop index, decreasing from N in steps of 1 or 2
233 *
234 * KW is the column of W which corresponds to column K of A
235 *
236  k = n
237  10 CONTINUE
238  kw = nb + k - n
239 *
240 * Exit from loop
241 *
242  IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
243  $ GO TO 30
244 *
245 * Copy column K of A to column KW of W and update it
246 *
247  CALL scopy( k, a( 1, k ), 1, w( 1, kw ), 1 )
248  IF( k.LT.n )
249  $ CALL sgemv( 'No transpose', k, n-k, -one, a( 1, k+1 ), lda,
250  $ w( k, kw+1 ), ldw, one, w( 1, kw ), 1 )
251 *
252  kstep = 1
253 *
254 * Determine rows and columns to be interchanged and whether
255 * a 1-by-1 or 2-by-2 pivot block will be used
256 *
257  absakk = abs( w( k, kw ) )
258 *
259 * IMAX is the row-index of the largest off-diagonal element in
260 * column K, and COLMAX is its absolute value.
261 * Determine both COLMAX and IMAX.
262 *
263  IF( k.GT.1 ) THEN
264  imax = isamax( k-1, w( 1, kw ), 1 )
265  colmax = abs( w( imax, kw ) )
266  ELSE
267  colmax = zero
268  END IF
269 *
270  IF( max( absakk, colmax ).EQ.zero ) THEN
271 *
272 * Column K is zero or underflow: set INFO and continue
273 *
274  IF( info.EQ.0 )
275  $ info = k
276  kp = k
277  ELSE
278  IF( absakk.GE.alpha*colmax ) THEN
279 *
280 * no interchange, use 1-by-1 pivot block
281 *
282  kp = k
283  ELSE
284 *
285 * Copy column IMAX to column KW-1 of W and update it
286 *
287  CALL scopy( imax, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
288  CALL scopy( k-imax, a( imax, imax+1 ), lda,
289  $ w( imax+1, kw-1 ), 1 )
290  IF( k.LT.n )
291  $ CALL sgemv( 'No transpose', k, n-k, -one, a( 1, k+1 ),
292  $ lda, w( imax, kw+1 ), ldw, one,
293  $ w( 1, kw-1 ), 1 )
294 *
295 * JMAX is the column-index of the largest off-diagonal
296 * element in row IMAX, and ROWMAX is its absolute value
297 *
298  jmax = imax + isamax( k-imax, w( imax+1, kw-1 ), 1 )
299  rowmax = abs( w( jmax, kw-1 ) )
300  IF( imax.GT.1 ) THEN
301  jmax = isamax( imax-1, w( 1, kw-1 ), 1 )
302  rowmax = max( rowmax, abs( w( jmax, kw-1 ) ) )
303  END IF
304 *
305  IF( absakk.GE.alpha*colmax*( colmax / rowmax ) ) THEN
306 *
307 * no interchange, use 1-by-1 pivot block
308 *
309  kp = k
310  ELSE IF( abs( w( imax, kw-1 ) ).GE.alpha*rowmax ) THEN
311 *
312 * interchange rows and columns K and IMAX, use 1-by-1
313 * pivot block
314 *
315  kp = imax
316 *
317 * copy column KW-1 of W to column KW of W
318 *
319  CALL scopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
320  ELSE
321 *
322 * interchange rows and columns K-1 and IMAX, use 2-by-2
323 * pivot block
324 *
325  kp = imax
326  kstep = 2
327  END IF
328  END IF
329 *
330 * ============================================================
331 *
332 * KK is the column of A where pivoting step stopped
333 *
334  kk = k - kstep + 1
335 *
336 * KKW is the column of W which corresponds to column KK of A
337 *
338  kkw = nb + kk - n
339 *
340 * Interchange rows and columns KP and KK.
341 * Updated column KP is already stored in column KKW of W.
342 *
343  IF( kp.NE.kk ) THEN
344 *
345 * Copy non-updated column KK to column KP of submatrix A
346 * at step K. No need to copy element into column K
347 * (or K and K-1 for 2-by-2 pivot) of A, since these columns
348 * will be later overwritten.
349 *
350  a( kp, kp ) = a( kk, kk )
351  CALL scopy( kk-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
352  $ lda )
353  IF( kp.GT.1 )
354  $ CALL scopy( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
355 *
356 * Interchange rows KK and KP in last K+1 to N columns of A
357 * (columns K (or K and K-1 for 2-by-2 pivot) of A will be
358 * later overwritten). Interchange rows KK and KP
359 * in last KKW to NB columns of W.
360 *
361  IF( k.LT.n )
362  $ CALL sswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
363  $ lda )
364  CALL sswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
365  $ ldw )
366  END IF
367 *
368  IF( kstep.EQ.1 ) THEN
369 *
370 * 1-by-1 pivot block D(k): column kw of W now holds
371 *
372 * W(kw) = U(k)*D(k),
373 *
374 * where U(k) is the k-th column of U
375 *
376 * Store subdiag. elements of column U(k)
377 * and 1-by-1 block D(k) in column k of A.
378 * NOTE: Diagonal element U(k,k) is a UNIT element
379 * and not stored.
380 * A(k,k) := D(k,k) = W(k,kw)
381 * A(1:k-1,k) := U(1:k-1,k) = W(1:k-1,kw)/D(k,k)
382 *
383  CALL scopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
384  r1 = one / a( k, k )
385  CALL sscal( k-1, r1, a( 1, k ), 1 )
386 *
387  ELSE
388 *
389 * 2-by-2 pivot block D(k): columns kw and kw-1 of W now hold
390 *
391 * ( W(kw-1) W(kw) ) = ( U(k-1) U(k) )*D(k)
392 *
393 * where U(k) and U(k-1) are the k-th and (k-1)-th columns
394 * of U
395 *
396 * Store U(1:k-2,k-1) and U(1:k-2,k) and 2-by-2
397 * block D(k-1:k,k-1:k) in columns k-1 and k of A.
398 * NOTE: 2-by-2 diagonal block U(k-1:k,k-1:k) is a UNIT
399 * block and not stored.
400 * A(k-1:k,k-1:k) := D(k-1:k,k-1:k) = W(k-1:k,kw-1:kw)
401 * A(1:k-2,k-1:k) := U(1:k-2,k:k-1:k) =
402 * = W(1:k-2,kw-1:kw) * ( D(k-1:k,k-1:k)**(-1) )
403 *
404  IF( k.GT.2 ) THEN
405 *
406 * Compose the columns of the inverse of 2-by-2 pivot
407 * block D in the following way to reduce the number
408 * of FLOPS when we myltiply panel ( W(kw-1) W(kw) ) by
409 * this inverse
410 *
411 * D**(-1) = ( d11 d21 )**(-1) =
412 * ( d21 d22 )
413 *
414 * = 1/(d11*d22-d21**2) * ( ( d22 ) (-d21 ) ) =
415 * ( (-d21 ) ( d11 ) )
416 *
417 * = 1/d21 * 1/((d11/d21)*(d22/d21)-1) *
418 *
419 * * ( ( d22/d21 ) ( -1 ) ) =
420 * ( ( -1 ) ( d11/d21 ) )
421 *
422 * = 1/d21 * 1/(D22*D11-1) * ( ( D11 ) ( -1 ) ) =
423 * ( ( -1 ) ( D22 ) )
424 *
425 * = 1/d21 * T * ( ( D11 ) ( -1 ) )
426 * ( ( -1 ) ( D22 ) )
427 *
428 * = D21 * ( ( D11 ) ( -1 ) )
429 * ( ( -1 ) ( D22 ) )
430 *
431  d21 = w( k-1, kw )
432  d11 = w( k, kw ) / d21
433  d22 = w( k-1, kw-1 ) / d21
434  t = one / ( d11*d22-one )
435  d21 = t / d21
436 *
437 * Update elements in columns A(k-1) and A(k) as
438 * dot products of rows of ( W(kw-1) W(kw) ) and columns
439 * of D**(-1)
440 *
441  DO 20 j = 1, k - 2
442  a( j, k-1 ) = d21*( d11*w( j, kw-1 )-w( j, kw ) )
443  a( j, k ) = d21*( d22*w( j, kw )-w( j, kw-1 ) )
444  20 CONTINUE
445  END IF
446 *
447 * Copy D(k) to A
448 *
449  a( k-1, k-1 ) = w( k-1, kw-1 )
450  a( k-1, k ) = w( k-1, kw )
451  a( k, k ) = w( k, kw )
452 *
453  END IF
454 *
455  END IF
456 *
457 * Store details of the interchanges in IPIV
458 *
459  IF( kstep.EQ.1 ) THEN
460  ipiv( k ) = kp
461  ELSE
462  ipiv( k ) = -kp
463  ipiv( k-1 ) = -kp
464  END IF
465 *
466 * Decrease K and return to the start of the main loop
467 *
468  k = k - kstep
469  GO TO 10
470 *
471  30 CONTINUE
472 *
473 * Update the upper triangle of A11 (= A(1:k,1:k)) as
474 *
475 * A11 := A11 - U12*D*U12**T = A11 - U12*W**T
476 *
477 * computing blocks of NB columns at a time
478 *
479  DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
480  jb = min( nb, k-j+1 )
481 *
482 * Update the upper triangle of the diagonal block
483 *
484  DO 40 jj = j, j + jb - 1
485  CALL sgemv( 'No transpose', jj-j+1, n-k, -one,
486  $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, one,
487  $ a( j, jj ), 1 )
488  40 CONTINUE
489 *
490 * Update the rectangular superdiagonal block
491 *
492  CALL sgemm( 'No transpose', 'Transpose', j-1, jb, n-k, -one,
493  $ a( 1, k+1 ), lda, w( j, kw+1 ), ldw, one,
494  $ a( 1, j ), lda )
495  50 CONTINUE
496 *
497 * Put U12 in standard form by partially undoing the interchanges
498 * in columns k+1:n looping backwards from k+1 to n
499 *
500  j = k + 1
501  60 CONTINUE
502 *
503 * Undo the interchanges (if any) of rows JJ and JP at each
504 * step J
505 *
506 * (Here, J is a diagonal index)
507  jj = j
508  jp = ipiv( j )
509  IF( jp.LT.0 ) THEN
510  jp = -jp
511 * (Here, J is a diagonal index)
512  j = j + 1
513  END IF
514 * (NOTE: Here, J is used to determine row length. Length N-J+1
515 * of the rows to swap back doesn't include diagonal element)
516  j = j + 1
517  IF( jp.NE.jj .AND. j.LE.n )
518  $ CALL sswap( n-j+1, a( jp, j ), lda, a( jj, j ), lda )
519  IF( j.LT.n )
520  $ GO TO 60
521 *
522 * Set KB to the number of columns factorized
523 *
524  kb = n - k
525 *
526  ELSE
527 *
528 * Factorize the leading columns of A using the lower triangle
529 * of A and working forwards, and compute the matrix W = L21*D
530 * for use in updating A22
531 *
532 * K is the main loop index, increasing from 1 in steps of 1 or 2
533 *
534  k = 1
535  70 CONTINUE
536 *
537 * Exit from loop
538 *
539  IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
540  $ GO TO 90
541 *
542 * Copy column K of A to column K of W and update it
543 *
544  CALL scopy( n-k+1, a( k, k ), 1, w( k, k ), 1 )
545  CALL sgemv( 'No transpose', n-k+1, k-1, -one, a( k, 1 ), lda,
546  $ w( k, 1 ), ldw, one, w( k, k ), 1 )
547 *
548  kstep = 1
549 *
550 * Determine rows and columns to be interchanged and whether
551 * a 1-by-1 or 2-by-2 pivot block will be used
552 *
553  absakk = abs( w( k, k ) )
554 *
555 * IMAX is the row-index of the largest off-diagonal element in
556 * column K, and COLMAX is its absolute value.
557 * Determine both COLMAX and IMAX.
558 *
559  IF( k.LT.n ) THEN
560  imax = k + isamax( n-k, w( k+1, k ), 1 )
561  colmax = abs( w( imax, k ) )
562  ELSE
563  colmax = zero
564  END IF
565 *
566  IF( max( absakk, colmax ).EQ.zero ) THEN
567 *
568 * Column K is zero or underflow: set INFO and continue
569 *
570  IF( info.EQ.0 )
571  $ info = k
572  kp = k
573  ELSE
574  IF( absakk.GE.alpha*colmax ) THEN
575 *
576 * no interchange, use 1-by-1 pivot block
577 *
578  kp = k
579  ELSE
580 *
581 * Copy column IMAX to column K+1 of W and update it
582 *
583  CALL scopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1 )
584  CALL scopy( n-imax+1, a( imax, imax ), 1, w( imax, k+1 ),
585  $ 1 )
586  CALL sgemv( 'No transpose', n-k+1, k-1, -one, a( k, 1 ),
587  $ lda, w( imax, 1 ), ldw, one, w( k, k+1 ), 1 )
588 *
589 * JMAX is the column-index of the largest off-diagonal
590 * element in row IMAX, and ROWMAX is its absolute value
591 *
592  jmax = k - 1 + isamax( imax-k, w( k, k+1 ), 1 )
593  rowmax = abs( w( jmax, k+1 ) )
594  IF( imax.LT.n ) THEN
595  jmax = imax + isamax( n-imax, w( imax+1, k+1 ), 1 )
596  rowmax = max( rowmax, abs( w( jmax, k+1 ) ) )
597  END IF
598 *
599  IF( absakk.GE.alpha*colmax*( colmax / rowmax ) ) THEN
600 *
601 * no interchange, use 1-by-1 pivot block
602 *
603  kp = k
604  ELSE IF( abs( w( imax, k+1 ) ).GE.alpha*rowmax ) THEN
605 *
606 * interchange rows and columns K and IMAX, use 1-by-1
607 * pivot block
608 *
609  kp = imax
610 *
611 * copy column K+1 of W to column K of W
612 *
613  CALL scopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
614  ELSE
615 *
616 * interchange rows and columns K+1 and IMAX, use 2-by-2
617 * pivot block
618 *
619  kp = imax
620  kstep = 2
621  END IF
622  END IF
623 *
624 * ============================================================
625 *
626 * KK is the column of A where pivoting step stopped
627 *
628  kk = k + kstep - 1
629 *
630 * Interchange rows and columns KP and KK.
631 * Updated column KP is already stored in column KK of W.
632 *
633  IF( kp.NE.kk ) THEN
634 *
635 * Copy non-updated column KK to column KP of submatrix A
636 * at step K. No need to copy element into column K
637 * (or K and K+1 for 2-by-2 pivot) of A, since these columns
638 * will be later overwritten.
639 *
640  a( kp, kp ) = a( kk, kk )
641  CALL scopy( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
642  $ lda )
643  IF( kp.LT.n )
644  $ CALL scopy( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
645 *
646 * Interchange rows KK and KP in first K-1 columns of A
647 * (columns K (or K and K+1 for 2-by-2 pivot) of A will be
648 * later overwritten). Interchange rows KK and KP
649 * in first KK columns of W.
650 *
651  IF( k.GT.1 )
652  $ CALL sswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
653  CALL sswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
654  END IF
655 *
656  IF( kstep.EQ.1 ) THEN
657 *
658 * 1-by-1 pivot block D(k): column k of W now holds
659 *
660 * W(k) = L(k)*D(k),
661 *
662 * where L(k) is the k-th column of L
663 *
664 * Store subdiag. elements of column L(k)
665 * and 1-by-1 block D(k) in column k of A.
666 * (NOTE: Diagonal element L(k,k) is a UNIT element
667 * and not stored)
668 * A(k,k) := D(k,k) = W(k,k)
669 * A(k+1:N,k) := L(k+1:N,k) = W(k+1:N,k)/D(k,k)
670 *
671  CALL scopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
672  IF( k.LT.n ) THEN
673  r1 = one / a( k, k )
674  CALL sscal( n-k, r1, a( k+1, k ), 1 )
675  END IF
676 *
677  ELSE
678 *
679 * 2-by-2 pivot block D(k): columns k and k+1 of W now hold
680 *
681 * ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
682 *
683 * where L(k) and L(k+1) are the k-th and (k+1)-th columns
684 * of L
685 *
686 * Store L(k+2:N,k) and L(k+2:N,k+1) and 2-by-2
687 * block D(k:k+1,k:k+1) in columns k and k+1 of A.
688 * (NOTE: 2-by-2 diagonal block L(k:k+1,k:k+1) is a UNIT
689 * block and not stored)
690 * A(k:k+1,k:k+1) := D(k:k+1,k:k+1) = W(k:k+1,k:k+1)
691 * A(k+2:N,k:k+1) := L(k+2:N,k:k+1) =
692 * = W(k+2:N,k:k+1) * ( D(k:k+1,k:k+1)**(-1) )
693 *
694  IF( k.LT.n-1 ) THEN
695 *
696 * Compose the columns of the inverse of 2-by-2 pivot
697 * block D in the following way to reduce the number
698 * of FLOPS when we myltiply panel ( W(k) W(k+1) ) by
699 * this inverse
700 *
701 * D**(-1) = ( d11 d21 )**(-1) =
702 * ( d21 d22 )
703 *
704 * = 1/(d11*d22-d21**2) * ( ( d22 ) (-d21 ) ) =
705 * ( (-d21 ) ( d11 ) )
706 *
707 * = 1/d21 * 1/((d11/d21)*(d22/d21)-1) *
708 *
709 * * ( ( d22/d21 ) ( -1 ) ) =
710 * ( ( -1 ) ( d11/d21 ) )
711 *
712 * = 1/d21 * 1/(D22*D11-1) * ( ( D11 ) ( -1 ) ) =
713 * ( ( -1 ) ( D22 ) )
714 *
715 * = 1/d21 * T * ( ( D11 ) ( -1 ) )
716 * ( ( -1 ) ( D22 ) )
717 *
718 * = D21 * ( ( D11 ) ( -1 ) )
719 * ( ( -1 ) ( D22 ) )
720 *
721  d21 = w( k+1, k )
722  d11 = w( k+1, k+1 ) / d21
723  d22 = w( k, k ) / d21
724  t = one / ( d11*d22-one )
725  d21 = t / d21
726 *
727 * Update elements in columns A(k) and A(k+1) as
728 * dot products of rows of ( W(k) W(k+1) ) and columns
729 * of D**(-1)
730 *
731  DO 80 j = k + 2, n
732  a( j, k ) = d21*( d11*w( j, k )-w( j, k+1 ) )
733  a( j, k+1 ) = d21*( d22*w( j, k+1 )-w( j, k ) )
734  80 CONTINUE
735  END IF
736 *
737 * Copy D(k) to A
738 *
739  a( k, k ) = w( k, k )
740  a( k+1, k ) = w( k+1, k )
741  a( k+1, k+1 ) = w( k+1, k+1 )
742 *
743  END IF
744 *
745  END IF
746 *
747 * Store details of the interchanges in IPIV
748 *
749  IF( kstep.EQ.1 ) THEN
750  ipiv( k ) = kp
751  ELSE
752  ipiv( k ) = -kp
753  ipiv( k+1 ) = -kp
754  END IF
755 *
756 * Increase K and return to the start of the main loop
757 *
758  k = k + kstep
759  GO TO 70
760 *
761  90 CONTINUE
762 *
763 * Update the lower triangle of A22 (= A(k:n,k:n)) as
764 *
765 * A22 := A22 - L21*D*L21**T = A22 - L21*W**T
766 *
767 * computing blocks of NB columns at a time
768 *
769  DO 110 j = k, n, nb
770  jb = min( nb, n-j+1 )
771 *
772 * Update the lower triangle of the diagonal block
773 *
774  DO 100 jj = j, j + jb - 1
775  CALL sgemv( 'No transpose', j+jb-jj, k-1, -one,
776  $ a( jj, 1 ), lda, w( jj, 1 ), ldw, one,
777  $ a( jj, jj ), 1 )
778  100 CONTINUE
779 *
780 * Update the rectangular subdiagonal block
781 *
782  IF( j+jb.LE.n )
783  $ CALL sgemm( 'No transpose', 'Transpose', n-j-jb+1, jb,
784  $ k-1, -one, a( j+jb, 1 ), lda, w( j, 1 ), ldw,
785  $ one, a( j+jb, j ), lda )
786  110 CONTINUE
787 *
788 * Put L21 in standard form by partially undoing the interchanges
789 * of rows in columns 1:k-1 looping backwards from k-1 to 1
790 *
791  j = k - 1
792  120 CONTINUE
793 *
794 * Undo the interchanges (if any) of rows JJ and JP at each
795 * step J
796 *
797 * (Here, J is a diagonal index)
798  jj = j
799  jp = ipiv( j )
800  IF( jp.LT.0 ) THEN
801  jp = -jp
802 * (Here, J is a diagonal index)
803  j = j - 1
804  END IF
805 * (NOTE: Here, J is used to determine row length. Length J
806 * of the rows to swap back doesn't include diagonal element)
807  j = j - 1
808  IF( jp.NE.jj .AND. j.GE.1 )
809  $ CALL sswap( j, a( jp, 1 ), lda, a( jj, 1 ), lda )
810  IF( j.GT.1 )
811  $ GO TO 120
812 *
813 * Set KB to the number of columns factorized
814 *
815  kb = k - 1
816 *
817  END IF
818  RETURN
819 *
820 * End of SLASYF
821 *
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
Definition: sgemv.f:158
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine slasyf_rook ( character  UPLO,
integer  N,
integer  NB,
integer  KB,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real, dimension( ldw, * )  W,
integer  LDW,
integer  INFO 
)

SLASYF_ROOK computes a partial factorization of a real symmetric matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method.

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

Purpose:
 SLASYF_ROOK computes a partial factorization of a real symmetric
 matrix A using the bounded Bunch-Kaufman ("rook") diagonal
 pivoting method. The partial factorization has the form:

 A  =  ( I  U12 ) ( A11  0  ) (  I       0    )  if UPLO = 'U', or:
       ( 0  U22 ) (  0   D  ) ( U12**T U22**T )

 A  =  ( L11  0 ) (  D   0  ) ( L11**T L21**T )  if UPLO = 'L'
       ( L21  I ) (  0  A22 ) (  0       I    )

 where the order of D is at most NB. The actual order is returned in
 the argument KB, and is either NB or NB-1, or N if N <= NB.

 SLASYF_ROOK is an auxiliary routine called by SSYTRF_ROOK. It uses
 blocked code (calling Level 3 BLAS) to update the submatrix
 A11 (if UPLO = 'U') or A22 (if UPLO = 'L').
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]NB
          NB is INTEGER
          The maximum number of columns of the matrix A that should be
          factored.  NB should be at least 2 to allow for 2-by-2 pivot
          blocks.
[out]KB
          KB is INTEGER
          The number of columns of A that were actually factored.
          KB is either NB-1 or NB, or N if N <= NB.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.
          On exit, A contains details of the partial factorization.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D.

          If UPLO = 'U':
             Only the last KB elements of IPIV are set.

             If IPIV(k) > 0, then rows and columns k and IPIV(k) were
             interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) < 0 and IPIV(k-1) < 0, then rows and
             columns k and -IPIV(k) were interchanged and rows and
             columns k-1 and -IPIV(k-1) were inerchaged,
             D(k-1:k,k-1:k) is a 2-by-2 diagonal block.

          If UPLO = 'L':
             Only the first KB elements of IPIV are set.

             If IPIV(k) > 0, then rows and columns k and IPIV(k)
             were interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) < 0 and IPIV(k+1) < 0, then rows and
             columns k and -IPIV(k) were interchanged and rows and
             columns k+1 and -IPIV(k+1) were inerchaged,
             D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
[out]W
          W is REAL array, dimension (LDW,NB)
[in]LDW
          LDW is INTEGER
          The leading dimension of the array W.  LDW >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          > 0: if INFO = k, D(k,k) is exactly zero.  The factorization
               has been completed, but the block diagonal matrix D is
               exactly singular.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2013
Contributors:
  November 2013,     Igor Kozachenko,
                  Computer Science Division,
                  University of California, Berkeley

  September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas,
                  School of Mathematics,
                  University of Manchester

Definition at line 186 of file slasyf_rook.f.

186 *
187 * -- LAPACK computational routine (version 3.5.0) --
188 * -- LAPACK is a software package provided by Univ. of Tennessee, --
189 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
190 * November 2013
191 *
192 * .. Scalar Arguments ..
193  CHARACTER uplo
194  INTEGER info, kb, lda, ldw, n, nb
195 * ..
196 * .. Array Arguments ..
197  INTEGER ipiv( * )
198  REAL a( lda, * ), w( ldw, * )
199 * ..
200 *
201 * =====================================================================
202 *
203 * .. Parameters ..
204  REAL zero, one
205  parameter( zero = 0.0e+0, one = 1.0e+0 )
206  REAL eight, sevten
207  parameter( eight = 8.0e+0, sevten = 17.0e+0 )
208 * ..
209 * .. Local Scalars ..
210  LOGICAL done
211  INTEGER imax, itemp, j, jb, jj, jmax, jp1, jp2, k, kk,
212  $ kw, kkw, kp, kstep, p, ii
213 
214  REAL absakk, alpha, colmax, d11, d12, d21, d22,
215  $ stemp, r1, rowmax, t, sfmin
216 * ..
217 * .. External Functions ..
218  LOGICAL lsame
219  INTEGER isamax
220  REAL slamch
221  EXTERNAL lsame, isamax, slamch
222 * ..
223 * .. External Subroutines ..
224  EXTERNAL scopy, sgemm, sgemv, sscal, sswap
225 * ..
226 * .. Intrinsic Functions ..
227  INTRINSIC abs, max, min, sqrt
228 * ..
229 * .. Executable Statements ..
230 *
231  info = 0
232 *
233 * Initialize ALPHA for use in choosing pivot block size.
234 *
235  alpha = ( one+sqrt( sevten ) ) / eight
236 *
237 * Compute machine safe minimum
238 *
239  sfmin = slamch( 'S' )
240 *
241  IF( lsame( uplo, 'U' ) ) THEN
242 *
243 * Factorize the trailing columns of A using the upper triangle
244 * of A and working backwards, and compute the matrix W = U12*D
245 * for use in updating A11
246 *
247 * K is the main loop index, decreasing from N in steps of 1 or 2
248 *
249  k = n
250  10 CONTINUE
251 *
252 * KW is the column of W which corresponds to column K of A
253 *
254  kw = nb + k - n
255 *
256 * Exit from loop
257 *
258  IF( ( k.LE.n-nb+1 .AND. nb.LT.n ) .OR. k.LT.1 )
259  $ GO TO 30
260 *
261  kstep = 1
262  p = k
263 *
264 * Copy column K of A to column KW of W and update it
265 *
266  CALL scopy( k, a( 1, k ), 1, w( 1, kw ), 1 )
267  IF( k.LT.n )
268  $ CALL sgemv( 'No transpose', k, n-k, -one, a( 1, k+1 ),
269  $ lda, w( k, kw+1 ), ldw, one, w( 1, kw ), 1 )
270 *
271 * Determine rows and columns to be interchanged and whether
272 * a 1-by-1 or 2-by-2 pivot block will be used
273 *
274  absakk = abs( w( k, kw ) )
275 *
276 * IMAX is the row-index of the largest off-diagonal element in
277 * column K, and COLMAX is its absolute value.
278 * Determine both COLMAX and IMAX.
279 *
280  IF( k.GT.1 ) THEN
281  imax = isamax( k-1, w( 1, kw ), 1 )
282  colmax = abs( w( imax, kw ) )
283  ELSE
284  colmax = zero
285  END IF
286 *
287  IF( max( absakk, colmax ).EQ.zero ) THEN
288 *
289 * Column K is zero or underflow: set INFO and continue
290 *
291  IF( info.EQ.0 )
292  $ info = k
293  kp = k
294  CALL scopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
295  ELSE
296 *
297 * ============================================================
298 *
299 * Test for interchange
300 *
301 * Equivalent to testing for ABSAKK.GE.ALPHA*COLMAX
302 * (used to handle NaN and Inf)
303 *
304  IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
305 *
306 * no interchange, use 1-by-1 pivot block
307 *
308  kp = k
309 *
310  ELSE
311 *
312  done = .false.
313 *
314 * Loop until pivot found
315 *
316  12 CONTINUE
317 *
318 * Begin pivot search loop body
319 *
320 *
321 * Copy column IMAX to column KW-1 of W and update it
322 *
323  CALL scopy( imax, a( 1, imax ), 1, w( 1, kw-1 ), 1 )
324  CALL scopy( k-imax, a( imax, imax+1 ), lda,
325  $ w( imax+1, kw-1 ), 1 )
326 *
327  IF( k.LT.n )
328  $ CALL sgemv( 'No transpose', k, n-k, -one,
329  $ a( 1, k+1 ), lda, w( imax, kw+1 ), ldw,
330  $ one, w( 1, kw-1 ), 1 )
331 *
332 * JMAX is the column-index of the largest off-diagonal
333 * element in row IMAX, and ROWMAX is its absolute value.
334 * Determine both ROWMAX and JMAX.
335 *
336  IF( imax.NE.k ) THEN
337  jmax = imax + isamax( k-imax, w( imax+1, kw-1 ),
338  $ 1 )
339  rowmax = abs( w( jmax, kw-1 ) )
340  ELSE
341  rowmax = zero
342  END IF
343 *
344  IF( imax.GT.1 ) THEN
345  itemp = isamax( imax-1, w( 1, kw-1 ), 1 )
346  stemp = abs( w( itemp, kw-1 ) )
347  IF( stemp.GT.rowmax ) THEN
348  rowmax = stemp
349  jmax = itemp
350  END IF
351  END IF
352 *
353 * Equivalent to testing for
354 * ABS( W( IMAX, KW-1 ) ).GE.ALPHA*ROWMAX
355 * (used to handle NaN and Inf)
356 *
357  IF( .NOT.(abs( w( imax, kw-1 ) ).LT.alpha*rowmax ) )
358  $ THEN
359 *
360 * interchange rows and columns K and IMAX,
361 * use 1-by-1 pivot block
362 *
363  kp = imax
364 *
365 * copy column KW-1 of W to column KW of W
366 *
367  CALL scopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
368 *
369  done = .true.
370 *
371 * Equivalent to testing for ROWMAX.EQ.COLMAX,
372 * (used to handle NaN and Inf)
373 *
374  ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
375  $ THEN
376 *
377 * interchange rows and columns K-1 and IMAX,
378 * use 2-by-2 pivot block
379 *
380  kp = imax
381  kstep = 2
382  done = .true.
383  ELSE
384 *
385 * Pivot not found: set params and repeat
386 *
387  p = imax
388  colmax = rowmax
389  imax = jmax
390 *
391 * Copy updated JMAXth (next IMAXth) column to Kth of W
392 *
393  CALL scopy( k, w( 1, kw-1 ), 1, w( 1, kw ), 1 )
394 *
395  END IF
396 *
397 * End pivot search loop body
398 *
399  IF( .NOT. done ) GOTO 12
400 *
401  END IF
402 *
403 * ============================================================
404 *
405  kk = k - kstep + 1
406 *
407 * KKW is the column of W which corresponds to column KK of A
408 *
409  kkw = nb + kk - n
410 *
411  IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
412 *
413 * Copy non-updated column K to column P
414 *
415  CALL scopy( k-p, a( p+1, k ), 1, a( p, p+1 ), lda )
416  CALL scopy( p, a( 1, k ), 1, a( 1, p ), 1 )
417 *
418 * Interchange rows K and P in last N-K+1 columns of A
419 * and last N-K+2 columns of W
420 *
421  CALL sswap( n-k+1, a( k, k ), lda, a( p, k ), lda )
422  CALL sswap( n-kk+1, w( k, kkw ), ldw, w( p, kkw ), ldw )
423  END IF
424 *
425 * Updated column KP is already stored in column KKW of W
426 *
427  IF( kp.NE.kk ) THEN
428 *
429 * Copy non-updated column KK to column KP
430 *
431  a( kp, k ) = a( kk, k )
432  CALL scopy( k-1-kp, a( kp+1, kk ), 1, a( kp, kp+1 ),
433  $ lda )
434  CALL scopy( kp, a( 1, kk ), 1, a( 1, kp ), 1 )
435 *
436 * Interchange rows KK and KP in last N-KK+1 columns
437 * of A and W
438 *
439  CALL sswap( n-kk+1, a( kk, kk ), lda, a( kp, kk ), lda )
440  CALL sswap( n-kk+1, w( kk, kkw ), ldw, w( kp, kkw ),
441  $ ldw )
442  END IF
443 *
444  IF( kstep.EQ.1 ) THEN
445 *
446 * 1-by-1 pivot block D(k): column KW of W now holds
447 *
448 * W(k) = U(k)*D(k)
449 *
450 * where U(k) is the k-th column of U
451 *
452 * Store U(k) in column k of A
453 *
454  CALL scopy( k, w( 1, kw ), 1, a( 1, k ), 1 )
455  IF( k.GT.1 ) THEN
456  IF( abs( a( k, k ) ).GE.sfmin ) THEN
457  r1 = one / a( k, k )
458  CALL sscal( k-1, r1, a( 1, k ), 1 )
459  ELSE IF( a( k, k ).NE.zero ) THEN
460  DO 14 ii = 1, k - 1
461  a( ii, k ) = a( ii, k ) / a( k, k )
462  14 CONTINUE
463  END IF
464  END IF
465 *
466  ELSE
467 *
468 * 2-by-2 pivot block D(k): columns KW and KW-1 of W now
469 * hold
470 *
471 * ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
472 *
473 * where U(k) and U(k-1) are the k-th and (k-1)-th columns
474 * of U
475 *
476  IF( k.GT.2 ) THEN
477 *
478 * Store U(k) and U(k-1) in columns k and k-1 of A
479 *
480  d12 = w( k-1, kw )
481  d11 = w( k, kw ) / d12
482  d22 = w( k-1, kw-1 ) / d12
483  t = one / ( d11*d22-one )
484  DO 20 j = 1, k - 2
485  a( j, k-1 ) = t*( (d11*w( j, kw-1 )-w( j, kw ) ) /
486  $ d12 )
487  a( j, k ) = t*( ( d22*w( j, kw )-w( j, kw-1 ) ) /
488  $ d12 )
489  20 CONTINUE
490  END IF
491 *
492 * Copy D(k) to A
493 *
494  a( k-1, k-1 ) = w( k-1, kw-1 )
495  a( k-1, k ) = w( k-1, kw )
496  a( k, k ) = w( k, kw )
497  END IF
498  END IF
499 *
500 * Store details of the interchanges in IPIV
501 *
502  IF( kstep.EQ.1 ) THEN
503  ipiv( k ) = kp
504  ELSE
505  ipiv( k ) = -p
506  ipiv( k-1 ) = -kp
507  END IF
508 *
509 * Decrease K and return to the start of the main loop
510 *
511  k = k - kstep
512  GO TO 10
513 *
514  30 CONTINUE
515 *
516 * Update the upper triangle of A11 (= A(1:k,1:k)) as
517 *
518 * A11 := A11 - U12*D*U12**T = A11 - U12*W**T
519 *
520 * computing blocks of NB columns at a time
521 *
522  DO 50 j = ( ( k-1 ) / nb )*nb + 1, 1, -nb
523  jb = min( nb, k-j+1 )
524 *
525 * Update the upper triangle of the diagonal block
526 *
527  DO 40 jj = j, j + jb - 1
528  CALL sgemv( 'No transpose', jj-j+1, n-k, -one,
529  $ a( j, k+1 ), lda, w( jj, kw+1 ), ldw, one,
530  $ a( j, jj ), 1 )
531  40 CONTINUE
532 *
533 * Update the rectangular superdiagonal block
534 *
535  IF( j.GE.2 )
536  $ CALL sgemm( 'No transpose', 'Transpose', j-1, jb,
537  $ n-k, -one, a( 1, k+1 ), lda, w( j, kw+1 ), ldw,
538  $ one, a( 1, j ), lda )
539  50 CONTINUE
540 *
541 * Put U12 in standard form by partially undoing the interchanges
542 * in columns k+1:n
543 *
544  j = k + 1
545  60 CONTINUE
546 *
547  kstep = 1
548  jp1 = 1
549  jj = j
550  jp2 = ipiv( j )
551  IF( jp2.LT.0 ) THEN
552  jp2 = -jp2
553  j = j + 1
554  jp1 = -ipiv( j )
555  kstep = 2
556  END IF
557 *
558  j = j + 1
559  IF( jp2.NE.jj .AND. j.LE.n )
560  $ CALL sswap( n-j+1, a( jp2, j ), lda, a( jj, j ), lda )
561  jj = j - 1
562  IF( jp1.NE.jj .AND. kstep.EQ.2 )
563  $ CALL sswap( n-j+1, a( jp1, j ), lda, a( jj, j ), lda )
564  IF( j.LE.n )
565  $ GO TO 60
566 *
567 * Set KB to the number of columns factorized
568 *
569  kb = n - k
570 *
571  ELSE
572 *
573 * Factorize the leading columns of A using the lower triangle
574 * of A and working forwards, and compute the matrix W = L21*D
575 * for use in updating A22
576 *
577 * K is the main loop index, increasing from 1 in steps of 1 or 2
578 *
579  k = 1
580  70 CONTINUE
581 *
582 * Exit from loop
583 *
584  IF( ( k.GE.nb .AND. nb.LT.n ) .OR. k.GT.n )
585  $ GO TO 90
586 *
587  kstep = 1
588  p = k
589 *
590 * Copy column K of A to column K of W and update it
591 *
592  CALL scopy( n-k+1, a( k, k ), 1, w( k, k ), 1 )
593  IF( k.GT.1 )
594  $ CALL sgemv( 'No transpose', n-k+1, k-1, -one, a( k, 1 ),
595  $ lda, w( k, 1 ), ldw, one, w( k, k ), 1 )
596 *
597 * Determine rows and columns to be interchanged and whether
598 * a 1-by-1 or 2-by-2 pivot block will be used
599 *
600  absakk = abs( w( k, k ) )
601 *
602 * IMAX is the row-index of the largest off-diagonal element in
603 * column K, and COLMAX is its absolute value.
604 * Determine both COLMAX and IMAX.
605 *
606  IF( k.LT.n ) THEN
607  imax = k + isamax( n-k, w( k+1, k ), 1 )
608  colmax = abs( w( imax, k ) )
609  ELSE
610  colmax = zero
611  END IF
612 *
613  IF( max( absakk, colmax ).EQ.zero ) THEN
614 *
615 * Column K is zero or underflow: set INFO and continue
616 *
617  IF( info.EQ.0 )
618  $ info = k
619  kp = k
620  CALL scopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
621  ELSE
622 *
623 * ============================================================
624 *
625 * Test for interchange
626 *
627 * Equivalent to testing for ABSAKK.GE.ALPHA*COLMAX
628 * (used to handle NaN and Inf)
629 *
630  IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
631 *
632 * no interchange, use 1-by-1 pivot block
633 *
634  kp = k
635 *
636  ELSE
637 *
638  done = .false.
639 *
640 * Loop until pivot found
641 *
642  72 CONTINUE
643 *
644 * Begin pivot search loop body
645 *
646 *
647 * Copy column IMAX to column K+1 of W and update it
648 *
649  CALL scopy( imax-k, a( imax, k ), lda, w( k, k+1 ), 1)
650  CALL scopy( n-imax+1, a( imax, imax ), 1,
651  $ w( imax, k+1 ), 1 )
652  IF( k.GT.1 )
653  $ CALL sgemv( 'No transpose', n-k+1, k-1, -one,
654  $ a( k, 1 ), lda, w( imax, 1 ), ldw,
655  $ one, w( k, k+1 ), 1 )
656 *
657 * JMAX is the column-index of the largest off-diagonal
658 * element in row IMAX, and ROWMAX is its absolute value.
659 * Determine both ROWMAX and JMAX.
660 *
661  IF( imax.NE.k ) THEN
662  jmax = k - 1 + isamax( imax-k, w( k, k+1 ), 1 )
663  rowmax = abs( w( jmax, k+1 ) )
664  ELSE
665  rowmax = zero
666  END IF
667 *
668  IF( imax.LT.n ) THEN
669  itemp = imax + isamax( n-imax, w( imax+1, k+1 ), 1)
670  stemp = abs( w( itemp, k+1 ) )
671  IF( stemp.GT.rowmax ) THEN
672  rowmax = stemp
673  jmax = itemp
674  END IF
675  END IF
676 *
677 * Equivalent to testing for
678 * ABS( W( IMAX, K+1 ) ).GE.ALPHA*ROWMAX
679 * (used to handle NaN and Inf)
680 *
681  IF( .NOT.( abs( w( imax, k+1 ) ).LT.alpha*rowmax ) )
682  $ THEN
683 *
684 * interchange rows and columns K and IMAX,
685 * use 1-by-1 pivot block
686 *
687  kp = imax
688 *
689 * copy column K+1 of W to column K of W
690 *
691  CALL scopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
692 *
693  done = .true.
694 *
695 * Equivalent to testing for ROWMAX.EQ.COLMAX,
696 * (used to handle NaN and Inf)
697 *
698  ELSE IF( ( p.EQ.jmax ) .OR. ( rowmax.LE.colmax ) )
699  $ THEN
700 *
701 * interchange rows and columns K+1 and IMAX,
702 * use 2-by-2 pivot block
703 *
704  kp = imax
705  kstep = 2
706  done = .true.
707  ELSE
708 *
709 * Pivot not found: set params and repeat
710 *
711  p = imax
712  colmax = rowmax
713  imax = jmax
714 *
715 * Copy updated JMAXth (next IMAXth) column to Kth of W
716 *
717  CALL scopy( n-k+1, w( k, k+1 ), 1, w( k, k ), 1 )
718 *
719  END IF
720 *
721 * End pivot search loop body
722 *
723  IF( .NOT. done ) GOTO 72
724 *
725  END IF
726 *
727 * ============================================================
728 *
729  kk = k + kstep - 1
730 *
731  IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
732 *
733 * Copy non-updated column K to column P
734 *
735  CALL scopy( p-k, a( k, k ), 1, a( p, k ), lda )
736  CALL scopy( n-p+1, a( p, k ), 1, a( p, p ), 1 )
737 *
738 * Interchange rows K and P in first K columns of A
739 * and first K+1 columns of W
740 *
741  CALL sswap( k, a( k, 1 ), lda, a( p, 1 ), lda )
742  CALL sswap( kk, w( k, 1 ), ldw, w( p, 1 ), ldw )
743  END IF
744 *
745 * Updated column KP is already stored in column KK of W
746 *
747  IF( kp.NE.kk ) THEN
748 *
749 * Copy non-updated column KK to column KP
750 *
751  a( kp, k ) = a( kk, k )
752  CALL scopy( kp-k-1, a( k+1, kk ), 1, a( kp, k+1 ), lda )
753  CALL scopy( n-kp+1, a( kp, kk ), 1, a( kp, kp ), 1 )
754 *
755 * Interchange rows KK and KP in first KK columns of A and W
756 *
757  CALL sswap( kk, a( kk, 1 ), lda, a( kp, 1 ), lda )
758  CALL sswap( kk, w( kk, 1 ), ldw, w( kp, 1 ), ldw )
759  END IF
760 *
761  IF( kstep.EQ.1 ) THEN
762 *
763 * 1-by-1 pivot block D(k): column k of W now holds
764 *
765 * W(k) = L(k)*D(k)
766 *
767 * where L(k) is the k-th column of L
768 *
769 * Store L(k) in column k of A
770 *
771  CALL scopy( n-k+1, w( k, k ), 1, a( k, k ), 1 )
772  IF( k.LT.n ) THEN
773  IF( abs( a( k, k ) ).GE.sfmin ) THEN
774  r1 = one / a( k, k )
775  CALL sscal( n-k, r1, a( k+1, k ), 1 )
776  ELSE IF( a( k, k ).NE.zero ) THEN
777  DO 74 ii = k + 1, n
778  a( ii, k ) = a( ii, k ) / a( k, k )
779  74 CONTINUE
780  END IF
781  END IF
782 *
783  ELSE
784 *
785 * 2-by-2 pivot block D(k): columns k and k+1 of W now hold
786 *
787 * ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
788 *
789 * where L(k) and L(k+1) are the k-th and (k+1)-th columns
790 * of L
791 *
792  IF( k.LT.n-1 ) THEN
793 *
794 * Store L(k) and L(k+1) in columns k and k+1 of A
795 *
796  d21 = w( k+1, k )
797  d11 = w( k+1, k+1 ) / d21
798  d22 = w( k, k ) / d21
799  t = one / ( d11*d22-one )
800  DO 80 j = k + 2, n
801  a( j, k ) = t*( ( d11*w( j, k )-w( j, k+1 ) ) /
802  $ d21 )
803  a( j, k+1 ) = t*( ( d22*w( j, k+1 )-w( j, k ) ) /
804  $ d21 )
805  80 CONTINUE
806  END IF
807 *
808 * Copy D(k) to A
809 *
810  a( k, k ) = w( k, k )
811  a( k+1, k ) = w( k+1, k )
812  a( k+1, k+1 ) = w( k+1, k+1 )
813  END IF
814  END IF
815 *
816 * Store details of the interchanges in IPIV
817 *
818  IF( kstep.EQ.1 ) THEN
819  ipiv( k ) = kp
820  ELSE
821  ipiv( k ) = -p
822  ipiv( k+1 ) = -kp
823  END IF
824 *
825 * Increase K and return to the start of the main loop
826 *
827  k = k + kstep
828  GO TO 70
829 *
830  90 CONTINUE
831 *
832 * Update the lower triangle of A22 (= A(k:n,k:n)) as
833 *
834 * A22 := A22 - L21*D*L21**T = A22 - L21*W**T
835 *
836 * computing blocks of NB columns at a time
837 *
838  DO 110 j = k, n, nb
839  jb = min( nb, n-j+1 )
840 *
841 * Update the lower triangle of the diagonal block
842 *
843  DO 100 jj = j, j + jb - 1
844  CALL sgemv( 'No transpose', j+jb-jj, k-1, -one,
845  $ a( jj, 1 ), lda, w( jj, 1 ), ldw, one,
846  $ a( jj, jj ), 1 )
847  100 CONTINUE
848 *
849 * Update the rectangular subdiagonal block
850 *
851  IF( j+jb.LE.n )
852  $ CALL sgemm( 'No transpose', 'Transpose', n-j-jb+1, jb,
853  $ k-1, -one, a( j+jb, 1 ), lda, w( j, 1 ), ldw,
854  $ one, a( j+jb, j ), lda )
855  110 CONTINUE
856 *
857 * Put L21 in standard form by partially undoing the interchanges
858 * in columns 1:k-1
859 *
860  j = k - 1
861  120 CONTINUE
862 *
863  kstep = 1
864  jp1 = 1
865  jj = j
866  jp2 = ipiv( j )
867  IF( jp2.LT.0 ) THEN
868  jp2 = -jp2
869  j = j - 1
870  jp1 = -ipiv( j )
871  kstep = 2
872  END IF
873 *
874  j = j - 1
875  IF( jp2.NE.jj .AND. j.GE.1 )
876  $ CALL sswap( j, a( jp2, 1 ), lda, a( jj, 1 ), lda )
877  jj = j + 1
878  IF( jp1.NE.jj .AND. kstep.EQ.2 )
879  $ CALL sswap( j, a( jp1, 1 ), lda, a( jj, 1 ), lda )
880  IF( j.GE.1 )
881  $ GO TO 120
882 *
883 * Set KB to the number of columns factorized
884 *
885  kb = k - 1
886 *
887  END IF
888  RETURN
889 *
890 * End of SLASYF_ROOK
891 *
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
Definition: sgemv.f:158
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssycon ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real  ANORM,
real  RCOND,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

SSYCON

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

Purpose:
 SSYCON estimates the reciprocal of the condition number (in the
 1-norm) of a real symmetric matrix A using the factorization
 A = U*D*U**T or A = L*D*L**T computed by SSYTRF.

 An estimate is obtained for norm(inv(A)), and the reciprocal of the
 condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
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*D*U**T;
          = 'L':  Lower triangular, form is A = L*D*L**T.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The block diagonal matrix D and the multipliers used to
          obtain the factor U or L as computed by SSYTRF.
[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 and the block structure of D
          as determined by SSYTRF.
[in]ANORM
          ANORM is REAL
          The 1-norm of the original matrix A.
[out]RCOND
          RCOND is REAL
          The reciprocal of the condition number of the matrix A,
          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
          estimate of the 1-norm of inv(A) computed in this routine.
[out]WORK
          WORK is REAL array, dimension (2*N)
[out]IWORK
          IWORK is INTEGER array, dimension (N)
[out]INFO
          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 2011

Definition at line 132 of file ssycon.f.

132 *
133 * -- LAPACK computational routine (version 3.4.0) --
134 * -- LAPACK is a software package provided by Univ. of Tennessee, --
135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
136 * November 2011
137 *
138 * .. Scalar Arguments ..
139  CHARACTER uplo
140  INTEGER info, lda, n
141  REAL anorm, rcond
142 * ..
143 * .. Array Arguments ..
144  INTEGER ipiv( * ), iwork( * )
145  REAL a( lda, * ), work( * )
146 * ..
147 *
148 * =====================================================================
149 *
150 * .. Parameters ..
151  REAL one, zero
152  parameter( one = 1.0e+0, zero = 0.0e+0 )
153 * ..
154 * .. Local Scalars ..
155  LOGICAL upper
156  INTEGER i, kase
157  REAL ainvnm
158 * ..
159 * .. Local Arrays ..
160  INTEGER isave( 3 )
161 * ..
162 * .. External Functions ..
163  LOGICAL lsame
164  EXTERNAL lsame
165 * ..
166 * .. External Subroutines ..
167  EXTERNAL slacn2, ssytrs, xerbla
168 * ..
169 * .. Intrinsic Functions ..
170  INTRINSIC max
171 * ..
172 * .. Executable Statements ..
173 *
174 * Test the input parameters.
175 *
176  info = 0
177  upper = lsame( uplo, 'U' )
178  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
179  info = -1
180  ELSE IF( n.LT.0 ) THEN
181  info = -2
182  ELSE IF( lda.LT.max( 1, n ) ) THEN
183  info = -4
184  ELSE IF( anorm.LT.zero ) THEN
185  info = -6
186  END IF
187  IF( info.NE.0 ) THEN
188  CALL xerbla( 'SSYCON', -info )
189  RETURN
190  END IF
191 *
192 * Quick return if possible
193 *
194  rcond = zero
195  IF( n.EQ.0 ) THEN
196  rcond = one
197  RETURN
198  ELSE IF( anorm.LE.zero ) THEN
199  RETURN
200  END IF
201 *
202 * Check that the diagonal matrix D is nonsingular.
203 *
204  IF( upper ) THEN
205 *
206 * Upper triangular storage: examine D from bottom to top
207 *
208  DO 10 i = n, 1, -1
209  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
210  $ RETURN
211  10 CONTINUE
212  ELSE
213 *
214 * Lower triangular storage: examine D from top to bottom.
215 *
216  DO 20 i = 1, n
217  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
218  $ RETURN
219  20 CONTINUE
220  END IF
221 *
222 * Estimate the 1-norm of the inverse.
223 *
224  kase = 0
225  30 CONTINUE
226  CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
227  IF( kase.NE.0 ) THEN
228 *
229 * Multiply by inv(L*D*L**T) or inv(U*D*U**T).
230 *
231  CALL ssytrs( uplo, n, 1, a, lda, ipiv, work, n, info )
232  GO TO 30
233  END IF
234 *
235 * Compute the estimate of the reciprocal condition number.
236 *
237  IF( ainvnm.NE.zero )
238  $ rcond = ( one / ainvnm ) / anorm
239 *
240  RETURN
241 *
242 * End of SSYCON
243 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SSYTRS
Definition: ssytrs.f:122
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssycon_rook ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real  ANORM,
real  RCOND,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

SSYCON_ROOK

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

Purpose:
 SSYCON_ROOK estimates the reciprocal of the condition number (in the
 1-norm) of a real symmetric matrix A using the factorization
 A = U*D*U**T or A = L*D*L**T computed by SSYTRF_ROOK.

 An estimate is obtained for norm(inv(A)), and the reciprocal of the
 condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
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*D*U**T;
          = 'L':  Lower triangular, form is A = L*D*L**T.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The block diagonal matrix D and the multipliers used to
          obtain the factor U or L as computed by SSYTRF_ROOK.
[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 and the block structure of D
          as determined by SSYTRF_ROOK.
[in]ANORM
          ANORM is REAL
          The 1-norm of the original matrix A.
[out]RCOND
          RCOND is REAL
          The reciprocal of the condition number of the matrix A,
          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
          estimate of the 1-norm of inv(A) computed in this routine.
[out]WORK
          WORK is REAL array, dimension (2*N)
[out]IWORK
          IWORK is INTEGER array, dimension (N)
[out]INFO
          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 2015
Contributors:

November 2015, Igor Kozachenko, Computer Science Division, University of California, Berkeley

September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas, School of Mathematics, University of Manchester

Definition at line 146 of file ssycon_rook.f.

146 *
147 * -- LAPACK computational routine (version 3.6.0) --
148 * -- LAPACK is a software package provided by Univ. of Tennessee, --
149 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150 * November 2015
151 *
152 * .. Scalar Arguments ..
153  CHARACTER uplo
154  INTEGER info, lda, n
155  REAL anorm, rcond
156 * ..
157 * .. Array Arguments ..
158  INTEGER ipiv( * ), iwork( * )
159  REAL a( lda, * ), work( * )
160 * ..
161 *
162 * =====================================================================
163 *
164 * .. Parameters ..
165  REAL one, zero
166  parameter( one = 1.0e+0, zero = 0.0e+0 )
167 * ..
168 * .. Local Scalars ..
169  LOGICAL upper
170  INTEGER i, kase
171  REAL ainvnm
172 * ..
173 * .. Local Arrays ..
174  INTEGER isave( 3 )
175 * ..
176 * .. External Functions ..
177  LOGICAL lsame
178  EXTERNAL lsame
179 * ..
180 * .. External Subroutines ..
181  EXTERNAL slacn2, ssytrs_rook, xerbla
182 * ..
183 * .. Intrinsic Functions ..
184  INTRINSIC max
185 * ..
186 * .. Executable Statements ..
187 *
188 * Test the input parameters.
189 *
190  info = 0
191  upper = lsame( uplo, 'U' )
192  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
193  info = -1
194  ELSE IF( n.LT.0 ) THEN
195  info = -2
196  ELSE IF( lda.LT.max( 1, n ) ) THEN
197  info = -4
198  ELSE IF( anorm.LT.zero ) THEN
199  info = -6
200  END IF
201  IF( info.NE.0 ) THEN
202  CALL xerbla( 'SSYCON_ROOK', -info )
203  RETURN
204  END IF
205 *
206 * Quick return if possible
207 *
208  rcond = zero
209  IF( n.EQ.0 ) THEN
210  rcond = one
211  RETURN
212  ELSE IF( anorm.LE.zero ) THEN
213  RETURN
214  END IF
215 *
216 * Check that the diagonal matrix D is nonsingular.
217 *
218  IF( upper ) THEN
219 *
220 * Upper triangular storage: examine D from bottom to top
221 *
222  DO 10 i = n, 1, -1
223  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
224  $ RETURN
225  10 CONTINUE
226  ELSE
227 *
228 * Lower triangular storage: examine D from top to bottom.
229 *
230  DO 20 i = 1, n
231  IF( ipiv( i ).GT.0 .AND. a( i, i ).EQ.zero )
232  $ RETURN
233  20 CONTINUE
234  END IF
235 *
236 * Estimate the 1-norm of the inverse.
237 *
238  kase = 0
239  30 CONTINUE
240  CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
241  IF( kase.NE.0 ) THEN
242 *
243 * Multiply by inv(L*D*L**T) or inv(U*D*U**T).
244 *
245  CALL ssytrs_rook( uplo, n, 1, a, lda, ipiv, work, n, info )
246  GO TO 30
247  END IF
248 *
249 * Compute the estimate of the reciprocal condition number.
250 *
251  IF( ainvnm.NE.zero )
252  $ rcond = ( one / ainvnm ) / anorm
253 *
254  RETURN
255 *
256 * End of SSYCON_ROOK
257 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssytrs_rook(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SSYTRS_ROOK
Definition: ssytrs_rook.f:138
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssyconv ( character  UPLO,
character  WAY,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real, dimension( * )  E,
integer  INFO 
)

SSYCONV

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

Purpose:
 SSYCONV convert A given by TRF into L and D and vice-versa.
 Get Non-diag elements of D (returned in workspace) and 
 apply or reverse permutation done in TRF.
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*D*U**T;
          = 'L':  Lower triangular, form is A = L*D*L**T.
[in]WAY
          WAY is CHARACTER*1
          = 'C': Convert 
          = 'R': Revert
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          The block diagonal matrix D and the multipliers used to
          obtain the factor U or L as computed by SSYTRF.
[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 and the block structure of D
          as determined by SSYTRF.
[out]E
          E is REAL array, dimension (N)
          E stores the supdiagonal/subdiagonal of the symmetric 1-by-1
          or 2-by-2 block diagonal matrix D in LDLT.
[out]INFO
          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 2015

Definition at line 116 of file ssyconv.f.

116 *
117 * -- LAPACK computational routine (version 3.6.0) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * November 2015
121 *
122 * .. Scalar Arguments ..
123  CHARACTER uplo, way
124  INTEGER info, lda, n
125 * ..
126 * .. Array Arguments ..
127  INTEGER ipiv( * )
128  REAL a( lda, * ), e( * )
129 * ..
130 *
131 * =====================================================================
132 *
133 * .. Parameters ..
134  REAL zero
135  parameter( zero = 0.0e+0 )
136 * ..
137 * .. External Functions ..
138  LOGICAL lsame
139  EXTERNAL lsame
140 *
141 * .. External Subroutines ..
142  EXTERNAL xerbla
143 * .. Local Scalars ..
144  LOGICAL upper, convert
145  INTEGER i, ip, j
146  REAL temp
147 * ..
148 * .. Executable Statements ..
149 *
150  info = 0
151  upper = lsame( uplo, 'U' )
152  convert = lsame( way, 'C' )
153  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
154  info = -1
155  ELSE IF( .NOT.convert .AND. .NOT.lsame( way, 'R' ) ) THEN
156  info = -2
157  ELSE IF( n.LT.0 ) THEN
158  info = -3
159  ELSE IF( lda.LT.max( 1, n ) ) THEN
160  info = -5
161 
162  END IF
163  IF( info.NE.0 ) THEN
164  CALL xerbla( 'SSYCONV', -info )
165  RETURN
166  END IF
167 *
168 * Quick return if possible
169 *
170  IF( n.EQ.0 )
171  $ RETURN
172 *
173  IF( upper ) THEN
174 *
175 * A is UPPER
176 *
177 * Convert A (A is upper)
178 *
179 * Convert VALUE
180 *
181  IF ( convert ) THEN
182  i=n
183  e(1)=zero
184  DO WHILE ( i .GT. 1 )
185  IF( ipiv(i) .LT. 0 ) THEN
186  e(i)=a(i-1,i)
187  e(i-1)=zero
188  a(i-1,i)=zero
189  i=i-1
190  ELSE
191  e(i)=zero
192  ENDIF
193  i=i-1
194  END DO
195 *
196 * Convert PERMUTATIONS
197 *
198  i=n
199  DO WHILE ( i .GE. 1 )
200  IF( ipiv(i) .GT. 0) THEN
201  ip=ipiv(i)
202  IF( i .LT. n) THEN
203  DO 12 j= i+1,n
204  temp=a(ip,j)
205  a(ip,j)=a(i,j)
206  a(i,j)=temp
207  12 CONTINUE
208  ENDIF
209  ELSE
210  ip=-ipiv(i)
211  IF( i .LT. n) THEN
212  DO 13 j= i+1,n
213  temp=a(ip,j)
214  a(ip,j)=a(i-1,j)
215  a(i-1,j)=temp
216  13 CONTINUE
217  ENDIF
218  i=i-1
219  ENDIF
220  i=i-1
221  END DO
222 
223  ELSE
224 *
225 * Revert A (A is upper)
226 *
227 *
228 * Revert PERMUTATIONS
229 *
230  i=1
231  DO WHILE ( i .LE. n )
232  IF( ipiv(i) .GT. 0 ) THEN
233  ip=ipiv(i)
234  IF( i .LT. n) THEN
235  DO j= i+1,n
236  temp=a(ip,j)
237  a(ip,j)=a(i,j)
238  a(i,j)=temp
239  END DO
240  ENDIF
241  ELSE
242  ip=-ipiv(i)
243  i=i+1
244  IF( i .LT. n) THEN
245  DO j= i+1,n
246  temp=a(ip,j)
247  a(ip,j)=a(i-1,j)
248  a(i-1,j)=temp
249  END DO
250  ENDIF
251  ENDIF
252  i=i+1
253  END DO
254 *
255 * Revert VALUE
256 *
257  i=n
258  DO WHILE ( i .GT. 1 )
259  IF( ipiv(i) .LT. 0 ) THEN
260  a(i-1,i)=e(i)
261  i=i-1
262  ENDIF
263  i=i-1
264  END DO
265  END IF
266  ELSE
267 *
268 * A is LOWER
269 *
270  IF ( convert ) THEN
271 *
272 * Convert A (A is lower)
273 *
274 *
275 * Convert VALUE
276 *
277  i=1
278  e(n)=zero
279  DO WHILE ( i .LE. n )
280  IF( i.LT.n .AND. ipiv(i) .LT. 0 ) THEN
281  e(i)=a(i+1,i)
282  e(i+1)=zero
283  a(i+1,i)=zero
284  i=i+1
285  ELSE
286  e(i)=zero
287  ENDIF
288  i=i+1
289  END DO
290 *
291 * Convert PERMUTATIONS
292 *
293  i=1
294  DO WHILE ( i .LE. n )
295  IF( ipiv(i) .GT. 0 ) THEN
296  ip=ipiv(i)
297  IF (i .GT. 1) THEN
298  DO 22 j= 1,i-1
299  temp=a(ip,j)
300  a(ip,j)=a(i,j)
301  a(i,j)=temp
302  22 CONTINUE
303  ENDIF
304  ELSE
305  ip=-ipiv(i)
306  IF (i .GT. 1) THEN
307  DO 23 j= 1,i-1
308  temp=a(ip,j)
309  a(ip,j)=a(i+1,j)
310  a(i+1,j)=temp
311  23 CONTINUE
312  ENDIF
313  i=i+1
314  ENDIF
315  i=i+1
316  END DO
317  ELSE
318 *
319 * Revert A (A is lower)
320 *
321 *
322 * Revert PERMUTATIONS
323 *
324  i=n
325  DO WHILE ( i .GE. 1 )
326  IF( ipiv(i) .GT. 0 ) THEN
327  ip=ipiv(i)
328  IF (i .GT. 1) THEN
329  DO j= 1,i-1
330  temp=a(i,j)
331  a(i,j)=a(ip,j)
332  a(ip,j)=temp
333  END DO
334  ENDIF
335  ELSE
336  ip=-ipiv(i)
337  i=i-1
338  IF (i .GT. 1) THEN
339  DO j= 1,i-1
340  temp=a(i+1,j)
341  a(i+1,j)=a(ip,j)
342  a(ip,j)=temp
343  END DO
344  ENDIF
345  ENDIF
346  i=i-1
347  END DO
348 *
349 * Revert VALUE
350 *
351  i=1
352  DO WHILE ( i .LE. n-1 )
353  IF( ipiv(i) .LT. 0 ) THEN
354  a(i+1,i)=e(i)
355  i=i+1
356  ENDIF
357  i=i+1
358  END DO
359  END IF
360  END IF
361 
362  RETURN
363 *
364 * End of SSYCONV
365 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssyequb ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  S,
real  SCOND,
real  AMAX,
real, dimension( * )  WORK,
integer  INFO 
)

SSYEQUB

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

Purpose:
 SSYEQUB computes row and column scalings intended to equilibrate a
 symmetric matrix A and reduce its condition number
 (with respect to the two-norm).  S contains the scale factors,
 S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
 elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal.  This
 choice of S puts the condition number of B within a factor N of the
 smallest possible condition number over all possible diagonal
 scalings.
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*D*U**T;
          = 'L':  Lower triangular, form is A = L*D*L**T.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The N-by-N symmetric matrix whose scaling
          factors are to be computed.  Only the diagonal elements of A
          are referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]S
          S is REAL array, dimension (N)
          If INFO = 0, S contains the scale factors for A.
[out]SCOND
          SCOND is REAL
          If INFO = 0, S contains the ratio of the smallest S(i) to
          the largest S(i).  If SCOND >= 0.1 and AMAX is neither too
          large nor too small, it is not worth scaling by S.
[out]AMAX
          AMAX is REAL
          Absolute value of largest matrix element.  If AMAX is very
          close to overflow or very close to underflow, the matrix
          should be scaled.
[out]WORK
          WORK is REAL array, dimension (3*N)
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, the i-th diagonal element is nonpositive.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
References:
Livne, O.E. and Golub, G.H., "Scaling by Binormalization",
Numerical Algorithms, vol. 35, no. 1, pp. 97-120, January 2004.
DOI 10.1023/B:NUMA.0000016606.32820.69
Tech report version: http://ruready.utah.edu/archive/papers/bin.pdf

Definition at line 137 of file ssyequb.f.

137 *
138 * -- LAPACK computational routine (version 3.4.0) --
139 * -- LAPACK is a software package provided by Univ. of Tennessee, --
140 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141 * November 2011
142 *
143 * .. Scalar Arguments ..
144  INTEGER info, lda, n
145  REAL amax, scond
146  CHARACTER uplo
147 * ..
148 * .. Array Arguments ..
149  REAL a( lda, * ), s( * ), work( * )
150 * ..
151 *
152 * =====================================================================
153 *
154 * .. Parameters ..
155  REAL one, zero
156  parameter( one = 1.0e+0, zero = 0.0e+0 )
157  INTEGER max_iter
158  parameter( max_iter = 100 )
159 * ..
160 * .. Local Scalars ..
161  INTEGER i, j, iter
162  REAL avg, std, tol, c0, c1, c2, t, u, si, d, base,
163  $ smin, smax, smlnum, bignum, scale, sumsq
164  LOGICAL up
165 * ..
166 * .. External Functions ..
167  REAL slamch
168  LOGICAL lsame
169  EXTERNAL lsame, slamch
170 * ..
171 * .. External Subroutines ..
172  EXTERNAL slassq
173 * ..
174 * .. Intrinsic Functions ..
175  INTRINSIC abs, int, log, max, min, sqrt
176 * ..
177 * .. Executable Statements ..
178 *
179 * Test input parameters.
180 *
181  info = 0
182  IF ( .NOT. ( lsame( uplo, 'U' ) .OR. lsame( uplo, 'L' ) ) ) THEN
183  info = -1
184  ELSE IF ( n .LT. 0 ) THEN
185  info = -2
186  ELSE IF ( lda .LT. max( 1, n ) ) THEN
187  info = -4
188  END IF
189  IF ( info .NE. 0 ) THEN
190  CALL xerbla( 'SSYEQUB', -info )
191  RETURN
192  END IF
193 
194  up = lsame( uplo, 'U' )
195  amax = zero
196 *
197 * Quick return if possible.
198 *
199  IF ( n .EQ. 0 ) THEN
200  scond = one
201  RETURN
202  END IF
203 
204  DO i = 1, n
205  s( i ) = zero
206  END DO
207 
208  amax = zero
209  IF ( up ) THEN
210  DO j = 1, n
211  DO i = 1, j-1
212  s( i ) = max( s( i ), abs( a( i, j ) ) )
213  s( j ) = max( s( j ), abs( a( i, j ) ) )
214  amax = max( amax, abs( a(i, j) ) )
215  END DO
216  s( j ) = max( s( j ), abs( a( j, j ) ) )
217  amax = max( amax, abs( a( j, j ) ) )
218  END DO
219  ELSE
220  DO j = 1, n
221  s( j ) = max( s( j ), abs( a( j, j ) ) )
222  amax = max( amax, abs( a( j, j ) ) )
223  DO i = j+1, n
224  s( i ) = max( s( i ), abs( a( i, j ) ) )
225  s( j ) = max( s( j ), abs( a( i, j ) ) )
226  amax = max( amax, abs( a( i, j ) ) )
227  END DO
228  END DO
229  END IF
230  DO j = 1, n
231  s( j ) = 1.0 / s( j )
232  END DO
233 
234  tol = one / sqrt(2.0e0 * n)
235 
236  DO iter = 1, max_iter
237  scale = 0.0
238  sumsq = 0.0
239 * BETA = |A|S
240  DO i = 1, n
241  work(i) = zero
242  END DO
243  IF ( up ) THEN
244  DO j = 1, n
245  DO i = 1, j-1
246  t = abs( a( i, j ) )
247  work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
248  work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
249  END DO
250  work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
251  END DO
252  ELSE
253  DO j = 1, n
254  work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
255  DO i = j+1, n
256  t = abs( a( i, j ) )
257  work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
258  work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
259  END DO
260  END DO
261  END IF
262 
263 * avg = s^T beta / n
264  avg = 0.0
265  DO i = 1, n
266  avg = avg + s( i )*work( i )
267  END DO
268  avg = avg / n
269 
270  std = 0.0
271  DO i = 2*n+1, 3*n
272  work( i ) = s( i-2*n ) * work( i-2*n ) - avg
273  END DO
274  CALL slassq( n, work( 2*n+1 ), 1, scale, sumsq )
275  std = scale * sqrt( sumsq / n )
276 
277  IF ( std .LT. tol * avg ) GOTO 999
278 
279  DO i = 1, n
280  t = abs( a( i, i ) )
281  si = s( i )
282  c2 = ( n-1 ) * t
283  c1 = ( n-2 ) * ( work( i ) - t*si )
284  c0 = -(t*si)*si + 2*work( i )*si - n*avg
285  d = c1*c1 - 4*c0*c2
286 
287  IF ( d .LE. 0 ) THEN
288  info = -1
289  RETURN
290  END IF
291  si = -2*c0 / ( c1 + sqrt( d ) )
292 
293  d = si - s( i )
294  u = zero
295  IF ( up ) THEN
296  DO j = 1, i
297  t = abs( a( j, i ) )
298  u = u + s( j )*t
299  work( j ) = work( j ) + d*t
300  END DO
301  DO j = i+1,n
302  t = abs( a( i, j ) )
303  u = u + s( j )*t
304  work( j ) = work( j ) + d*t
305  END DO
306  ELSE
307  DO j = 1, i
308  t = abs( a( i, j ) )
309  u = u + s( j )*t
310  work( j ) = work( j ) + d*t
311  END DO
312  DO j = i+1,n
313  t = abs( a( j, i ) )
314  u = u + s( j )*t
315  work( j ) = work( j ) + d*t
316  END DO
317  END IF
318 
319  avg = avg + ( u + work( i ) ) * d / n
320  s( i ) = si
321 
322  END DO
323 
324  END DO
325 
326  999 CONTINUE
327 
328  smlnum = slamch( 'SAFEMIN' )
329  bignum = one / smlnum
330  smin = bignum
331  smax = zero
332  t = one / sqrt(avg)
333  base = slamch( 'B' )
334  u = one / log( base )
335  DO i = 1, n
336  s( i ) = base ** int( u * log( s( i ) * t ) )
337  smin = min( smin, s( i ) )
338  smax = max( smax, s( i ) )
339  END DO
340  scond = max( smin, smlnum ) / min( smax, bignum )
341 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slassq(N, X, INCX, SCALE, SUMSQ)
SLASSQ updates a sum of squares represented in scaled form.
Definition: slassq.f:105

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssygs2 ( integer  ITYPE,
character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorization results obtained from spotrf (unblocked algorithm).

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

Purpose:
 SSYGS2 reduces a real symmetric-definite generalized eigenproblem
 to standard form.

 If ITYPE = 1, the problem is A*x = lambda*B*x,
 and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)

 If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
 B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T *A*L.

 B must have been previously factorized as U**T *U or L*L**T by SPOTRF.
Parameters
[in]ITYPE
          ITYPE is INTEGER
          = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
          = 2 or 3: compute U*A*U**T or L**T *A*L.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored, and how B has been factorized.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrices A and B.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n by n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n by n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, if INFO = 0, the transformed matrix, stored in the
          same format as A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]B
          B is REAL array, dimension (LDB,N)
          The triangular factor from the Cholesky factorization of B,
          as returned by SPOTRF.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          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
September 2012

Definition at line 129 of file ssygs2.f.

129 *
130 * -- LAPACK computational routine (version 3.4.2) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * September 2012
134 *
135 * .. Scalar Arguments ..
136  CHARACTER uplo
137  INTEGER info, itype, lda, ldb, n
138 * ..
139 * .. Array Arguments ..
140  REAL a( lda, * ), b( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL one, half
147  parameter( one = 1.0, half = 0.5 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL upper
151  INTEGER k
152  REAL akk, bkk, ct
153 * ..
154 * .. External Subroutines ..
155  EXTERNAL saxpy, sscal, ssyr2, strmv, strsv, xerbla
156 * ..
157 * .. Intrinsic Functions ..
158  INTRINSIC max
159 * ..
160 * .. External Functions ..
161  LOGICAL lsame
162  EXTERNAL lsame
163 * ..
164 * .. Executable Statements ..
165 *
166 * Test the input parameters.
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
171  info = -1
172  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
173  info = -2
174  ELSE IF( n.LT.0 ) THEN
175  info = -3
176  ELSE IF( lda.LT.max( 1, n ) ) THEN
177  info = -5
178  ELSE IF( ldb.LT.max( 1, n ) ) THEN
179  info = -7
180  END IF
181  IF( info.NE.0 ) THEN
182  CALL xerbla( 'SSYGS2', -info )
183  RETURN
184  END IF
185 *
186  IF( itype.EQ.1 ) THEN
187  IF( upper ) THEN
188 *
189 * Compute inv(U**T)*A*inv(U)
190 *
191  DO 10 k = 1, n
192 *
193 * Update the upper triangle of A(k:n,k:n)
194 *
195  akk = a( k, k )
196  bkk = b( k, k )
197  akk = akk / bkk**2
198  a( k, k ) = akk
199  IF( k.LT.n ) THEN
200  CALL sscal( n-k, one / bkk, a( k, k+1 ), lda )
201  ct = -half*akk
202  CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
203  $ lda )
204  CALL ssyr2( uplo, n-k, -one, a( k, k+1 ), lda,
205  $ b( k, k+1 ), ldb, a( k+1, k+1 ), lda )
206  CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
207  $ lda )
208  CALL strsv( uplo, 'Transpose', 'Non-unit', n-k,
209  $ b( k+1, k+1 ), ldb, a( k, k+1 ), lda )
210  END IF
211  10 CONTINUE
212  ELSE
213 *
214 * Compute inv(L)*A*inv(L**T)
215 *
216  DO 20 k = 1, n
217 *
218 * Update the lower triangle of A(k:n,k:n)
219 *
220  akk = a( k, k )
221  bkk = b( k, k )
222  akk = akk / bkk**2
223  a( k, k ) = akk
224  IF( k.LT.n ) THEN
225  CALL sscal( n-k, one / bkk, a( k+1, k ), 1 )
226  ct = -half*akk
227  CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
228  CALL ssyr2( uplo, n-k, -one, a( k+1, k ), 1,
229  $ b( k+1, k ), 1, a( k+1, k+1 ), lda )
230  CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
231  CALL strsv( uplo, 'No transpose', 'Non-unit', n-k,
232  $ b( k+1, k+1 ), ldb, a( k+1, k ), 1 )
233  END IF
234  20 CONTINUE
235  END IF
236  ELSE
237  IF( upper ) THEN
238 *
239 * Compute U*A*U**T
240 *
241  DO 30 k = 1, n
242 *
243 * Update the upper triangle of A(1:k,1:k)
244 *
245  akk = a( k, k )
246  bkk = b( k, k )
247  CALL strmv( uplo, 'No transpose', 'Non-unit', k-1, b,
248  $ ldb, a( 1, k ), 1 )
249  ct = half*akk
250  CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
251  CALL ssyr2( uplo, k-1, one, a( 1, k ), 1, b( 1, k ), 1,
252  $ a, lda )
253  CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
254  CALL sscal( k-1, bkk, a( 1, k ), 1 )
255  a( k, k ) = akk*bkk**2
256  30 CONTINUE
257  ELSE
258 *
259 * Compute L**T *A*L
260 *
261  DO 40 k = 1, n
262 *
263 * Update the lower triangle of A(1:k,1:k)
264 *
265  akk = a( k, k )
266  bkk = b( k, k )
267  CALL strmv( uplo, 'Transpose', 'Non-unit', k-1, b, ldb,
268  $ a( k, 1 ), lda )
269  ct = half*akk
270  CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
271  CALL ssyr2( uplo, k-1, one, a( k, 1 ), lda, b( k, 1 ),
272  $ ldb, a, lda )
273  CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
274  CALL sscal( k-1, bkk, a( k, 1 ), lda )
275  a( k, k ) = akk*bkk**2
276  40 CONTINUE
277  END IF
278  END IF
279  RETURN
280 *
281 * End of SSYGS2
282 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
subroutine strmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
STRMV
Definition: strmv.f:149
subroutine strsv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
STRSV
Definition: strsv.f:151
subroutine ssyr2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SSYR2
Definition: ssyr2.f:149

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssygst ( integer  ITYPE,
character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

SSYGST

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

Purpose:
 SSYGST reduces a real symmetric-definite generalized eigenproblem
 to standard form.

 If ITYPE = 1, the problem is A*x = lambda*B*x,
 and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)

 If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
 B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T*A*L.

 B must have been previously factorized as U**T*U or L*L**T by SPOTRF.
Parameters
[in]ITYPE
          ITYPE is INTEGER
          = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
          = 2 or 3: compute U*A*U**T or L**T*A*L.
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored and B is factored as
                  U**T*U;
          = 'L':  Lower triangle of A is stored and B is factored as
                  L*L**T.
[in]N
          N is INTEGER
          The order of the matrices A and B.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          N-by-N upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading N-by-N lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, if INFO = 0, the transformed matrix, stored in the
          same format as A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]B
          B is REAL array, dimension (LDB,N)
          The triangular factor from the Cholesky factorization of B,
          as returned by SPOTRF.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          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 2011

Definition at line 129 of file ssygst.f.

129 *
130 * -- LAPACK computational routine (version 3.4.0) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * November 2011
134 *
135 * .. Scalar Arguments ..
136  CHARACTER uplo
137  INTEGER info, itype, lda, ldb, n
138 * ..
139 * .. Array Arguments ..
140  REAL a( lda, * ), b( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL one, half
147  parameter( one = 1.0, half = 0.5 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL upper
151  INTEGER k, kb, nb
152 * ..
153 * .. External Subroutines ..
154  EXTERNAL ssygs2, ssymm, ssyr2k, strmm, strsm, xerbla
155 * ..
156 * .. Intrinsic Functions ..
157  INTRINSIC max, min
158 * ..
159 * .. External Functions ..
160  LOGICAL lsame
161  INTEGER ilaenv
162  EXTERNAL lsame, ilaenv
163 * ..
164 * .. Executable Statements ..
165 *
166 * Test the input parameters.
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
171  info = -1
172  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
173  info = -2
174  ELSE IF( n.LT.0 ) THEN
175  info = -3
176  ELSE IF( lda.LT.max( 1, n ) ) THEN
177  info = -5
178  ELSE IF( ldb.LT.max( 1, n ) ) THEN
179  info = -7
180  END IF
181  IF( info.NE.0 ) THEN
182  CALL xerbla( 'SSYGST', -info )
183  RETURN
184  END IF
185 *
186 * Quick return if possible
187 *
188  IF( n.EQ.0 )
189  $ RETURN
190 *
191 * Determine the block size for this environment.
192 *
193  nb = ilaenv( 1, 'SSYGST', uplo, n, -1, -1, -1 )
194 *
195  IF( nb.LE.1 .OR. nb.GE.n ) THEN
196 *
197 * Use unblocked code
198 *
199  CALL ssygs2( itype, uplo, n, a, lda, b, ldb, info )
200  ELSE
201 *
202 * Use blocked code
203 *
204  IF( itype.EQ.1 ) THEN
205  IF( upper ) THEN
206 *
207 * Compute inv(U**T)*A*inv(U)
208 *
209  DO 10 k = 1, n, nb
210  kb = min( n-k+1, nb )
211 *
212 * Update the upper triangle of A(k:n,k:n)
213 *
214  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
215  $ b( k, k ), ldb, info )
216  IF( k+kb.LE.n ) THEN
217  CALL strsm( 'Left', uplo, 'Transpose', 'Non-unit',
218  $ kb, n-k-kb+1, one, b( k, k ), ldb,
219  $ a( k, k+kb ), lda )
220  CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
221  $ a( k, k ), lda, b( k, k+kb ), ldb, one,
222  $ a( k, k+kb ), lda )
223  CALL ssyr2k( uplo, 'Transpose', n-k-kb+1, kb, -one,
224  $ a( k, k+kb ), lda, b( k, k+kb ), ldb,
225  $ one, a( k+kb, k+kb ), lda )
226  CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
227  $ a( k, k ), lda, b( k, k+kb ), ldb, one,
228  $ a( k, k+kb ), lda )
229  CALL strsm( 'Right', uplo, 'No transpose',
230  $ 'Non-unit', kb, n-k-kb+1, one,
231  $ b( k+kb, k+kb ), ldb, a( k, k+kb ),
232  $ lda )
233  END IF
234  10 CONTINUE
235  ELSE
236 *
237 * Compute inv(L)*A*inv(L**T)
238 *
239  DO 20 k = 1, n, nb
240  kb = min( n-k+1, nb )
241 *
242 * Update the lower triangle of A(k:n,k:n)
243 *
244  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
245  $ b( k, k ), ldb, info )
246  IF( k+kb.LE.n ) THEN
247  CALL strsm( 'Right', uplo, 'Transpose', 'Non-unit',
248  $ n-k-kb+1, kb, one, b( k, k ), ldb,
249  $ a( k+kb, k ), lda )
250  CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
251  $ a( k, k ), lda, b( k+kb, k ), ldb, one,
252  $ a( k+kb, k ), lda )
253  CALL ssyr2k( uplo, 'No transpose', n-k-kb+1, kb,
254  $ -one, a( k+kb, k ), lda, b( k+kb, k ),
255  $ ldb, one, a( k+kb, k+kb ), lda )
256  CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
257  $ a( k, k ), lda, b( k+kb, k ), ldb, one,
258  $ a( k+kb, k ), lda )
259  CALL strsm( 'Left', uplo, 'No transpose',
260  $ 'Non-unit', n-k-kb+1, kb, one,
261  $ b( k+kb, k+kb ), ldb, a( k+kb, k ),
262  $ lda )
263  END IF
264  20 CONTINUE
265  END IF
266  ELSE
267  IF( upper ) THEN
268 *
269 * Compute U*A*U**T
270 *
271  DO 30 k = 1, n, nb
272  kb = min( n-k+1, nb )
273 *
274 * Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
275 *
276  CALL strmm( 'Left', uplo, 'No transpose', 'Non-unit',
277  $ k-1, kb, one, b, ldb, a( 1, k ), lda )
278  CALL ssymm( 'Right', uplo, k-1, kb, half, a( k, k ),
279  $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
280  CALL ssyr2k( uplo, 'No transpose', k-1, kb, one,
281  $ a( 1, k ), lda, b( 1, k ), ldb, one, a,
282  $ lda )
283  CALL ssymm( 'Right', uplo, k-1, kb, half, a( k, k ),
284  $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
285  CALL strmm( 'Right', uplo, 'Transpose', 'Non-unit',
286  $ k-1, kb, one, b( k, k ), ldb, a( 1, k ),
287  $ lda )
288  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
289  $ b( k, k ), ldb, info )
290  30 CONTINUE
291  ELSE
292 *
293 * Compute L**T*A*L
294 *
295  DO 40 k = 1, n, nb
296  kb = min( n-k+1, nb )
297 *
298 * Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
299 *
300  CALL strmm( 'Right', uplo, 'No transpose', 'Non-unit',
301  $ kb, k-1, one, b, ldb, a( k, 1 ), lda )
302  CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
303  $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
304  CALL ssyr2k( uplo, 'Transpose', k-1, kb, one,
305  $ a( k, 1 ), lda, b( k, 1 ), ldb, one, a,
306  $ lda )
307  CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
308  $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
309  CALL strmm( 'Left', uplo, 'Transpose', 'Non-unit', kb,
310  $ k-1, one, b( k, k ), ldb, a( k, 1 ), lda )
311  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
312  $ b( k, k ), ldb, info )
313  40 CONTINUE
314  END IF
315  END IF
316  END IF
317  RETURN
318 *
319 * End of SSYGST
320 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine strmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRMM
Definition: strmm.f:179
subroutine strsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRSM
Definition: strsm.f:183
subroutine ssygs2(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorizatio...
Definition: ssygs2.f:129
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine ssymm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYMM
Definition: ssymm.f:191
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine ssyr2k(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYR2K
Definition: ssyr2k.f:194

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssyrfs ( character  UPLO,
integer  N,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( * )  FERR,
real, dimension( * )  BERR,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

SSYRFS

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

Purpose:
 SSYRFS improves the computed solution to a system of linear
 equations when the coefficient matrix is symmetric indefinite, and
 provides error bounds and backward error estimates for the solution.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[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 matrices B and X.  NRHS >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
          upper triangular part of A contains the upper triangular part
          of the matrix A, and the strictly lower triangular part of A
          is not referenced.  If UPLO = 'L', the leading N-by-N lower
          triangular part of A contains the lower triangular part of
          the matrix A, and the strictly upper triangular part of A is
          not referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]AF
          AF is REAL array, dimension (LDAF,N)
          The factored form of the matrix A.  AF contains the block
          diagonal matrix D and the multipliers used to obtain the
          factor U or L from the factorization A = U*D*U**T or
          A = L*D*L**T as computed by SSYTRF.
[in]LDAF
          LDAF is INTEGER
          The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D
          as determined by SSYTRF.
[in]B
          B is REAL array, dimension (LDB,NRHS)
          The right hand side matrix B.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[in,out]X
          X is REAL array, dimension (LDX,NRHS)
          On entry, the solution matrix X, as computed by SSYTRS.
          On exit, the improved solution matrix X.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.  LDX >= max(1,N).
[out]FERR
          FERR is REAL array, dimension (NRHS)
          The estimated forward error bound for each solution vector
          X(j) (the j-th column of the solution matrix X).
          If XTRUE is the true solution corresponding to X(j), FERR(j)
          is an estimated upper bound for the magnitude of the largest
          element in (X(j) - XTRUE) divided by the magnitude of the
          largest element in X(j).  The estimate is as reliable as
          the estimate for RCOND, and is almost always a slight
          overestimate of the true error.
[out]BERR
          BERR is REAL array, dimension (NRHS)
          The componentwise relative backward error of each solution
          vector X(j) (i.e., the smallest relative change in
          any element of A or B that makes X(j) an exact solution).
[out]WORK
          WORK is REAL array, dimension (3*N)
[out]IWORK
          IWORK is INTEGER array, dimension (N)
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Internal Parameters:
  ITMAX is the maximum number of steps of iterative refinement.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 193 of file ssyrfs.f.

193 *
194 * -- LAPACK computational routine (version 3.4.0) --
195 * -- LAPACK is a software package provided by Univ. of Tennessee, --
196 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
197 * November 2011
198 *
199 * .. Scalar Arguments ..
200  CHARACTER uplo
201  INTEGER info, lda, ldaf, ldb, ldx, n, nrhs
202 * ..
203 * .. Array Arguments ..
204  INTEGER ipiv( * ), iwork( * )
205  REAL a( lda, * ), af( ldaf, * ), b( ldb, * ),
206  $ berr( * ), ferr( * ), work( * ), x( ldx, * )
207 * ..
208 *
209 * =====================================================================
210 *
211 * .. Parameters ..
212  INTEGER itmax
213  parameter( itmax = 5 )
214  REAL zero
215  parameter( zero = 0.0e+0 )
216  REAL one
217  parameter( one = 1.0e+0 )
218  REAL two
219  parameter( two = 2.0e+0 )
220  REAL three
221  parameter( three = 3.0e+0 )
222 * ..
223 * .. Local Scalars ..
224  LOGICAL upper
225  INTEGER count, i, j, k, kase, nz
226  REAL eps, lstres, s, safe1, safe2, safmin, xk
227 * ..
228 * .. Local Arrays ..
229  INTEGER isave( 3 )
230 * ..
231 * .. External Subroutines ..
232  EXTERNAL saxpy, scopy, slacn2, ssymv, ssytrs, xerbla
233 * ..
234 * .. Intrinsic Functions ..
235  INTRINSIC abs, max
236 * ..
237 * .. External Functions ..
238  LOGICAL lsame
239  REAL slamch
240  EXTERNAL lsame, slamch
241 * ..
242 * .. Executable Statements ..
243 *
244 * Test the input parameters.
245 *
246  info = 0
247  upper = lsame( uplo, 'U' )
248  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
249  info = -1
250  ELSE IF( n.LT.0 ) THEN
251  info = -2
252  ELSE IF( nrhs.LT.0 ) THEN
253  info = -3
254  ELSE IF( lda.LT.max( 1, n ) ) THEN
255  info = -5
256  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
257  info = -7
258  ELSE IF( ldb.LT.max( 1, n ) ) THEN
259  info = -10
260  ELSE IF( ldx.LT.max( 1, n ) ) THEN
261  info = -12
262  END IF
263  IF( info.NE.0 ) THEN
264  CALL xerbla( 'SSYRFS', -info )
265  RETURN
266  END IF
267 *
268 * Quick return if possible
269 *
270  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
271  DO 10 j = 1, nrhs
272  ferr( j ) = zero
273  berr( j ) = zero
274  10 CONTINUE
275  RETURN
276  END IF
277 *
278 * NZ = maximum number of nonzero elements in each row of A, plus 1
279 *
280  nz = n + 1
281  eps = slamch( 'Epsilon' )
282  safmin = slamch( 'Safe minimum' )
283  safe1 = nz*safmin
284  safe2 = safe1 / eps
285 *
286 * Do for each right hand side
287 *
288  DO 140 j = 1, nrhs
289 *
290  count = 1
291  lstres = three
292  20 CONTINUE
293 *
294 * Loop until stopping criterion is satisfied.
295 *
296 * Compute residual R = B - A * X
297 *
298  CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
299  CALL ssymv( uplo, n, -one, a, lda, x( 1, j ), 1, one,
300  $ work( n+1 ), 1 )
301 *
302 * Compute componentwise relative backward error from formula
303 *
304 * max(i) ( abs(R(i)) / ( abs(A)*abs(X) + abs(B) )(i) )
305 *
306 * where abs(Z) is the componentwise absolute value of the matrix
307 * or vector Z. If the i-th component of the denominator is less
308 * than SAFE2, then SAFE1 is added to the i-th components of the
309 * numerator and denominator before dividing.
310 *
311  DO 30 i = 1, n
312  work( i ) = abs( b( i, j ) )
313  30 CONTINUE
314 *
315 * Compute abs(A)*abs(X) + abs(B).
316 *
317  IF( upper ) THEN
318  DO 50 k = 1, n
319  s = zero
320  xk = abs( x( k, j ) )
321  DO 40 i = 1, k - 1
322  work( i ) = work( i ) + abs( a( i, k ) )*xk
323  s = s + abs( a( i, k ) )*abs( x( i, j ) )
324  40 CONTINUE
325  work( k ) = work( k ) + abs( a( k, k ) )*xk + s
326  50 CONTINUE
327  ELSE
328  DO 70 k = 1, n
329  s = zero
330  xk = abs( x( k, j ) )
331  work( k ) = work( k ) + abs( a( k, k ) )*xk
332  DO 60 i = k + 1, n
333  work( i ) = work( i ) + abs( a( i, k ) )*xk
334  s = s + abs( a( i, k ) )*abs( x( i, j ) )
335  60 CONTINUE
336  work( k ) = work( k ) + s
337  70 CONTINUE
338  END IF
339  s = zero
340  DO 80 i = 1, n
341  IF( work( i ).GT.safe2 ) THEN
342  s = max( s, abs( work( n+i ) ) / work( i ) )
343  ELSE
344  s = max( s, ( abs( work( n+i ) )+safe1 ) /
345  $ ( work( i )+safe1 ) )
346  END IF
347  80 CONTINUE
348  berr( j ) = s
349 *
350 * Test stopping criterion. Continue iterating if
351 * 1) The residual BERR(J) is larger than machine epsilon, and
352 * 2) BERR(J) decreased by at least a factor of 2 during the
353 * last iteration, and
354 * 3) At most ITMAX iterations tried.
355 *
356  IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
357  $ count.LE.itmax ) THEN
358 *
359 * Update solution and try again.
360 *
361  CALL ssytrs( uplo, n, 1, af, ldaf, ipiv, work( n+1 ), n,
362  $ info )
363  CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
364  lstres = berr( j )
365  count = count + 1
366  GO TO 20
367  END IF
368 *
369 * Bound error from formula
370 *
371 * norm(X - XTRUE) / norm(X) .le. FERR =
372 * norm( abs(inv(A))*
373 * ( abs(R) + NZ*EPS*( abs(A)*abs(X)+abs(B) ))) / norm(X)
374 *
375 * where
376 * norm(Z) is the magnitude of the largest component of Z
377 * inv(A) is the inverse of A
378 * abs(Z) is the componentwise absolute value of the matrix or
379 * vector Z
380 * NZ is the maximum number of nonzeros in any row of A, plus 1
381 * EPS is machine epsilon
382 *
383 * The i-th component of abs(R)+NZ*EPS*(abs(A)*abs(X)+abs(B))
384 * is incremented by SAFE1 if the i-th component of
385 * abs(A)*abs(X) + abs(B) is less than SAFE2.
386 *
387 * Use SLACN2 to estimate the infinity-norm of the matrix
388 * inv(A) * diag(W),
389 * where W = abs(R) + NZ*EPS*( abs(A)*abs(X)+abs(B) )))
390 *
391  DO 90 i = 1, n
392  IF( work( i ).GT.safe2 ) THEN
393  work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
394  ELSE
395  work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
396  END IF
397  90 CONTINUE
398 *
399  kase = 0
400  100 CONTINUE
401  CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork, ferr( j ),
402  $ kase, isave )
403  IF( kase.NE.0 ) THEN
404  IF( kase.EQ.1 ) THEN
405 *
406 * Multiply by diag(W)*inv(A**T).
407 *
408  CALL ssytrs( uplo, n, 1, af, ldaf, ipiv, work( n+1 ), n,
409  $ info )
410  DO 110 i = 1, n
411  work( n+i ) = work( i )*work( n+i )
412  110 CONTINUE
413  ELSE IF( kase.EQ.2 ) THEN
414 *
415 * Multiply by inv(A)*diag(W).
416 *
417  DO 120 i = 1, n
418  work( n+i ) = work( i )*work( n+i )
419  120 CONTINUE
420  CALL ssytrs( uplo, n, 1, af, ldaf, ipiv, work( n+1 ), n,
421  $ info )
422  END IF
423  GO TO 100
424  END IF
425 *
426 * Normalize error.
427 *
428  lstres = zero
429  DO 130 i = 1, n
430  lstres = max( lstres, abs( x( i, j ) ) )
431  130 CONTINUE
432  IF( lstres.NE.zero )
433  $ ferr( j ) = ferr( j ) / lstres
434 *
435  140 CONTINUE
436 *
437  RETURN
438 *
439 * End of SSYRFS
440 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssymv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SSYMV
Definition: ssymv.f:154
subroutine ssytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SSYTRS
Definition: ssytrs.f:122
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssyrfsx ( character  UPLO,
character  EQUED,
integer  N,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldaf, * )  AF,
integer  LDAF,
integer, dimension( * )  IPIV,
real, dimension( * )  S,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldx, * )  X,
integer  LDX,
real  RCOND,
real, dimension( * )  BERR,
integer  N_ERR_BNDS,
real, dimension( nrhs, * )  ERR_BNDS_NORM,
real, dimension( nrhs, * )  ERR_BNDS_COMP,
integer  NPARAMS,
real, dimension( * )  PARAMS,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

SSYRFSX

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

Purpose:
    SSYRFSX improves the computed solution to a system of linear
    equations when the coefficient matrix is symmetric indefinite, and
    provides error bounds and backward error estimates for the
    solution.  In addition to normwise error bound, the code provides
    maximum componentwise error bound if possible.  See comments for
    ERR_BNDS_NORM and ERR_BNDS_COMP for details of the error bounds.

    The original system of linear equations may have been equilibrated
    before calling this routine, as described by arguments EQUED and S
    below. In this case, the solution and error bounds returned are
    for the original unequilibrated system.
     Some optional parameters are bundled in the PARAMS array.  These
     settings determine how refinement is performed, but often the
     defaults are acceptable.  If the defaults are acceptable, users
     can pass NPARAMS = 0 which prevents the source code from accessing
     the PARAMS argument.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
       = 'U':  Upper triangle of A is stored;
       = 'L':  Lower triangle of A is stored.
[in]EQUED
          EQUED is CHARACTER*1
     Specifies the form of equilibration that was done to A
     before calling this routine. This is needed to compute
     the solution and error bounds correctly.
       = 'N':  No equilibration
       = 'Y':  Both row and column equilibration, i.e., A has been
               replaced by diag(S) * A * diag(S).
               The right hand side B has been changed accordingly.
[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 matrices B and X.  NRHS >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
     upper triangular part of A contains the upper triangular
     part of the matrix A, and the strictly lower triangular
     part of A is not referenced.  If UPLO = 'L', the leading
     N-by-N lower triangular part of A contains the lower
     triangular part of the matrix A, and the strictly upper
     triangular part of A is not referenced.
[in]LDA
          LDA is INTEGER
     The leading dimension of the array A.  LDA >= max(1,N).
[in]AF
          AF is REAL array, dimension (LDAF,N)
     The factored form of the matrix A.  AF contains the block
     diagonal matrix D and the multipliers used to obtain the
     factor U or L from the factorization A = U*D*U**T or A =
     L*D*L**T as computed by SSYTRF.
[in]LDAF
          LDAF is INTEGER
     The leading dimension of the array AF.  LDAF >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     Details of the interchanges and the block structure of D
     as determined by SSYTRF.
[in,out]S
          S is REAL array, dimension (N)
     The scale factors for A.  If EQUED = 'Y', A is multiplied on
     the left and right by diag(S).  S is an input argument if FACT =
     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
     = 'Y', each element of S must be positive.  If S is output, each
     element of S is a power of the radix. If S is input, each element
     of S should be a power of the radix to ensure a reliable solution
     and error estimates. Scaling by powers of the radix does not cause
     rounding errors unless the result underflows or overflows.
     Rounding errors during scaling lead to refining with a matrix that
     is not equivalent to the input matrix, producing error estimates
     that may not be reliable.
[in]B
          B is REAL array, dimension (LDB,NRHS)
     The right hand side matrix B.
[in]LDB
          LDB is INTEGER
     The leading dimension of the array B.  LDB >= max(1,N).
[in,out]X
          X is REAL array, dimension (LDX,NRHS)
     On entry, the solution matrix X, as computed by SGETRS.
     On exit, the improved solution matrix X.
[in]LDX
          LDX is INTEGER
     The leading dimension of the array X.  LDX >= max(1,N).
[out]RCOND
          RCOND is REAL
     Reciprocal scaled condition number.  This is an estimate of the
     reciprocal Skeel condition number of the matrix A after
     equilibration (if done).  If this is less than the machine
     precision (in particular, if it is zero), the matrix is singular
     to working precision.  Note that the error may still be small even
     if this number is very small and the matrix appears ill-
     conditioned.
[out]BERR
          BERR is REAL array, dimension (NRHS)
     Componentwise relative backward error.  This is the
     componentwise relative backward error of each solution vector X(j)
     (i.e., the smallest relative change in any element of A or B that
     makes X(j) an exact solution).
[in]N_ERR_BNDS
          N_ERR_BNDS is INTEGER
     Number of error bounds to return for each right hand side
     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
     ERR_BNDS_COMP below.
[out]ERR_BNDS_NORM
          ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     normwise relative error, which is defined as follows:

     Normwise relative error in the ith solution vector:
             max_j (abs(XTRUE(j,i) - X(j,i)))
            ------------------------------
                  max_j abs(X(j,i))

     The array is indexed by the type of error information as described
     below. There currently are up to three pieces of information
     returned.

     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_NORM(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated normwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*A, where S scales each row by a power of the
              radix so all absolute row sums of Z are approximately 1.

     See Lapack Working Note 165 for further details and extra
     cautions.
[out]ERR_BNDS_COMP
          ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     componentwise relative error, which is defined as follows:

     Componentwise relative error in the ith solution vector:
                    abs(XTRUE(j,i) - X(j,i))
             max_j ----------------------
                         abs(X(j,i))

     The array is indexed by the right-hand side i (on which the
     componentwise relative error depends), and the type of error
     information as described below. There currently are up to three
     pieces of information returned for each right-hand side. If
     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
     the first (:,N_ERR_BNDS) entries are returned.

     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_COMP(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated componentwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*(A*diag(x)), where x is the solution for the
              current right-hand side and S scales each row of
              A*diag(x) by a power of the radix so all absolute row
              sums of Z are approximately 1.

     See Lapack Working Note 165 for further details and extra
     cautions.
[in]NPARAMS
          NPARAMS is INTEGER
     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
     PARAMS array is never referenced and default values are used.
[in,out]PARAMS
          PARAMS is REAL array, dimension NPARAMS
     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
     that entry will be filled with default value used for that
     parameter.  Only positions up to NPARAMS are accessed; defaults
     are used for higher-numbered parameters.

       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
            refinement or not.
         Default: 1.0
            = 0.0 : No refinement is performed, and no error bounds are
                    computed.
            = 1.0 : Use the double-precision refinement algorithm,
                    possibly with doubled-single computations if the
                    compilation environment does not support DOUBLE
                    PRECISION.
              (other values are reserved for future use)

       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
            computations allowed for refinement.
         Default: 10
         Aggressive: Set to 100 to permit convergence using approximate
                     factorizations or factorizations other than LU. If
                     the factorization uses a technique other than
                     Gaussian elimination, the guarantees in
                     err_bnds_norm and err_bnds_comp may no longer be
                     trustworthy.

       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
            will attempt to find a solution with small componentwise
            relative error in the double-precision algorithm.  Positive
            is true, 0.0 is false.
         Default: 1.0 (attempt componentwise convergence)
[out]WORK
          WORK is REAL array, dimension (4*N)
[out]IWORK
          IWORK is INTEGER array, dimension (N)
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit. The solution to every right-hand side is
         guaranteed.
       < 0:  If INFO = -i, the i-th argument had an illegal value
       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
         has been completed, but the factor U is exactly singular, so
         the solution and error bounds could not be computed. RCOND = 0
         is returned.
       = N+J: The solution corresponding to the Jth right-hand side is
         not guaranteed. The solutions corresponding to other right-
         hand sides K with K > J may not be guaranteed as well, but
         only the first such right-hand side is reported. If a small
         componentwise error is not requested (PARAMS(3) = 0.0) then
         the Jth right-hand side is the first with a normwise error
         bound that is not guaranteed (the smallest J such
         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
         the Jth right-hand side is the first with either a normwise or
         componentwise error bound that is not guaranteed (the smallest
         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
         about all of the right-hand sides check ERR_BNDS_NORM or
         ERR_BNDS_COMP.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
April 2012

Definition at line 404 of file ssyrfsx.f.

404 *
405 * -- LAPACK computational routine (version 3.4.1) --
406 * -- LAPACK is a software package provided by Univ. of Tennessee, --
407 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
408 * April 2012
409 *
410 * .. Scalar Arguments ..
411  CHARACTER uplo, equed
412  INTEGER info, lda, ldaf, ldb, ldx, n, nrhs, nparams,
413  $ n_err_bnds
414  REAL rcond
415 * ..
416 * .. Array Arguments ..
417  INTEGER ipiv( * ), iwork( * )
418  REAL a( lda, * ), af( ldaf, * ), b( ldb, * ),
419  $ x( ldx, * ), work( * )
420  REAL s( * ), params( * ), berr( * ),
421  $ err_bnds_norm( nrhs, * ),
422  $ err_bnds_comp( nrhs, * )
423 * ..
424 *
425 * ==================================================================
426 *
427 * .. Parameters ..
428  REAL zero, one
429  parameter( zero = 0.0e+0, one = 1.0e+0 )
430  REAL itref_default, ithresh_default,
431  $ componentwise_default
432  REAL rthresh_default, dzthresh_default
433  parameter( itref_default = 1.0 )
434  parameter( ithresh_default = 10.0 )
435  parameter( componentwise_default = 1.0 )
436  parameter( rthresh_default = 0.5 )
437  parameter( dzthresh_default = 0.25 )
438  INTEGER la_linrx_itref_i, la_linrx_ithresh_i,
439  $ la_linrx_cwise_i
440  parameter( la_linrx_itref_i = 1,
441  $ la_linrx_ithresh_i = 2 )
442  parameter( la_linrx_cwise_i = 3 )
443  INTEGER la_linrx_trust_i, la_linrx_err_i,
444  $ la_linrx_rcond_i
445  parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
446  parameter( la_linrx_rcond_i = 3 )
447 * ..
448 * .. Local Scalars ..
449  CHARACTER(1) norm
450  LOGICAL rcequ
451  INTEGER j, prec_type, ref_type, n_norms
452  REAL anorm, rcond_tmp
453  REAL illrcond_thresh, err_lbnd, cwise_wrong
454  LOGICAL ignore_cwise
455  INTEGER ithresh
456  REAL rthresh, unstable_thresh
457 * ..
458 * .. External Subroutines ..
460 * ..
461 * .. Intrinsic Functions ..
462  INTRINSIC max, sqrt
463 * ..
464 * .. External Functions ..
465  EXTERNAL lsame, blas_fpinfo_x, ilatrans, ilaprec
466  EXTERNAL slamch, slansy, sla_syrcond
467  REAL slamch, slansy, sla_syrcond
468  LOGICAL lsame
469  INTEGER blas_fpinfo_x
470  INTEGER ilatrans, ilaprec
471 * ..
472 * .. Executable Statements ..
473 *
474 * Check the input parameters.
475 *
476  info = 0
477  ref_type = int( itref_default )
478  IF ( nparams .GE. la_linrx_itref_i ) THEN
479  IF ( params( la_linrx_itref_i ) .LT. 0.0 ) THEN
480  params( la_linrx_itref_i ) = itref_default
481  ELSE
482  ref_type = params( la_linrx_itref_i )
483  END IF
484  END IF
485 *
486 * Set default parameters.
487 *
488  illrcond_thresh = REAL( n )*slamch( 'Epsilon' )
489  ithresh = int( ithresh_default )
490  rthresh = rthresh_default
491  unstable_thresh = dzthresh_default
492  ignore_cwise = componentwise_default .EQ. 0.0
493 *
494  IF ( nparams.GE.la_linrx_ithresh_i ) THEN
495  IF ( params( la_linrx_ithresh_i ).LT.0.0 ) THEN
496  params( la_linrx_ithresh_i ) = ithresh
497  ELSE
498  ithresh = int( params( la_linrx_ithresh_i ) )
499  END IF
500  END IF
501  IF ( nparams.GE.la_linrx_cwise_i ) THEN
502  IF ( params( la_linrx_cwise_i ).LT.0.0 ) THEN
503  IF ( ignore_cwise ) THEN
504  params( la_linrx_cwise_i ) = 0.0
505  ELSE
506  params( la_linrx_cwise_i ) = 1.0
507  END IF
508  ELSE
509  ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0
510  END IF
511  END IF
512  IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 ) THEN
513  n_norms = 0
514  ELSE IF ( ignore_cwise ) THEN
515  n_norms = 1
516  ELSE
517  n_norms = 2
518  END IF
519 *
520  rcequ = lsame( equed, 'Y' )
521 *
522 * Test input parameters.
523 *
524  IF ( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
525  info = -1
526  ELSE IF( .NOT.rcequ .AND. .NOT.lsame( equed, 'N' ) ) THEN
527  info = -2
528  ELSE IF( n.LT.0 ) THEN
529  info = -3
530  ELSE IF( nrhs.LT.0 ) THEN
531  info = -4
532  ELSE IF( lda.LT.max( 1, n ) ) THEN
533  info = -6
534  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
535  info = -8
536  ELSE IF( ldb.LT.max( 1, n ) ) THEN
537  info = -12
538  ELSE IF( ldx.LT.max( 1, n ) ) THEN
539  info = -14
540  END IF
541  IF( info.NE.0 ) THEN
542  CALL xerbla( 'SSYRFSX', -info )
543  RETURN
544  END IF
545 *
546 * Quick return if possible.
547 *
548  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
549  rcond = 1.0
550  DO j = 1, nrhs
551  berr( j ) = 0.0
552  IF ( n_err_bnds .GE. 1 ) THEN
553  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
554  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
555  END IF
556  IF ( n_err_bnds .GE. 2 ) THEN
557  err_bnds_norm( j, la_linrx_err_i ) = 0.0
558  err_bnds_comp( j, la_linrx_err_i ) = 0.0
559  END IF
560  IF ( n_err_bnds .GE. 3 ) THEN
561  err_bnds_norm( j, la_linrx_rcond_i ) = 1.0
562  err_bnds_comp( j, la_linrx_rcond_i ) = 1.0
563  END IF
564  END DO
565  RETURN
566  END IF
567 *
568 * Default to failure.
569 *
570  rcond = 0.0
571  DO j = 1, nrhs
572  berr( j ) = 1.0
573  IF ( n_err_bnds .GE. 1 ) THEN
574  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
575  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
576  END IF
577  IF ( n_err_bnds .GE. 2 ) THEN
578  err_bnds_norm( j, la_linrx_err_i ) = 1.0
579  err_bnds_comp( j, la_linrx_err_i ) = 1.0
580  END IF
581  IF ( n_err_bnds .GE. 3 ) THEN
582  err_bnds_norm( j, la_linrx_rcond_i ) = 0.0
583  err_bnds_comp( j, la_linrx_rcond_i ) = 0.0
584  END IF
585  END DO
586 *
587 * Compute the norm of A and the reciprocal of the condition
588 * number of A.
589 *
590  norm = 'I'
591  anorm = slansy( norm, uplo, n, a, lda, work )
592  CALL ssycon( uplo, n, af, ldaf, ipiv, anorm, rcond, work,
593  $ iwork, info )
594 *
595 * Perform refinement on each right-hand side
596 *
597  IF ( ref_type .NE. 0 ) THEN
598 
599  prec_type = ilaprec( 'D' )
600 
601  CALL sla_syrfsx_extended( prec_type, uplo, n,
602  $ nrhs, a, lda, af, ldaf, ipiv, rcequ, s, b,
603  $ ldb, x, ldx, berr, n_norms, err_bnds_norm, err_bnds_comp,
604  $ work( n+1 ), work( 1 ), work( 2*n+1 ), work( 1 ), rcond,
605  $ ithresh, rthresh, unstable_thresh, ignore_cwise,
606  $ info )
607  END IF
608 
609  err_lbnd = max( 10.0, sqrt( REAL( N ) ) )*slamch( 'Epsilon' )
610  IF (n_err_bnds .GE. 1 .AND. n_norms .GE. 1) THEN
611 *
612 * Compute scaled normwise condition number cond(A*C).
613 *
614  IF ( rcequ ) THEN
615  rcond_tmp = sla_syrcond( uplo, n, a, lda, af, ldaf, ipiv,
616  $ -1, s, info, work, iwork )
617  ELSE
618  rcond_tmp = sla_syrcond( uplo, n, a, lda, af, ldaf, ipiv,
619  $ 0, s, info, work, iwork )
620  END IF
621  DO j = 1, nrhs
622 *
623 * Cap the error at 1.0.
624 *
625  IF (n_err_bnds .GE. la_linrx_err_i
626  $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0)
627  $ err_bnds_norm( j, la_linrx_err_i ) = 1.0
628 *
629 * Threshold the error (see LAWN).
630 *
631  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
632  err_bnds_norm( j, la_linrx_err_i ) = 1.0
633  err_bnds_norm( j, la_linrx_trust_i ) = 0.0
634  IF ( info .LE. n ) info = n + j
635  ELSE IF (err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd)
636  $ THEN
637  err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
638  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
639  END IF
640 *
641 * Save the condition number.
642 *
643  IF (n_err_bnds .GE. la_linrx_rcond_i) THEN
644  err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
645  END IF
646  END DO
647  END IF
648 
649  IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 2 ) THEN
650 *
651 * Compute componentwise condition number cond(A*diag(Y(:,J))) for
652 * each right-hand side using the current solution as an estimate of
653 * the true solution. If the componentwise error estimate is too
654 * large, then the solution is a lousy estimate of truth and the
655 * estimated RCOND may be too optimistic. To avoid misleading users,
656 * the inverse condition number is set to 0.0 when the estimated
657 * cwise error is at least CWISE_WRONG.
658 *
659  cwise_wrong = sqrt( slamch( 'Epsilon' ) )
660  DO j = 1, nrhs
661  IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
662  $ THEN
663  rcond_tmp = sla_syrcond( uplo, n, a, lda, af, ldaf, ipiv,
664  $ 1, x(1,j), info, work, iwork )
665  ELSE
666  rcond_tmp = 0.0
667  END IF
668 *
669 * Cap the error at 1.0.
670 *
671  IF ( n_err_bnds .GE. la_linrx_err_i
672  $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0 )
673  $ err_bnds_comp( j, la_linrx_err_i ) = 1.0
674 *
675 * Threshold the error (see LAWN).
676 *
677  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
678  err_bnds_comp( j, la_linrx_err_i ) = 1.0
679  err_bnds_comp( j, la_linrx_trust_i ) = 0.0
680  IF ( .NOT. ignore_cwise
681  $ .AND. info.LT.n + j ) info = n + j
682  ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
683  $ .LT. err_lbnd ) THEN
684  err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
685  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
686  END IF
687 *
688 * Save the condition number.
689 *
690  IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
691  err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp
692  END IF
693 
694  END DO
695  END IF
696 *
697  RETURN
698 *
699 * End of SSYRFSX
700 *
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:60
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssycon(UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
SSYCON
Definition: ssycon.f:132
real function sla_syrcond(UPLO, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)
SLA_SYRCOND estimates the Skeel condition number for a symmetric indefinite matrix.
Definition: sla_syrcond.f:148
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaprec(PREC)
ILAPREC
Definition: ilaprec.f:60
real function slansy(NORM, UPLO, N, A, LDA, WORK)
SLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.
Definition: slansy.f:124
subroutine sla_syrfsx_extended(PREC_TYPE, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
SLA_SYRFSX_EXTENDED improves the computed solution to a system of linear equations for symmetric inde...

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssytd2 ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( * )  TAU,
integer  INFO 
)

SSYTD2 reduces a symmetric matrix to real symmetric tridiagonal form by an orthogonal similarity transformation (unblocked algorithm).

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

Purpose:
 SSYTD2 reduces a real symmetric matrix A to symmetric tridiagonal
 form T by an orthogonal similarity transformation: Q**T * A * Q = T.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.
          On exit, if UPLO = 'U', the diagonal and first superdiagonal
          of A are overwritten by the corresponding elements of the
          tridiagonal matrix T, and the elements above the first
          superdiagonal, with the array TAU, represent the orthogonal
          matrix Q as a product of elementary reflectors; if UPLO
          = 'L', the diagonal and first subdiagonal of A are over-
          written by the corresponding elements of the tridiagonal
          matrix T, and the elements below the first subdiagonal, with
          the array TAU, represent the orthogonal matrix Q as a product
          of elementary reflectors. See Further Details.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]D
          D is REAL array, dimension (N)
          The diagonal elements of the tridiagonal matrix T:
          D(i) = A(i,i).
[out]E
          E is REAL array, dimension (N-1)
          The off-diagonal elements of the tridiagonal matrix T:
          E(i) = A(i,i+1) if UPLO = 'U', E(i) = A(i+1,i) if UPLO = 'L'.
[out]TAU
          TAU is REAL array, dimension (N-1)
          The scalar factors of the elementary reflectors (see Further
          Details).
[out]INFO
          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
September 2012
Further Details:
  If UPLO = 'U', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(n-1) . . . H(2) H(1).

  Each H(i) has the form

     H(i) = I - tau * v * v**T

  where tau is a real scalar, and v is a real vector with
  v(i+1:n) = 0 and v(i) = 1; v(1:i-1) is stored on exit in
  A(1:i-1,i+1), and tau in TAU(i).

  If UPLO = 'L', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(1) H(2) . . . H(n-1).

  Each H(i) has the form

     H(i) = I - tau * v * v**T

  where tau is a real scalar, and v is a real vector with
  v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in A(i+2:n,i),
  and tau in TAU(i).

  The contents of A on exit are illustrated by the following examples
  with n = 5:

  if UPLO = 'U':                       if UPLO = 'L':

    (  d   e   v2  v3  v4 )              (  d                  )
    (      d   e   v3  v4 )              (  e   d              )
    (          d   e   v4 )              (  v1  e   d          )
    (              d   e  )              (  v1  v2  e   d      )
    (                  d  )              (  v1  v2  v3  e   d  )

  where d and e denote diagonal and off-diagonal elements of T, and vi
  denotes an element of the vector defining H(i).

Definition at line 175 of file ssytd2.f.

175 *
176 * -- LAPACK computational routine (version 3.4.2) --
177 * -- LAPACK is a software package provided by Univ. of Tennessee, --
178 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179 * September 2012
180 *
181 * .. Scalar Arguments ..
182  CHARACTER uplo
183  INTEGER info, lda, n
184 * ..
185 * .. Array Arguments ..
186  REAL a( lda, * ), d( * ), e( * ), tau( * )
187 * ..
188 *
189 * =====================================================================
190 *
191 * .. Parameters ..
192  REAL one, zero, half
193  parameter( one = 1.0, zero = 0.0, half = 1.0 / 2.0 )
194 * ..
195 * .. Local Scalars ..
196  LOGICAL upper
197  INTEGER i
198  REAL alpha, taui
199 * ..
200 * .. External Subroutines ..
201  EXTERNAL saxpy, slarfg, ssymv, ssyr2, xerbla
202 * ..
203 * .. External Functions ..
204  LOGICAL lsame
205  REAL sdot
206  EXTERNAL lsame, sdot
207 * ..
208 * .. Intrinsic Functions ..
209  INTRINSIC max, min
210 * ..
211 * .. Executable Statements ..
212 *
213 * Test the input parameters
214 *
215  info = 0
216  upper = lsame( uplo, 'U' )
217  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
218  info = -1
219  ELSE IF( n.LT.0 ) THEN
220  info = -2
221  ELSE IF( lda.LT.max( 1, n ) ) THEN
222  info = -4
223  END IF
224  IF( info.NE.0 ) THEN
225  CALL xerbla( 'SSYTD2', -info )
226  RETURN
227  END IF
228 *
229 * Quick return if possible
230 *
231  IF( n.LE.0 )
232  $ RETURN
233 *
234  IF( upper ) THEN
235 *
236 * Reduce the upper triangle of A
237 *
238  DO 10 i = n - 1, 1, -1
239 *
240 * Generate elementary reflector H(i) = I - tau * v * v**T
241 * to annihilate A(1:i-1,i+1)
242 *
243  CALL slarfg( i, a( i, i+1 ), a( 1, i+1 ), 1, taui )
244  e( i ) = a( i, i+1 )
245 *
246  IF( taui.NE.zero ) THEN
247 *
248 * Apply H(i) from both sides to A(1:i,1:i)
249 *
250  a( i, i+1 ) = one
251 *
252 * Compute x := tau * A * v storing x in TAU(1:i)
253 *
254  CALL ssymv( uplo, i, taui, a, lda, a( 1, i+1 ), 1, zero,
255  $ tau, 1 )
256 *
257 * Compute w := x - 1/2 * tau * (x**T * v) * v
258 *
259  alpha = -half*taui*sdot( i, tau, 1, a( 1, i+1 ), 1 )
260  CALL saxpy( i, alpha, a( 1, i+1 ), 1, tau, 1 )
261 *
262 * Apply the transformation as a rank-2 update:
263 * A := A - v * w**T - w * v**T
264 *
265  CALL ssyr2( uplo, i, -one, a( 1, i+1 ), 1, tau, 1, a,
266  $ lda )
267 *
268  a( i, i+1 ) = e( i )
269  END IF
270  d( i+1 ) = a( i+1, i+1 )
271  tau( i ) = taui
272  10 CONTINUE
273  d( 1 ) = a( 1, 1 )
274  ELSE
275 *
276 * Reduce the lower triangle of A
277 *
278  DO 20 i = 1, n - 1
279 *
280 * Generate elementary reflector H(i) = I - tau * v * v**T
281 * to annihilate A(i+2:n,i)
282 *
283  CALL slarfg( n-i, a( i+1, i ), a( min( i+2, n ), i ), 1,
284  $ taui )
285  e( i ) = a( i+1, i )
286 *
287  IF( taui.NE.zero ) THEN
288 *
289 * Apply H(i) from both sides to A(i+1:n,i+1:n)
290 *
291  a( i+1, i ) = one
292 *
293 * Compute x := tau * A * v storing y in TAU(i:n-1)
294 *
295  CALL ssymv( uplo, n-i, taui, a( i+1, i+1 ), lda,
296  $ a( i+1, i ), 1, zero, tau( i ), 1 )
297 *
298 * Compute w := x - 1/2 * tau * (x**T * v) * v
299 *
300  alpha = -half*taui*sdot( n-i, tau( i ), 1, a( i+1, i ),
301  $ 1 )
302  CALL saxpy( n-i, alpha, a( i+1, i ), 1, tau( i ), 1 )
303 *
304 * Apply the transformation as a rank-2 update:
305 * A := A - v * w**T - w * v**T
306 *
307  CALL ssyr2( uplo, n-i, -one, a( i+1, i ), 1, tau( i ), 1,
308  $ a( i+1, i+1 ), lda )
309 *
310  a( i+1, i ) = e( i )
311  END IF
312  d( i ) = a( i, i )
313  tau( i ) = taui
314  20 CONTINUE
315  d( n ) = a( n, n )
316  END IF
317 *
318  RETURN
319 *
320 * End of SSYTD2
321 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssymv(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SSYMV
Definition: ssymv.f:154
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slarfg(N, ALPHA, X, INCX, TAU)
SLARFG generates an elementary reflector (Householder matrix).
Definition: slarfg.f:108
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:53
subroutine ssyr2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SSYR2
Definition: ssyr2.f:149

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssytf2 ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
integer  INFO 
)

SSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting method (unblocked algorithm).

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

Purpose:
 SSYTF2 computes the factorization of a real symmetric matrix A using
 the Bunch-Kaufman diagonal pivoting method:

    A = U*D*U**T  or  A = L*D*L**T

 where U (or L) is a product of permutation and unit upper (lower)
 triangular matrices, U**T is the transpose of U, and D is symmetric and
 block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

 This is the unblocked version of the algorithm, calling Level 2 BLAS.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, the block diagonal matrix D and the multipliers used
          to obtain the factor U or L (see below for further details).
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D.

          If UPLO = 'U':
             If IPIV(k) > 0, then rows and columns k and IPIV(k) were
             interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) = IPIV(k-1) < 0, then rows and columns
             k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
             is a 2-by-2 diagonal block.

          If UPLO = 'L':
             If IPIV(k) > 0, then rows and columns k and IPIV(k) were
             interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) = IPIV(k+1) < 0, then rows and columns
             k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1)
             is a 2-by-2 diagonal block.
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -k, the k-th argument had an illegal value
          > 0: if INFO = k, D(k,k) is exactly zero.  The factorization
               has been completed, but the block diagonal matrix D is
               exactly singular, and division by zero will occur if it
               is used to solve a system of equations.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2013
Further Details:
  If UPLO = 'U', then A = U*D*U**T, where
     U = P(n)*U(n)* ... *P(k)U(k)* ...,
  i.e., U is a product of terms P(k)*U(k), where k decreases from n to
  1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    v    0   )   k-s
     U(k) =  (   0    I    0   )   s
             (   0    0    I   )   n-k
                k-s   s   n-k

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
  If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
  and A(k,k), and v overwrites A(1:k-2,k-1:k).

  If UPLO = 'L', then A = L*D*L**T, where
     L = P(1)*L(1)* ... *P(k)*L(k)* ...,
  i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
  n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    0     0   )  k-1
     L(k) =  (   0    I     0   )  s
             (   0    v     I   )  n-k-s+1
                k-1   s  n-k-s+1

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
  If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
  and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
Contributors:
  09-29-06 - patch from
    Bobby Cheng, MathWorks

    Replace l.204 and l.372
         IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
    by
         IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN

  01-01-96 - Based on modifications by
    J. Lewis, Boeing Computer Services Company
    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
  1-96 - Based on modifications by J. Lewis, Boeing Computer Services
         Company

Definition at line 197 of file ssytf2.f.

197 *
198 * -- LAPACK computational routine (version 3.5.0) --
199 * -- LAPACK is a software package provided by Univ. of Tennessee, --
200 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
201 * November 2013
202 *
203 * .. Scalar Arguments ..
204  CHARACTER uplo
205  INTEGER info, lda, n
206 * ..
207 * .. Array Arguments ..
208  INTEGER ipiv( * )
209  REAL a( lda, * )
210 * ..
211 *
212 * =====================================================================
213 *
214 * .. Parameters ..
215  REAL zero, one
216  parameter( zero = 0.0e+0, one = 1.0e+0 )
217  REAL eight, sevten
218  parameter( eight = 8.0e+0, sevten = 17.0e+0 )
219 * ..
220 * .. Local Scalars ..
221  LOGICAL upper
222  INTEGER i, imax, j, jmax, k, kk, kp, kstep
223  REAL absakk, alpha, colmax, d11, d12, d21, d22, r1,
224  $ rowmax, t, wk, wkm1, wkp1
225 * ..
226 * .. External Functions ..
227  LOGICAL lsame, sisnan
228  INTEGER isamax
229  EXTERNAL lsame, isamax, sisnan
230 * ..
231 * .. External Subroutines ..
232  EXTERNAL sscal, sswap, ssyr, xerbla
233 * ..
234 * .. Intrinsic Functions ..
235  INTRINSIC abs, max, sqrt
236 * ..
237 * .. Executable Statements ..
238 *
239 * Test the input parameters.
240 *
241  info = 0
242  upper = lsame( uplo, 'U' )
243  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
244  info = -1
245  ELSE IF( n.LT.0 ) THEN
246  info = -2
247  ELSE IF( lda.LT.max( 1, n ) ) THEN
248  info = -4
249  END IF
250  IF( info.NE.0 ) THEN
251  CALL xerbla( 'SSYTF2', -info )
252  RETURN
253  END IF
254 *
255 * Initialize ALPHA for use in choosing pivot block size.
256 *
257  alpha = ( one+sqrt( sevten ) ) / eight
258 *
259  IF( upper ) THEN
260 *
261 * Factorize A as U*D*U**T using the upper triangle of A
262 *
263 * K is the main loop index, decreasing from N to 1 in steps of
264 * 1 or 2
265 *
266  k = n
267  10 CONTINUE
268 *
269 * If K < 1, exit from loop
270 *
271  IF( k.LT.1 )
272  $ GO TO 70
273  kstep = 1
274 *
275 * Determine rows and columns to be interchanged and whether
276 * a 1-by-1 or 2-by-2 pivot block will be used
277 *
278  absakk = abs( a( k, k ) )
279 *
280 * IMAX is the row-index of the largest off-diagonal element in
281 * column K, and COLMAX is its absolute value.
282 * Determine both COLMAX and IMAX.
283 *
284  IF( k.GT.1 ) THEN
285  imax = isamax( k-1, a( 1, k ), 1 )
286  colmax = abs( a( imax, k ) )
287  ELSE
288  colmax = zero
289  END IF
290 *
291  IF( (max( absakk, colmax ).EQ.zero) .OR. sisnan(absakk) ) THEN
292 *
293 * Column K is zero or underflow, or contains a NaN:
294 * set INFO and continue
295 *
296  IF( info.EQ.0 )
297  $ info = k
298  kp = k
299  ELSE
300  IF( absakk.GE.alpha*colmax ) THEN
301 *
302 * no interchange, use 1-by-1 pivot block
303 *
304  kp = k
305  ELSE
306 *
307 * JMAX is the column-index of the largest off-diagonal
308 * element in row IMAX, and ROWMAX is its absolute value
309 *
310  jmax = imax + isamax( k-imax, a( imax, imax+1 ), lda )
311  rowmax = abs( a( imax, jmax ) )
312  IF( imax.GT.1 ) THEN
313  jmax = isamax( imax-1, a( 1, imax ), 1 )
314  rowmax = max( rowmax, abs( a( jmax, imax ) ) )
315  END IF
316 *
317  IF( absakk.GE.alpha*colmax*( colmax / rowmax ) ) THEN
318 *
319 * no interchange, use 1-by-1 pivot block
320 *
321  kp = k
322  ELSE IF( abs( a( imax, imax ) ).GE.alpha*rowmax ) THEN
323 *
324 * interchange rows and columns K and IMAX, use 1-by-1
325 * pivot block
326 *
327  kp = imax
328  ELSE
329 *
330 * interchange rows and columns K-1 and IMAX, use 2-by-2
331 * pivot block
332 *
333  kp = imax
334  kstep = 2
335  END IF
336  END IF
337 *
338  kk = k - kstep + 1
339  IF( kp.NE.kk ) THEN
340 *
341 * Interchange rows and columns KK and KP in the leading
342 * submatrix A(1:k,1:k)
343 *
344  CALL sswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
345  CALL sswap( kk-kp-1, a( kp+1, kk ), 1, a( kp, kp+1 ),
346  $ lda )
347  t = a( kk, kk )
348  a( kk, kk ) = a( kp, kp )
349  a( kp, kp ) = t
350  IF( kstep.EQ.2 ) THEN
351  t = a( k-1, k )
352  a( k-1, k ) = a( kp, k )
353  a( kp, k ) = t
354  END IF
355  END IF
356 *
357 * Update the leading submatrix
358 *
359  IF( kstep.EQ.1 ) THEN
360 *
361 * 1-by-1 pivot block D(k): column k now holds
362 *
363 * W(k) = U(k)*D(k)
364 *
365 * where U(k) is the k-th column of U
366 *
367 * Perform a rank-1 update of A(1:k-1,1:k-1) as
368 *
369 * A := A - U(k)*D(k)*U(k)**T = A - W(k)*1/D(k)*W(k)**T
370 *
371  r1 = one / a( k, k )
372  CALL ssyr( uplo, k-1, -r1, a( 1, k ), 1, a, lda )
373 *
374 * Store U(k) in column k
375 *
376  CALL sscal( k-1, r1, a( 1, k ), 1 )
377  ELSE
378 *
379 * 2-by-2 pivot block D(k): columns k and k-1 now hold
380 *
381 * ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
382 *
383 * where U(k) and U(k-1) are the k-th and (k-1)-th columns
384 * of U
385 *
386 * Perform a rank-2 update of A(1:k-2,1:k-2) as
387 *
388 * A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
389 * = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )**T
390 *
391  IF( k.GT.2 ) THEN
392 *
393  d12 = a( k-1, k )
394  d22 = a( k-1, k-1 ) / d12
395  d11 = a( k, k ) / d12
396  t = one / ( d11*d22-one )
397  d12 = t / d12
398 *
399  DO 30 j = k - 2, 1, -1
400  wkm1 = d12*( d11*a( j, k-1 )-a( j, k ) )
401  wk = d12*( d22*a( j, k )-a( j, k-1 ) )
402  DO 20 i = j, 1, -1
403  a( i, j ) = a( i, j ) - a( i, k )*wk -
404  $ a( i, k-1 )*wkm1
405  20 CONTINUE
406  a( j, k ) = wk
407  a( j, k-1 ) = wkm1
408  30 CONTINUE
409 *
410  END IF
411 *
412  END IF
413  END IF
414 *
415 * Store details of the interchanges in IPIV
416 *
417  IF( kstep.EQ.1 ) THEN
418  ipiv( k ) = kp
419  ELSE
420  ipiv( k ) = -kp
421  ipiv( k-1 ) = -kp
422  END IF
423 *
424 * Decrease K and return to the start of the main loop
425 *
426  k = k - kstep
427  GO TO 10
428 *
429  ELSE
430 *
431 * Factorize A as L*D*L**T using the lower triangle of A
432 *
433 * K is the main loop index, increasing from 1 to N in steps of
434 * 1 or 2
435 *
436  k = 1
437  40 CONTINUE
438 *
439 * If K > N, exit from loop
440 *
441  IF( k.GT.n )
442  $ GO TO 70
443  kstep = 1
444 *
445 * Determine rows and columns to be interchanged and whether
446 * a 1-by-1 or 2-by-2 pivot block will be used
447 *
448  absakk = abs( a( k, k ) )
449 *
450 * IMAX is the row-index of the largest off-diagonal element in
451 * column K, and COLMAX is its absolute value.
452 * Determine both COLMAX and IMAX.
453 *
454  IF( k.LT.n ) THEN
455  imax = k + isamax( n-k, a( k+1, k ), 1 )
456  colmax = abs( a( imax, k ) )
457  ELSE
458  colmax = zero
459  END IF
460 *
461  IF( (max( absakk, colmax ).EQ.zero) .OR. sisnan(absakk) ) THEN
462 *
463 * Column K is zero or underflow, or contains a NaN:
464 * set INFO and continue
465 *
466  IF( info.EQ.0 )
467  $ info = k
468  kp = k
469  ELSE
470  IF( absakk.GE.alpha*colmax ) THEN
471 *
472 * no interchange, use 1-by-1 pivot block
473 *
474  kp = k
475  ELSE
476 *
477 * JMAX is the column-index of the largest off-diagonal
478 * element in row IMAX, and ROWMAX is its absolute value
479 *
480  jmax = k - 1 + isamax( imax-k, a( imax, k ), lda )
481  rowmax = abs( a( imax, jmax ) )
482  IF( imax.LT.n ) THEN
483  jmax = imax + isamax( n-imax, a( imax+1, imax ), 1 )
484  rowmax = max( rowmax, abs( a( jmax, imax ) ) )
485  END IF
486 *
487  IF( absakk.GE.alpha*colmax*( colmax / rowmax ) ) THEN
488 *
489 * no interchange, use 1-by-1 pivot block
490 *
491  kp = k
492  ELSE IF( abs( a( imax, imax ) ).GE.alpha*rowmax ) THEN
493 *
494 * interchange rows and columns K and IMAX, use 1-by-1
495 * pivot block
496 *
497  kp = imax
498  ELSE
499 *
500 * interchange rows and columns K+1 and IMAX, use 2-by-2
501 * pivot block
502 *
503  kp = imax
504  kstep = 2
505  END IF
506  END IF
507 *
508  kk = k + kstep - 1
509  IF( kp.NE.kk ) THEN
510 *
511 * Interchange rows and columns KK and KP in the trailing
512 * submatrix A(k:n,k:n)
513 *
514  IF( kp.LT.n )
515  $ CALL sswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
516  CALL sswap( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
517  $ lda )
518  t = a( kk, kk )
519  a( kk, kk ) = a( kp, kp )
520  a( kp, kp ) = t
521  IF( kstep.EQ.2 ) THEN
522  t = a( k+1, k )
523  a( k+1, k ) = a( kp, k )
524  a( kp, k ) = t
525  END IF
526  END IF
527 *
528 * Update the trailing submatrix
529 *
530  IF( kstep.EQ.1 ) THEN
531 *
532 * 1-by-1 pivot block D(k): column k now holds
533 *
534 * W(k) = L(k)*D(k)
535 *
536 * where L(k) is the k-th column of L
537 *
538  IF( k.LT.n ) THEN
539 *
540 * Perform a rank-1 update of A(k+1:n,k+1:n) as
541 *
542 * A := A - L(k)*D(k)*L(k)**T = A - W(k)*(1/D(k))*W(k)**T
543 *
544  d11 = one / a( k, k )
545  CALL ssyr( uplo, n-k, -d11, a( k+1, k ), 1,
546  $ a( k+1, k+1 ), lda )
547 *
548 * Store L(k) in column K
549 *
550  CALL sscal( n-k, d11, a( k+1, k ), 1 )
551  END IF
552  ELSE
553 *
554 * 2-by-2 pivot block D(k)
555 *
556  IF( k.LT.n-1 ) THEN
557 *
558 * Perform a rank-2 update of A(k+2:n,k+2:n) as
559 *
560 * A := A - ( (A(k) A(k+1))*D(k)**(-1) ) * (A(k) A(k+1))**T
561 *
562 * where L(k) and L(k+1) are the k-th and (k+1)-th
563 * columns of L
564 *
565  d21 = a( k+1, k )
566  d11 = a( k+1, k+1 ) / d21
567  d22 = a( k, k ) / d21
568  t = one / ( d11*d22-one )
569  d21 = t / d21
570 *
571  DO 60 j = k + 2, n
572 *
573  wk = d21*( d11*a( j, k )-a( j, k+1 ) )
574  wkp1 = d21*( d22*a( j, k+1 )-a( j, k ) )
575 *
576  DO 50 i = j, n
577  a( i, j ) = a( i, j ) - a( i, k )*wk -
578  $ a( i, k+1 )*wkp1
579  50 CONTINUE
580 *
581  a( j, k ) = wk
582  a( j, k+1 ) = wkp1
583 *
584  60 CONTINUE
585  END IF
586  END IF
587  END IF
588 *
589 * Store details of the interchanges in IPIV
590 *
591  IF( kstep.EQ.1 ) THEN
592  ipiv( k ) = kp
593  ELSE
594  ipiv( k ) = -kp
595  ipiv( k+1 ) = -kp
596  END IF
597 *
598 * Increase K and return to the start of the main loop
599 *
600  k = k + kstep
601  GO TO 40
602 *
603  END IF
604 *
605  70 CONTINUE
606 *
607  RETURN
608 *
609 * End of SSYTF2
610 *
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine ssyr(UPLO, N, ALPHA, X, INCX, A, LDA)
SSYR
Definition: ssyr.f:134
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssytf2_rook ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
integer  INFO 
)

SSYTF2_ROOK computes the factorization of a real symmetric indefinite matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method (unblocked algorithm).

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

Purpose:
 SSYTF2_ROOK computes the factorization of a real symmetric matrix A
 using the bounded Bunch-Kaufman ("rook") diagonal pivoting method:

    A = U*D*U**T  or  A = L*D*L**T

 where U (or L) is a product of permutation and unit upper (lower)
 triangular matrices, U**T is the transpose of U, and D is symmetric and
 block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

 This is the unblocked version of the algorithm, calling Level 2 BLAS.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          n-by-n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n-by-n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, the block diagonal matrix D and the multipliers used
          to obtain the factor U or L (see below for further details).
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D.

          If UPLO = 'U':
             If IPIV(k) > 0, then rows and columns k and IPIV(k)
             were interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) < 0 and IPIV(k-1) < 0, then rows and
             columns k and -IPIV(k) were interchanged and rows and
             columns k-1 and -IPIV(k-1) were inerchaged,
             D(k-1:k,k-1:k) is a 2-by-2 diagonal block.

          If UPLO = 'L':
             If IPIV(k) > 0, then rows and columns k and IPIV(k)
             were interchanged and D(k,k) is a 1-by-1 diagonal block.

             If IPIV(k) < 0 and IPIV(k+1) < 0, then rows and
             columns k and -IPIV(k) were interchanged and rows and
             columns k+1 and -IPIV(k+1) were inerchaged,
             D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -k, the k-th argument had an illegal value
          > 0: if INFO = k, D(k,k) is exactly zero.  The factorization
               has been completed, but the block diagonal matrix D is
               exactly singular, and division by zero will occur if it
               is used to solve a system of equations.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2013
Further Details:
  If UPLO = 'U', then A = U*D*U**T, where
     U = P(n)*U(n)* ... *P(k)U(k)* ...,
  i.e., U is a product of terms P(k)*U(k), where k decreases from n to
  1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    v    0   )   k-s
     U(k) =  (   0    I    0   )   s
             (   0    0    I   )   n-k
                k-s   s   n-k

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
  If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
  and A(k,k), and v overwrites A(1:k-2,k-1:k).

  If UPLO = 'L', then A = L*D*L**T, where
     L = P(1)*L(1)* ... *P(k)*L(k)* ...,
  i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
  n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    0     0   )  k-1
     L(k) =  (   0    I     0   )  s
             (   0    v     I   )  n-k-s+1
                k-1   s  n-k-s+1

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
  If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
  and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
Contributors:
  November 2013,     Igor Kozachenko,
                  Computer Science Division,
                  University of California, Berkeley

  September 2007, Sven Hammarling, Nicholas J. Higham, Craig Lucas,
                  School of Mathematics,
                  University of Manchester

  01-01-96 - Based on modifications by
    J. Lewis, Boeing Computer Services Company
    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville abd , USA

Definition at line 196 of file ssytf2_rook.f.

196 *
197 * -- LAPACK computational routine (version 3.5.0) --
198 * -- LAPACK is a software package provided by Univ. of Tennessee, --
199 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
200 * November 2013
201 *
202 * .. Scalar Arguments ..
203  CHARACTER uplo
204  INTEGER info, lda, n
205 * ..
206 * .. Array Arguments ..
207  INTEGER ipiv( * )
208  REAL a( lda, * )
209 * ..
210 *
211 * =====================================================================
212 *
213 * .. Parameters ..
214  REAL zero, one
215  parameter( zero = 0.0e+0, one = 1.0e+0 )
216  REAL eight, sevten
217  parameter( eight = 8.0e+0, sevten = 17.0e+0 )
218 * ..
219 * .. Local Scalars ..
220  LOGICAL upper, done
221  INTEGER i, imax, j, jmax, itemp, k, kk, kp, kstep,
222  $ p, ii
223  REAL absakk, alpha, colmax, d11, d12, d21, d22,
224  $ rowmax, stemp, t, wk, wkm1, wkp1, sfmin
225 * ..
226 * .. External Functions ..
227  LOGICAL lsame
228  INTEGER isamax
229  REAL slamch
230  EXTERNAL lsame, isamax, slamch
231 * ..
232 * .. External Subroutines ..
233  EXTERNAL sscal, sswap, ssyr, xerbla
234 * ..
235 * .. Intrinsic Functions ..
236  INTRINSIC abs, max, sqrt
237 * ..
238 * .. Executable Statements ..
239 *
240 * Test the input parameters.
241 *
242  info = 0
243  upper = lsame( uplo, 'U' )
244  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
245  info = -1
246  ELSE IF( n.LT.0 ) THEN
247  info = -2
248  ELSE IF( lda.LT.max( 1, n ) ) THEN
249  info = -4
250  END IF
251  IF( info.NE.0 ) THEN
252  CALL xerbla( 'SSYTF2_ROOK', -info )
253  RETURN
254  END IF
255 *
256 * Initialize ALPHA for use in choosing pivot block size.
257 *
258  alpha = ( one+sqrt( sevten ) ) / eight
259 *
260 * Compute machine safe minimum
261 *
262  sfmin = slamch( 'S' )
263 *
264  IF( upper ) THEN
265 *
266 * Factorize A as U*D*U**T using the upper triangle of A
267 *
268 * K is the main loop index, decreasing from N to 1 in steps of
269 * 1 or 2
270 *
271  k = n
272  10 CONTINUE
273 *
274 * If K < 1, exit from loop
275 *
276  IF( k.LT.1 )
277  $ GO TO 70
278  kstep = 1
279  p = k
280 *
281 * Determine rows and columns to be interchanged and whether
282 * a 1-by-1 or 2-by-2 pivot block will be used
283 *
284  absakk = abs( a( k, k ) )
285 *
286 * IMAX is the row-index of the largest off-diagonal element in
287 * column K, and COLMAX is its absolute value.
288 * Determine both COLMAX and IMAX.
289 *
290  IF( k.GT.1 ) THEN
291  imax = isamax( k-1, a( 1, k ), 1 )
292  colmax = abs( a( imax, k ) )
293  ELSE
294  colmax = zero
295  END IF
296 *
297  IF( (max( absakk, colmax ).EQ.zero) ) THEN
298 *
299 * Column K is zero or underflow: set INFO and continue
300 *
301  IF( info.EQ.0 )
302  $ info = k
303  kp = k
304  ELSE
305 *
306 * Test for interchange
307 *
308 * Equivalent to testing for (used to handle NaN and Inf)
309 * ABSAKK.GE.ALPHA*COLMAX
310 *
311  IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
312 *
313 * no interchange,
314 * use 1-by-1 pivot block
315 *
316  kp = k
317  ELSE
318 *
319  done = .false.
320 *
321 * Loop until pivot found
322 *
323  12 CONTINUE
324 *
325 * Begin pivot search loop body
326 *
327 * JMAX is the column-index of the largest off-diagonal
328 * element in row IMAX, and ROWMAX is its absolute value.
329 * Determine both ROWMAX and JMAX.
330 *
331  IF( imax.NE.k ) THEN
332  jmax = imax + isamax( k-imax, a( imax, imax+1 ),
333  $ lda )
334  rowmax = abs( a( imax, jmax ) )
335  ELSE
336  rowmax = zero
337  END IF
338 *
339  IF( imax.GT.1 ) THEN
340  itemp = isamax( imax-1, a( 1, imax ), 1 )
341  stemp = abs( a( itemp, imax ) )
342  IF( stemp.GT.rowmax ) THEN
343  rowmax = stemp
344  jmax = itemp
345  END IF
346  END IF
347 *
348 * Equivalent to testing for (used to handle NaN and Inf)
349 * ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX
350 *
351  IF( .NOT.( abs( a( imax, imax ) ).LT.alpha*rowmax ) )
352  $ THEN
353 *
354 * interchange rows and columns K and IMAX,
355 * use 1-by-1 pivot block
356 *
357  kp = imax
358  done = .true.
359 *
360 * Equivalent to testing for ROWMAX .EQ. COLMAX,
361 * used to handle NaN and Inf
362 *
363  ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) ) THEN
364 *
365 * interchange rows and columns K+1 and IMAX,
366 * use 2-by-2 pivot block
367 *
368  kp = imax
369  kstep = 2
370  done = .true.
371  ELSE
372 *
373 * Pivot NOT found, set variables and repeat
374 *
375  p = imax
376  colmax = rowmax
377  imax = jmax
378  END IF
379 *
380 * End pivot search loop body
381 *
382  IF( .NOT. done ) GOTO 12
383 *
384  END IF
385 *
386 * Swap TWO rows and TWO columns
387 *
388 * First swap
389 *
390  IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
391 *
392 * Interchange rows and column K and P in the leading
393 * submatrix A(1:k,1:k) if we have a 2-by-2 pivot
394 *
395  IF( p.GT.1 )
396  $ CALL sswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
397  IF( p.LT.(k-1) )
398  $ CALL sswap( k-p-1, a( p+1, k ), 1, a( p, p+1 ),
399  $ lda )
400  t = a( k, k )
401  a( k, k ) = a( p, p )
402  a( p, p ) = t
403  END IF
404 *
405 * Second swap
406 *
407  kk = k - kstep + 1
408  IF( kp.NE.kk ) THEN
409 *
410 * Interchange rows and columns KK and KP in the leading
411 * submatrix A(1:k,1:k)
412 *
413  IF( kp.GT.1 )
414  $ CALL sswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
415  IF( ( kk.GT.1 ) .AND. ( kp.LT.(kk-1) ) )
416  $ CALL sswap( kk-kp-1, a( kp+1, kk ), 1, a( kp, kp+1 ),
417  $ lda )
418  t = a( kk, kk )
419  a( kk, kk ) = a( kp, kp )
420  a( kp, kp ) = t
421  IF( kstep.EQ.2 ) THEN
422  t = a( k-1, k )
423  a( k-1, k ) = a( kp, k )
424  a( kp, k ) = t
425  END IF
426  END IF
427 *
428 * Update the leading submatrix
429 *
430  IF( kstep.EQ.1 ) THEN
431 *
432 * 1-by-1 pivot block D(k): column k now holds
433 *
434 * W(k) = U(k)*D(k)
435 *
436 * where U(k) is the k-th column of U
437 *
438  IF( k.GT.1 ) THEN
439 *
440 * Perform a rank-1 update of A(1:k-1,1:k-1) and
441 * store U(k) in column k
442 *
443  IF( abs( a( k, k ) ).GE.sfmin ) THEN
444 *
445 * Perform a rank-1 update of A(1:k-1,1:k-1) as
446 * A := A - U(k)*D(k)*U(k)**T
447 * = A - W(k)*1/D(k)*W(k)**T
448 *
449  d11 = one / a( k, k )
450  CALL ssyr( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
451 *
452 * Store U(k) in column k
453 *
454  CALL sscal( k-1, d11, a( 1, k ), 1 )
455  ELSE
456 *
457 * Store L(k) in column K
458 *
459  d11 = a( k, k )
460  DO 16 ii = 1, k - 1
461  a( ii, k ) = a( ii, k ) / d11
462  16 CONTINUE
463 *
464 * Perform a rank-1 update of A(k+1:n,k+1:n) as
465 * A := A - U(k)*D(k)*U(k)**T
466 * = A - W(k)*(1/D(k))*W(k)**T
467 * = A - (W(k)/D(k))*(D(k))*(W(k)/D(K))**T
468 *
469  CALL ssyr( uplo, k-1, -d11, a( 1, k ), 1, a, lda )
470  END IF
471  END IF
472 *
473  ELSE
474 *
475 * 2-by-2 pivot block D(k): columns k and k-1 now hold
476 *
477 * ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
478 *
479 * where U(k) and U(k-1) are the k-th and (k-1)-th columns
480 * of U
481 *
482 * Perform a rank-2 update of A(1:k-2,1:k-2) as
483 *
484 * A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
485 * = A - ( ( A(k-1)A(k) )*inv(D(k)) ) * ( A(k-1)A(k) )**T
486 *
487 * and store L(k) and L(k+1) in columns k and k+1
488 *
489  IF( k.GT.2 ) THEN
490 *
491  d12 = a( k-1, k )
492  d22 = a( k-1, k-1 ) / d12
493  d11 = a( k, k ) / d12
494  t = one / ( d11*d22-one )
495 *
496  DO 30 j = k - 2, 1, -1
497 *
498  wkm1 = t*( d11*a( j, k-1 )-a( j, k ) )
499  wk = t*( d22*a( j, k )-a( j, k-1 ) )
500 *
501  DO 20 i = j, 1, -1
502  a( i, j ) = a( i, j ) - (a( i, k ) / d12 )*wk -
503  $ ( a( i, k-1 ) / d12 )*wkm1
504  20 CONTINUE
505 *
506 * Store U(k) and U(k-1) in cols k and k-1 for row J
507 *
508  a( j, k ) = wk / d12
509  a( j, k-1 ) = wkm1 / d12
510 *
511  30 CONTINUE
512 *
513  END IF
514 *
515  END IF
516  END IF
517 *
518 * Store details of the interchanges in IPIV
519 *
520  IF( kstep.EQ.1 ) THEN
521  ipiv( k ) = kp
522  ELSE
523  ipiv( k ) = -p
524  ipiv( k-1 ) = -kp
525  END IF
526 *
527 * Decrease K and return to the start of the main loop
528 *
529  k = k - kstep
530  GO TO 10
531 *
532  ELSE
533 *
534 * Factorize A as L*D*L**T using the lower triangle of A
535 *
536 * K is the main loop index, increasing from 1 to N in steps of
537 * 1 or 2
538 *
539  k = 1
540  40 CONTINUE
541 *
542 * If K > N, exit from loop
543 *
544  IF( k.GT.n )
545  $ GO TO 70
546  kstep = 1
547  p = k
548 *
549 * Determine rows and columns to be interchanged and whether
550 * a 1-by-1 or 2-by-2 pivot block will be used
551 *
552  absakk = abs( a( k, k ) )
553 *
554 * IMAX is the row-index of the largest off-diagonal element in
555 * column K, and COLMAX is its absolute value.
556 * Determine both COLMAX and IMAX.
557 *
558  IF( k.LT.n ) THEN
559  imax = k + isamax( n-k, a( k+1, k ), 1 )
560  colmax = abs( a( imax, k ) )
561  ELSE
562  colmax = zero
563  END IF
564 *
565  IF( ( max( absakk, colmax ).EQ.zero ) ) THEN
566 *
567 * Column K is zero or underflow: set INFO and continue
568 *
569  IF( info.EQ.0 )
570  $ info = k
571  kp = k
572  ELSE
573 *
574 * Test for interchange
575 *
576 * Equivalent to testing for (used to handle NaN and Inf)
577 * ABSAKK.GE.ALPHA*COLMAX
578 *
579  IF( .NOT.( absakk.LT.alpha*colmax ) ) THEN
580 *
581 * no interchange, use 1-by-1 pivot block
582 *
583  kp = k
584  ELSE
585 *
586  done = .false.
587 *
588 * Loop until pivot found
589 *
590  42 CONTINUE
591 *
592 * Begin pivot search loop body
593 *
594 * JMAX is the column-index of the largest off-diagonal
595 * element in row IMAX, and ROWMAX is its absolute value.
596 * Determine both ROWMAX and JMAX.
597 *
598  IF( imax.NE.k ) THEN
599  jmax = k - 1 + isamax( imax-k, a( imax, k ), lda )
600  rowmax = abs( a( imax, jmax ) )
601  ELSE
602  rowmax = zero
603  END IF
604 *
605  IF( imax.LT.n ) THEN
606  itemp = imax + isamax( n-imax, a( imax+1, imax ),
607  $ 1 )
608  stemp = abs( a( itemp, imax ) )
609  IF( stemp.GT.rowmax ) THEN
610  rowmax = stemp
611  jmax = itemp
612  END IF
613  END IF
614 *
615 * Equivalent to testing for (used to handle NaN and Inf)
616 * ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX
617 *
618  IF( .NOT.( abs( a( imax, imax ) ).LT.alpha*rowmax ) )
619  $ THEN
620 *
621 * interchange rows and columns K and IMAX,
622 * use 1-by-1 pivot block
623 *
624  kp = imax
625  done = .true.
626 *
627 * Equivalent to testing for ROWMAX .EQ. COLMAX,
628 * used to handle NaN and Inf
629 *
630  ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) ) THEN
631 *
632 * interchange rows and columns K+1 and IMAX,
633 * use 2-by-2 pivot block
634 *
635  kp = imax
636  kstep = 2
637  done = .true.
638  ELSE
639 *
640 * Pivot NOT found, set variables and repeat
641 *
642  p = imax
643  colmax = rowmax
644  imax = jmax
645  END IF
646 *
647 * End pivot search loop body
648 *
649  IF( .NOT. done ) GOTO 42
650 *
651  END IF
652 *
653 * Swap TWO rows and TWO columns
654 *
655 * First swap
656 *
657  IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) ) THEN
658 *
659 * Interchange rows and column K and P in the trailing
660 * submatrix A(k:n,k:n) if we have a 2-by-2 pivot
661 *
662  IF( p.LT.n )
663  $ CALL sswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
664  IF( p.GT.(k+1) )
665  $ CALL sswap( p-k-1, a( k+1, k ), 1, a( p, k+1 ), lda )
666  t = a( k, k )
667  a( k, k ) = a( p, p )
668  a( p, p ) = t
669  END IF
670 *
671 * Second swap
672 *
673  kk = k + kstep - 1
674  IF( kp.NE.kk ) THEN
675 *
676 * Interchange rows and columns KK and KP in the trailing
677 * submatrix A(k:n,k:n)
678 *
679  IF( kp.LT.n )
680  $ CALL sswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
681  IF( ( kk.LT.n ) .AND. ( kp.GT.(kk+1) ) )
682  $ CALL sswap( kp-kk-1, a( kk+1, kk ), 1, a( kp, kk+1 ),
683  $ lda )
684  t = a( kk, kk )
685  a( kk, kk ) = a( kp, kp )
686  a( kp, kp ) = t
687  IF( kstep.EQ.2 ) THEN
688  t = a( k+1, k )
689  a( k+1, k ) = a( kp, k )
690  a( kp, k ) = t
691  END IF
692  END IF
693 *
694 * Update the trailing submatrix
695 *
696  IF( kstep.EQ.1 ) THEN
697 *
698 * 1-by-1 pivot block D(k): column k now holds
699 *
700 * W(k) = L(k)*D(k)
701 *
702 * where L(k) is the k-th column of L
703 *
704  IF( k.LT.n ) THEN
705 *
706 * Perform a rank-1 update of A(k+1:n,k+1:n) and
707 * store L(k) in column k
708 *
709  IF( abs( a( k, k ) ).GE.sfmin ) THEN
710 *
711 * Perform a rank-1 update of A(k+1:n,k+1:n) as
712 * A := A - L(k)*D(k)*L(k)**T
713 * = A - W(k)*(1/D(k))*W(k)**T
714 *
715  d11 = one / a( k, k )
716  CALL ssyr( uplo, n-k, -d11, a( k+1, k ), 1,
717  $ a( k+1, k+1 ), lda )
718 *
719 * Store L(k) in column k
720 *
721  CALL sscal( n-k, d11, a( k+1, k ), 1 )
722  ELSE
723 *
724 * Store L(k) in column k
725 *
726  d11 = a( k, k )
727  DO 46 ii = k + 1, n
728  a( ii, k ) = a( ii, k ) / d11
729  46 CONTINUE
730 *
731 * Perform a rank-1 update of A(k+1:n,k+1:n) as
732 * A := A - L(k)*D(k)*L(k)**T
733 * = A - W(k)*(1/D(k))*W(k)**T
734 * = A - (W(k)/D(k))*(D(k))*(W(k)/D(K))**T
735 *
736  CALL ssyr( uplo, n-k, -d11, a( k+1, k ), 1,
737  $ a( k+1, k+1 ), lda )
738  END IF
739  END IF
740 *
741  ELSE
742 *
743 * 2-by-2 pivot block D(k): columns k and k+1 now hold
744 *
745 * ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
746 *
747 * where L(k) and L(k+1) are the k-th and (k+1)-th columns
748 * of L
749 *
750 *
751 * Perform a rank-2 update of A(k+2:n,k+2:n) as
752 *
753 * A := A - ( L(k) L(k+1) ) * D(k) * ( L(k) L(k+1) )**T
754 * = A - ( ( A(k)A(k+1) )*inv(D(k) ) * ( A(k)A(k+1) )**T
755 *
756 * and store L(k) and L(k+1) in columns k and k+1
757 *
758  IF( k.LT.n-1 ) THEN
759 *
760  d21 = a( k+1, k )
761  d11 = a( k+1, k+1 ) / d21
762  d22 = a( k, k ) / d21
763  t = one / ( d11*d22-one )
764 *
765  DO 60 j = k + 2, n
766 *
767 * Compute D21 * ( W(k)W(k+1) ) * inv(D(k)) for row J
768 *
769  wk = t*( d11*a( j, k )-a( j, k+1 ) )
770  wkp1 = t*( d22*a( j, k+1 )-a( j, k ) )
771 *
772 * Perform a rank-2 update of A(k+2:n,k+2:n)
773 *
774  DO 50 i = j, n
775  a( i, j ) = a( i, j ) - ( a( i, k ) / d21 )*wk -
776  $ ( a( i, k+1 ) / d21 )*wkp1
777  50 CONTINUE
778 *
779 * Store L(k) and L(k+1) in cols k and k+1 for row J
780 *
781  a( j, k ) = wk / d21
782  a( j, k+1 ) = wkp1 / d21
783 *
784  60 CONTINUE
785 *
786  END IF
787 *
788  END IF
789  END IF
790 *
791 * Store details of the interchanges in IPIV
792 *
793  IF( kstep.EQ.1 ) THEN
794  ipiv( k ) = kp
795  ELSE
796  ipiv( k ) = -p
797  ipiv( k+1 ) = -kp
798  END IF
799 *
800 * Increase K and return to the start of the main loop
801 *
802  k = k + kstep
803  GO TO 40
804 *
805  END IF
806 *
807  70 CONTINUE
808 *
809  RETURN
810 *
811 * End of SSYTF2_ROOK
812 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine ssyr(UPLO, N, ALPHA, X, INCX, A, LDA)
SSYR
Definition: ssyr.f:134
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssytrd ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( * )  TAU,
real, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

SSYTRD

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

Purpose:
 SSYTRD reduces a real symmetric matrix A to real symmetric
 tridiagonal form T by an orthogonal similarity transformation:
 Q**T * A * Q = T.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          N-by-N upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading N-by-N lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.
          On exit, if UPLO = 'U', the diagonal and first superdiagonal
          of A are overwritten by the corresponding elements of the
          tridiagonal matrix T, and the elements above the first
          superdiagonal, with the array TAU, represent the orthogonal
          matrix Q as a product of elementary reflectors; if UPLO
          = 'L', the diagonal and first subdiagonal of A are over-
          written by the corresponding elements of the tridiagonal
          matrix T, and the elements below the first subdiagonal, with
          the array TAU, represent the orthogonal matrix Q as a product
          of elementary reflectors. See Further Details.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]D
          D is REAL array, dimension (N)
          The diagonal elements of the tridiagonal matrix T:
          D(i) = A(i,i).
[out]E
          E is REAL array, dimension (N-1)
          The off-diagonal elements of the tridiagonal matrix T:
          E(i) = A(i,i+1) if UPLO = 'U', E(i) = A(i+1,i) if UPLO = 'L'.
[out]TAU
          TAU is REAL array, dimension (N-1)
          The scalar factors of the elementary reflectors (see Further
          Details).
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.  LWORK >= 1.
          For optimum performance LWORK >= N*NB, where NB is the
          optimal blocksize.

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal size of the WORK array, returns
          this value as the first entry of the WORK array, and no error
          message related to LWORK is issued by XERBLA.
[out]INFO
          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 2011
Further Details:
  If UPLO = 'U', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(n-1) . . . H(2) H(1).

  Each H(i) has the form

     H(i) = I - tau * v * v**T

  where tau is a real scalar, and v is a real vector with
  v(i+1:n) = 0 and v(i) = 1; v(1:i-1) is stored on exit in
  A(1:i-1,i+1), and tau in TAU(i).

  If UPLO = 'L', the matrix Q is represented as a product of elementary
  reflectors

     Q = H(1) H(2) . . . H(n-1).

  Each H(i) has the form

     H(i) = I - tau * v * v**T

  where tau is a real scalar, and v is a real vector with
  v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in A(i+2:n,i),
  and tau in TAU(i).

  The contents of A on exit are illustrated by the following examples
  with n = 5:

  if UPLO = 'U':                       if UPLO = 'L':

    (  d   e   v2  v3  v4 )              (  d                  )
    (      d   e   v3  v4 )              (  e   d              )
    (          d   e   v4 )              (  v1  e   d          )
    (              d   e  )              (  v1  v2  e   d      )
    (                  d  )              (  v1  v2  v3  e   d  )

  where d and e denote diagonal and off-diagonal elements of T, and vi
  denotes an element of the vector defining H(i).

Definition at line 194 of file ssytrd.f.

194 *
195 * -- LAPACK computational routine (version 3.4.0) --
196 * -- LAPACK is a software package provided by Univ. of Tennessee, --
197 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
198 * November 2011
199 *
200 * .. Scalar Arguments ..
201  CHARACTER uplo
202  INTEGER info, lda, lwork, n
203 * ..
204 * .. Array Arguments ..
205  REAL a( lda, * ), d( * ), e( * ), tau( * ),
206  $ work( * )
207 * ..
208 *
209 * =====================================================================
210 *
211 * .. Parameters ..
212  REAL one
213  parameter( one = 1.0e+0 )
214 * ..
215 * .. Local Scalars ..
216  LOGICAL lquery, upper
217  INTEGER i, iinfo, iws, j, kk, ldwork, lwkopt, nb,
218  $ nbmin, nx
219 * ..
220 * .. External Subroutines ..
221  EXTERNAL slatrd, ssyr2k, ssytd2, xerbla
222 * ..
223 * .. Intrinsic Functions ..
224  INTRINSIC max
225 * ..
226 * .. External Functions ..
227  LOGICAL lsame
228  INTEGER ilaenv
229  EXTERNAL lsame, ilaenv
230 * ..
231 * .. Executable Statements ..
232 *
233 * Test the input parameters
234 *
235  info = 0
236  upper = lsame( uplo, 'U' )
237  lquery = ( lwork.EQ.-1 )
238  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
239  info = -1
240  ELSE IF( n.LT.0 ) THEN
241  info = -2
242  ELSE IF( lda.LT.max( 1, n ) ) THEN
243  info = -4
244  ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
245  info = -9
246  END IF
247 *
248  IF( info.EQ.0 ) THEN
249 *
250 * Determine the block size.
251 *
252  nb = ilaenv( 1, 'SSYTRD', uplo, n, -1, -1, -1 )
253  lwkopt = n*nb
254  work( 1 ) = lwkopt
255  END IF
256 *
257  IF( info.NE.0 ) THEN
258  CALL xerbla( 'SSYTRD', -info )
259  RETURN
260  ELSE IF( lquery ) THEN
261  RETURN
262  END IF
263 *
264 * Quick return if possible
265 *
266  IF( n.EQ.0 ) THEN
267  work( 1 ) = 1
268  RETURN
269  END IF
270 *
271  nx = n
272  iws = 1
273  IF( nb.GT.1 .AND. nb.LT.n ) THEN
274 *
275 * Determine when to cross over from blocked to unblocked code
276 * (last block is always handled by unblocked code).
277 *
278  nx = max( nb, ilaenv( 3, 'SSYTRD', uplo, n, -1, -1, -1 ) )
279  IF( nx.LT.n ) THEN
280 *
281 * Determine if workspace is large enough for blocked code.
282 *
283  ldwork = n
284  iws = ldwork*nb
285  IF( lwork.LT.iws ) THEN
286 *
287 * Not enough workspace to use optimal NB: determine the
288 * minimum value of NB, and reduce NB or force use of
289 * unblocked code by setting NX = N.
290 *
291  nb = max( lwork / ldwork, 1 )
292  nbmin = ilaenv( 2, 'SSYTRD', uplo, n, -1, -1, -1 )
293  IF( nb.LT.nbmin )
294  $ nx = n
295  END IF
296  ELSE
297  nx = n
298  END IF
299  ELSE
300  nb = 1
301  END IF
302 *
303  IF( upper ) THEN
304 *
305 * Reduce the upper triangle of A.
306 * Columns 1:kk are handled by the unblocked method.
307 *
308  kk = n - ( ( n-nx+nb-1 ) / nb )*nb
309  DO 20 i = n - nb + 1, kk + 1, -nb
310 *
311 * Reduce columns i:i+nb-1 to tridiagonal form and form the
312 * matrix W which is needed to update the unreduced part of
313 * the matrix
314 *
315  CALL slatrd( uplo, i+nb-1, nb, a, lda, e, tau, work,
316  $ ldwork )
317 *
318 * Update the unreduced submatrix A(1:i-1,1:i-1), using an
319 * update of the form: A := A - V*W**T - W*V**T
320 *
321  CALL ssyr2k( uplo, 'No transpose', i-1, nb, -one, a( 1, i ),
322  $ lda, work, ldwork, one, a, lda )
323 *
324 * Copy superdiagonal elements back into A, and diagonal
325 * elements into D
326 *
327  DO 10 j = i, i + nb - 1
328  a( j-1, j ) = e( j-1 )
329  d( j ) = a( j, j )
330  10 CONTINUE
331  20 CONTINUE
332 *
333 * Use unblocked code to reduce the last or only block
334 *
335  CALL ssytd2( uplo, kk, a, lda, d, e, tau, iinfo )
336  ELSE
337 *
338 * Reduce the lower triangle of A
339 *
340  DO 40 i = 1, n - nx, nb
341 *
342 * Reduce columns i:i+nb-1 to tridiagonal form and form the
343 * matrix W which is needed to update the unreduced part of
344 * the matrix
345 *
346  CALL slatrd( uplo, n-i+1, nb, a( i, i ), lda, e( i ),
347  $ tau( i ), work, ldwork )
348 *
349 * Update the unreduced submatrix A(i+ib:n,i+ib:n), using
350 * an update of the form: A := A - V*W**T - W*V**T
351 *
352  CALL ssyr2k( uplo, 'No transpose', n-i-nb+1, nb, -one,
353  $ a( i+nb, i ), lda, work( nb+1 ), ldwork, one,
354  $ a( i+nb, i+nb ), lda )
355 *
356 * Copy subdiagonal elements back into A, and diagonal
357 * elements into D
358 *
359  DO 30 j = i, i + nb - 1
360  a( j+1, j ) = e( j )
361  d( j ) = a( j, j )
362  30 CONTINUE
363  40 CONTINUE
364 *
365 * Use unblocked code to reduce the last or only block
366 *
367  CALL ssytd2( uplo, n-i+1, a( i, i ), lda, d( i ), e( i ),
368  $ tau( i ), iinfo )
369  END IF
370 *
371  work( 1 ) = lwkopt
372  RETURN
373 *
374 * End of SSYTRD
375 *
subroutine slatrd(UPLO, N, NB, A, LDA, E, TAU, W, LDW)
SLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal fo...
Definition: slatrd.f:200
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ssytd2(UPLO, N, A, LDA, D, E, TAU, INFO)
SSYTD2 reduces a symmetric matrix to real symmetric tridiagonal form by an orthogonal similarity tran...
Definition: ssytd2.f:175
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine ssyr2k(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYR2K
Definition: ssyr2k.f:194

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine ssytrf ( character  UPLO,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IPIV,
real, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

SSYTRF

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

Purpose:
 SSYTRF computes the factorization of a real symmetric matrix A using
 the Bunch-Kaufman diagonal pivoting method.  The form of the
 factorization is

    A = U*D*U**T  or  A = L*D*L**T

 where U (or L) is a product of permutation and unit upper (lower)
 triangular matrices, and D is symmetric and block diagonal with 
 1-by-1 and 2-by-2 diagonal blocks.

 This is the blocked version of the algorithm, calling Level 3 BLAS.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
          N-by-N upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading N-by-N lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, the block diagonal matrix D and the multipliers used
          to obtain the factor U or L (see below for further details).
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]IPIV
          IPIV is INTEGER array, dimension (N)
          Details of the interchanges and the block structure of D.
          If IPIV(k) > 0, then rows and columns k and IPIV(k) were
          interchanged and D(k,k) is a 1-by-1 diagonal block.
          If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and
          columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
          is a 2-by-2 diagonal block.  If UPLO = 'L' and IPIV(k) =
          IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were
          interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The length of WORK.  LWORK >=1.  For best performance
          LWORK >= N*NB, where NB is the block size returned by ILAENV.

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal size of the WORK array, returns
          this value as the first entry of the WORK array, and no error
          message related to LWORK is issued by XERBLA.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, D(i,i) is exactly zero.  The factorization
                has been completed, but the block diagonal matrix D is
                exactly singular, and division by zero will occur if it
                is used to solve a system of equations.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  If UPLO = 'U', then A = U*D*U**T, where
     U = P(n)*U(n)* ... *P(k)U(k)* ...,
  i.e., U is a product of terms P(k)*U(k), where k decreases from n to
  1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    v    0   )   k-s
     U(k) =  (   0    I    0   )   s
             (   0    0    I   )   n-k
                k-s   s   n-k

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
  If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
  and A(k,k), and v overwrites A(1:k-2,k-1:k).

  If UPLO = 'L', then A = L*D*L**T, where
     L = P(1)*L(1)* ... *P(k)*L(k)* ...,
  i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
  n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
  defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
  that if the diagonal block D(k) is of order s (s = 1 or 2), then

             (   I    0     0   )  k-1
     L(k) =  (   0    I     0   )  s
             (   0    v     I   )  n-k-s+1
                k-1   s  n-k-s+1

  If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
  If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
  and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).

Definition at line 184 of file ssytrf.f.

184 *
185 * -- LAPACK computational routine (version 3.4.0) --
186 * -- LAPACK is a software package provided by Univ. of Tennessee, --
187 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
188 * November 2011
189 *
190 * .. Scalar Arguments ..
191  CHARACTER uplo
192  INTEGER info, lda, lwork, n
193 * ..
194 * .. Array Arguments ..
195