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


This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.

## Functions

subroutine cla_syamv (UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CLA_SYAMV computes a matrix-vector product using a symmetric indefinite matrix to calculate error bounds. More...

real function cla_syrcond_c (UPLO, N, A, LDA, AF, LDAF, IPIV, C, CAPPLY, INFO, WORK, RWORK)
CLA_SYRCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for symmetric indefinite matrices. More...

real function cla_syrcond_x (UPLO, N, A, LDA, AF, LDAF, IPIV, X, INFO, WORK, RWORK)
CLA_SYRCOND_X computes the infinity norm condition number of op(A)*diag(x) for symmetric indefinite matrices. More...

subroutine cla_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)
CLA_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 cla_syrpvgrw (UPLO, N, INFO, A, LDA, AF, LDAF, IPIV, WORK)
CLA_SYRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric indefinite matrix. More...

subroutine clasyf (UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
CLASYF computes a partial factorization of a complex symmetric matrix using the Bunch-Kaufman diagonal pivoting method. More...

subroutine clasyf_rook (UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
CLASYF_ROOK computes a partial factorization of a complex symmetric matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method. More...

subroutine csycon (UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, INFO)
CSYCON More...

subroutine csycon_rook (UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, INFO)
CSYCON_ROOK More...

subroutine csyconv (UPLO, WAY, N, A, LDA, IPIV, E, INFO)
CSYCONV More...

subroutine csyequb (UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO)
CSYEQUB More...

subroutine csyrfs (UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, RWORK, INFO)
CSYRFS More...

subroutine csyrfsx (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, RWORK, INFO)
CSYRFSX More...

subroutine csytf2 (UPLO, N, A, LDA, IPIV, INFO)
CSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting method (unblocked algorithm). More...

subroutine csytf2_rook (UPLO, N, A, LDA, IPIV, INFO)
CSYTF2_ROOK computes the factorization of a complex symmetric indefinite matrix using the bounded Bunch-Kaufman ("rook") diagonal pivoting method (unblocked algorithm). More...

subroutine csytrf (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
CSYTRF More...

subroutine csytrf_rook (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
CSYTRF_ROOK More...

subroutine csytri (UPLO, N, A, LDA, IPIV, WORK, INFO)
CSYTRI More...

subroutine csytri2 (UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
CSYTRI2 More...

subroutine csytri2x (UPLO, N, A, LDA, IPIV, WORK, NB, INFO)
CSYTRI2X More...

subroutine csytri_rook (UPLO, N, A, LDA, IPIV, WORK, INFO)
CSYTRI_ROOK More...

subroutine csytrs (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CSYTRS More...

subroutine csytrs2 (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, INFO)
CSYTRS2 More...

subroutine csytrs_rook (UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CSYTRS_ROOK More...

subroutine ctgsyl (TRANS, IJOB, M, N, A, LDA, B, LDB, C, LDC, D, LDD, E, LDE, F, LDF, SCALE, DIF, WORK, LWORK, IWORK, INFO)
CTGSYL More...

subroutine ctrsyl (TRANA, TRANB, ISGN, M, N, A, LDA, B, LDB, C, LDC, SCALE, INFO)
CTRSYL More...

## Detailed Description

This is the group of complex computational functions for SY matrices

## Function Documentation

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

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

Purpose:
``` CLA_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 COMPLEX 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 COMPLEX 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.```
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 181 of file cla_syamv.f.

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

CLA_SYRCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for symmetric indefinite matrices.

Purpose:
```    CLA_SYRCOND_C Computes the infinity norm condition number of
op(A) * inv(diag(C)) where C is a REAL vector.```
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 COMPLEX 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 COMPLEX array, dimension (LDAF,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [in] C ``` C is REAL array, dimension (N) The vector C in the formula op(A) * inv(diag(C)).``` [in] CAPPLY ``` CAPPLY is LOGICAL If .TRUE. then access the vector C in the formula above.``` [out] INFO ``` INFO is INTEGER = 0: Successful exit. i > 0: The ith argument is invalid.``` [in] WORK ``` WORK is COMPLEX array, dimension (2*N). Workspace.``` [in] RWORK ``` RWORK is REAL array, dimension (N). Workspace.```
Date
September 2012

Definition at line 140 of file cla_syrcond_c.f.

140 *
141 * -- LAPACK computational routine (version 3.4.2) --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144 * September 2012
145 *
146 * .. Scalar Arguments ..
147  CHARACTER uplo
148  LOGICAL capply
149  INTEGER n, lda, ldaf, info
150 * ..
151 * .. Array Arguments ..
152  INTEGER ipiv( * )
153  COMPLEX a( lda, * ), af( ldaf, * ), work( * )
154  REAL c( * ), rwork( * )
155 * ..
156 *
157 * =====================================================================
158 *
159 * .. Local Scalars ..
160  INTEGER kase
161  REAL ainvnm, anorm, tmp
162  INTEGER i, j
163  LOGICAL up, upper
164  COMPLEX zdum
165 * ..
166 * .. Local Arrays ..
167  INTEGER isave( 3 )
168 * ..
169 * .. External Functions ..
170  LOGICAL lsame
171  EXTERNAL lsame
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL clacn2, csytrs, xerbla
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC abs, max
178 * ..
179 * .. Statement Functions ..
180  REAL cabs1
181 * ..
182 * .. Statement Function Definitions ..
183  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
184 * ..
185 * .. Executable Statements ..
186 *
187  cla_syrcond_c = 0.0e+0
188 *
189  info = 0
190  upper = lsame( uplo, 'U' )
191  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
192  info = -1
193  ELSE IF( n.LT.0 ) THEN
194  info = -2
195  ELSE IF( lda.LT.max( 1, n ) ) THEN
196  info = -4
197  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
198  info = -6
199  END IF
200  IF( info.NE.0 ) THEN
201  CALL xerbla( 'CLA_SYRCOND_C', -info )
202  RETURN
203  END IF
204  up = .false.
205  IF ( lsame( uplo, 'U' ) ) up = .true.
206 *
207 * Compute norm of op(A)*op2(C).
208 *
209  anorm = 0.0e+0
210  IF ( up ) THEN
211  DO i = 1, n
212  tmp = 0.0e+0
213  IF ( capply ) THEN
214  DO j = 1, i
215  tmp = tmp + cabs1( a( j, i ) ) / c( j )
216  END DO
217  DO j = i+1, n
218  tmp = tmp + cabs1( a( i, j ) ) / c( j )
219  END DO
220  ELSE
221  DO j = 1, i
222  tmp = tmp + cabs1( a( j, i ) )
223  END DO
224  DO j = i+1, n
225  tmp = tmp + cabs1( a( i, j ) )
226  END DO
227  END IF
228  rwork( i ) = tmp
229  anorm = max( anorm, tmp )
230  END DO
231  ELSE
232  DO i = 1, n
233  tmp = 0.0e+0
234  IF ( capply ) THEN
235  DO j = 1, i
236  tmp = tmp + cabs1( a( i, j ) ) / c( j )
237  END DO
238  DO j = i+1, n
239  tmp = tmp + cabs1( a( j, i ) ) / c( j )
240  END DO
241  ELSE
242  DO j = 1, i
243  tmp = tmp + cabs1( a( i, j ) )
244  END DO
245  DO j = i+1, n
246  tmp = tmp + cabs1( a( j, i ) )
247  END DO
248  END IF
249  rwork( i ) = tmp
250  anorm = max( anorm, tmp )
251  END DO
252  END IF
253 *
254 * Quick return if possible.
255 *
256  IF( n.EQ.0 ) THEN
257  cla_syrcond_c = 1.0e+0
258  RETURN
259  ELSE IF( anorm .EQ. 0.0e+0 ) THEN
260  RETURN
261  END IF
262 *
263 * Estimate the norm of inv(op(A)).
264 *
265  ainvnm = 0.0e+0
266 *
267  kase = 0
268  10 CONTINUE
269  CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
270  IF( kase.NE.0 ) THEN
271  IF( kase.EQ.2 ) THEN
272 *
273 * Multiply by R.
274 *
275  DO i = 1, n
276  work( i ) = work( i ) * rwork( i )
277  END DO
278 *
279  IF ( up ) THEN
280  CALL csytrs( 'U', n, 1, af, ldaf, ipiv,
281  \$ work, n, info )
282  ELSE
283  CALL csytrs( 'L', n, 1, af, ldaf, ipiv,
284  \$ work, n, info )
285  ENDIF
286 *
287 * Multiply by inv(C).
288 *
289  IF ( capply ) THEN
290  DO i = 1, n
291  work( i ) = work( i ) * c( i )
292  END DO
293  END IF
294  ELSE
295 *
296 * Multiply by inv(C**T).
297 *
298  IF ( capply ) THEN
299  DO i = 1, n
300  work( i ) = work( i ) * c( i )
301  END DO
302  END IF
303 *
304  IF ( up ) THEN
305  CALL csytrs( 'U', n, 1, af, ldaf, ipiv,
306  \$ work, n, info )
307  ELSE
308  CALL csytrs( 'L', n, 1, af, ldaf, ipiv,
309  \$ work, n, info )
310  END IF
311 *
312 * Multiply by R.
313 *
314  DO i = 1, n
315  work( i ) = work( i ) * rwork( i )
316  END DO
317  END IF
318  GO TO 10
319  END IF
320 *
321 * Compute the estimate of the reciprocal condition number.
322 *
323  IF( ainvnm .NE. 0.0e+0 )
324  \$ cla_syrcond_c = 1.0e+0 / ainvnm
325 *
326  RETURN
327 *
real function cla_syrcond_c(UPLO, N, A, LDA, AF, LDAF, IPIV, C, CAPPLY, INFO, WORK, RWORK)
CLA_SYRCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for symmetric indefin...
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine csytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CSYTRS
Definition: csytrs.f:122
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine clacn2(N, V, X, EST, KASE, ISAVE)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: clacn2.f:135

Here is the call graph for this function:

Here is the caller graph for this function:

 real function cla_syrcond_x ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, complex, dimension( * ) X, integer INFO, complex, dimension( * ) WORK, real, dimension( * ) RWORK )

CLA_SYRCOND_X computes the infinity norm condition number of op(A)*diag(x) for symmetric indefinite matrices.

Purpose:
```    CLA_SYRCOND_X Computes the infinity norm condition number of
op(A) * diag(X) where X is a COMPLEX vector.```
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 COMPLEX 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 COMPLEX array, dimension (LDAF,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [in] X ``` X is COMPLEX array, dimension (N) The vector X in the formula op(A) * diag(X).``` [out] INFO ``` INFO is INTEGER = 0: Successful exit. i > 0: The ith argument is invalid.``` [in] WORK ``` WORK is COMPLEX array, dimension (2*N). Workspace.``` [in] RWORK ``` RWORK is REAL array, dimension (N). Workspace.```
Date
September 2012

Definition at line 133 of file cla_syrcond_x.f.

133 *
134 * -- LAPACK computational routine (version 3.4.2) --
135 * -- LAPACK is a software package provided by Univ. of Tennessee, --
136 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137 * September 2012
138 *
139 * .. Scalar Arguments ..
140  CHARACTER uplo
141  INTEGER n, lda, ldaf, info
142 * ..
143 * .. Array Arguments ..
144  INTEGER ipiv( * )
145  COMPLEX a( lda, * ), af( ldaf, * ), work( * ), x( * )
146  REAL rwork( * )
147 * ..
148 *
149 * =====================================================================
150 *
151 * .. Local Scalars ..
152  INTEGER kase
153  REAL ainvnm, anorm, tmp
154  INTEGER i, j
155  LOGICAL up, upper
156  COMPLEX zdum
157 * ..
158 * .. Local Arrays ..
159  INTEGER isave( 3 )
160 * ..
161 * .. External Functions ..
162  LOGICAL lsame
163  EXTERNAL lsame
164 * ..
165 * .. External Subroutines ..
166  EXTERNAL clacn2, csytrs, xerbla
167 * ..
168 * .. Intrinsic Functions ..
169  INTRINSIC abs, max
170 * ..
171 * .. Statement Functions ..
172  REAL cabs1
173 * ..
174 * .. Statement Function Definitions ..
175  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
176 * ..
177 * .. Executable Statements ..
178 *
179  cla_syrcond_x = 0.0e+0
180 *
181  info = 0
182  upper = lsame( uplo, 'U' )
183  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
184  info = -1
185  ELSE IF ( n.LT.0 ) THEN
186  info = -2
187  ELSE IF( lda.LT.max( 1, n ) ) THEN
188  info = -4
189  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
190  info = -6
191  END IF
192  IF( info.NE.0 ) THEN
193  CALL xerbla( 'CLA_SYRCOND_X', -info )
194  RETURN
195  END IF
196  up = .false.
197  IF ( lsame( uplo, 'U' ) ) up = .true.
198 *
199 * Compute norm of op(A)*op2(C).
200 *
201  anorm = 0.0
202  IF ( up ) THEN
203  DO i = 1, n
204  tmp = 0.0e+0
205  DO j = 1, i
206  tmp = tmp + cabs1( a( j, i ) * x( j ) )
207  END DO
208  DO j = i+1, n
209  tmp = tmp + cabs1( a( i, j ) * x( j ) )
210  END DO
211  rwork( i ) = tmp
212  anorm = max( anorm, tmp )
213  END DO
214  ELSE
215  DO i = 1, n
216  tmp = 0.0e+0
217  DO j = 1, i
218  tmp = tmp + cabs1( a( i, j ) * x( j ) )
219  END DO
220  DO j = i+1, n
221  tmp = tmp + cabs1( a( j, i ) * x( j ) )
222  END DO
223  rwork( i ) = tmp
224  anorm = max( anorm, tmp )
225  END DO
226  END IF
227 *
228 * Quick return if possible.
229 *
230  IF( n.EQ.0 ) THEN
231  cla_syrcond_x = 1.0e+0
232  RETURN
233  ELSE IF( anorm .EQ. 0.0e+0 ) THEN
234  RETURN
235  END IF
236 *
237 * Estimate the norm of inv(op(A)).
238 *
239  ainvnm = 0.0e+0
240 *
241  kase = 0
242  10 CONTINUE
243  CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
244  IF( kase.NE.0 ) THEN
245  IF( kase.EQ.2 ) THEN
246 *
247 * Multiply by R.
248 *
249  DO i = 1, n
250  work( i ) = work( i ) * rwork( i )
251  END DO
252 *
253  IF ( up ) THEN
254  CALL csytrs( 'U', n, 1, af, ldaf, ipiv,
255  \$ work, n, info )
256  ELSE
257  CALL csytrs( 'L', n, 1, af, ldaf, ipiv,
258  \$ work, n, info )
259  ENDIF
260 *
261 * Multiply by inv(X).
262 *
263  DO i = 1, n
264  work( i ) = work( i ) / x( i )
265  END DO
266  ELSE
267 *
268 * Multiply by inv(X**T).
269 *
270  DO i = 1, n
271  work( i ) = work( i ) / x( i )
272  END DO
273 *
274  IF ( up ) THEN
275  CALL csytrs( 'U', n, 1, af, ldaf, ipiv,
276  \$ work, n, info )
277  ELSE
278  CALL csytrs( 'L', n, 1, af, ldaf, ipiv,
279  \$ work, n, info )
280  END IF
281 *
282 * Multiply by R.
283 *
284  DO i = 1, n
285  work( i ) = work( i ) * rwork( i )
286  END DO
287  END IF
288  GO TO 10
289  END IF
290 *
291 * Compute the estimate of the reciprocal condition number.
292 *
293  IF( ainvnm .NE. 0.0e+0 )
294  \$ cla_syrcond_x = 1.0e+0 / ainvnm
295 *
296  RETURN
297 *
real function cla_syrcond_x(UPLO, N, A, LDA, AF, LDAF, IPIV, X, INFO, WORK, RWORK)
CLA_SYRCOND_X computes the infinity norm condition number of op(A)*diag(x) for symmetric indefinite m...
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine csytrs(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CSYTRS
Definition: csytrs.f:122
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine clacn2(N, V, X, EST, KASE, ISAVE)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: clacn2.f:135

Here is the call graph for this function:

Here is the caller graph for this function:

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

CLA_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.

Purpose:
``` CLA_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 CSYRFSX 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 COMPLEX 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 COMPLEX array, dimension (LDAF,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [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 COMPLEX 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 COMPLEX array, dimension (LDY,NRHS) On entry, the solution matrix X, as computed by CSYTRS. 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 CLA_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 COMPLEX array, dimension (N) Workspace to hold the intermediate residual.``` [in] AYB ``` AYB is REAL array, dimension (N) Workspace.``` [in] DY ``` DY is COMPLEX array, dimension (N) Workspace to hold the intermediate solution.``` [in] Y_TAIL ``` Y_TAIL is COMPLEX 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 CLA_SYRFSX_EXTENDED had an illegal value```
Date
September 2012

Definition at line 400 of file cla_syrfsx_extended.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Purpose:
``` CLA_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 CSYTRF, .i.e., the pivot in column INFO is exactly 0.``` [in] A ``` A is COMPLEX 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 COMPLEX array, dimension (LDAF,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [in] WORK ` WORK is REAL array, dimension (2*N)`
Date
November 2015

Definition at line 125 of file cla_syrpvgrw.f.

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

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

Purpose:
``` CLASYF computes a partial factorization of a complex 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.
Note that U**T denotes the transpose of U.

CLASYF is an auxiliary routine called by CSYTRF. 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 COMPLEX 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 COMPLEX 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.```
Date
November 2013
Contributors:
```  November 2013,  Igor Kozachenko,
Computer Science Division,
University of California, Berkeley```

Definition at line 179 of file clasyf.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Purpose:
``` CLASYF_ROOK computes a partial factorization of a complex 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.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYCON

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

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 COMPLEX array, dimension (LDA,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [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 COMPLEX array, dimension (2*N)` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value```
Date
November 2011

Definition at line 127 of file csycon.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYCON_ROOK

Purpose:
``` CSYCON_ROOK estimates the reciprocal of the condition number (in the
1-norm) of a complex symmetric matrix A using the factorization
A = U*D*U**T or A = L*D*L**T computed by CSYTRF_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 COMPLEX array, dimension (LDA,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF_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 CSYTRF_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 COMPLEX array, dimension (2*N)` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value```
Date
April 2012
Contributors:

April 2012, 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 141 of file csycon_rook.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYCONV

Purpose:
``` CSYCONV 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 COMPLEX array, dimension (LDA,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF.``` [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 CSYTRF.``` [out] E ``` E is COMPLEX 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```
Date
November 2015

Definition at line 116 of file csyconv.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  COMPLEX a( lda, * ), e( * )
129 * ..
130 *
131 * =====================================================================
132 *
133 * .. Parameters ..
134  COMPLEX zero
135  parameter( zero = (0.0e+0,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  COMPLEX 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( 'CSYCONV', -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 CSYCONV
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 csyequb ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, real, dimension( * ) S, real SCOND, real AMAX, complex, dimension( * ) WORK, integer INFO )

CSYEQUB

Purpose:
``` CSYEQUB 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 COMPLEX 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 COMPLEX 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.```
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

Definition at line 138 of file csyequb.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYRFS

Purpose:
``` CSYRFS 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 COMPLEX 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 COMPLEX 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 CSYTRF.``` [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 CSYTRF.``` [in] B ``` B is COMPLEX 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 COMPLEX array, dimension (LDX,NRHS) On entry, the solution matrix X, as computed by CSYTRS. 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 COMPLEX array, dimension (2*N)` [out] RWORK ` RWORK is REAL 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.`
Date
November 2011

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

Here is the call graph for this function:

Here is the caller graph for this function:

 subroutine csyrfsx ( character UPLO, character EQUED, integer N, integer NRHS, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, real, dimension( * ) S, complex, dimension( ldb, * ) B, integer LDB, complex, 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, complex, dimension( * ) WORK, real, dimension( * ) RWORK, integer INFO )

CSYRFSX

Purpose:
```    CSYRFSX 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 COMPLEX 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 COMPLEX 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 COMPLEX 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 COMPLEX 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 COMPLEX array, dimension (2*N)` [out] RWORK ` RWORK is REAL array, dimension (2*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.```
Date
April 2012

Definition at line 404 of file csyrfsx.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( * )
418  COMPLEX a( lda, * ), af( ldaf, * ), b( ldb, * ),
419  \$ x( ldx, * ), work( * )
420  REAL s( * ), params( * ), berr( * ), rwork( * ),
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
452  INTEGER n_norms
453  REAL anorm, rcond_tmp
454  REAL illrcond_thresh, err_lbnd, cwise_wrong
455  LOGICAL ignore_cwise
456  INTEGER ithresh
457  REAL rthresh, unstable_thresh
458 * ..
459 * .. External Subroutines ..
461 * ..
462 * .. Intrinsic Functions ..
463  INTRINSIC max, sqrt, transfer
464 * ..
465 * .. External Functions ..
466  EXTERNAL lsame, blas_fpinfo_x, ilatrans, ilaprec
469  LOGICAL lsame
470  INTEGER blas_fpinfo_x
471  INTEGER ilatrans, ilaprec
472 * ..
473 * .. Executable Statements ..
474 *
475 * Check the input parameters.
476 *
477  info = 0
478  ref_type = int( itref_default )
479  IF ( nparams .GE. la_linrx_itref_i ) THEN
480  IF ( params( la_linrx_itref_i ) .LT. 0.0 ) THEN
481  params( la_linrx_itref_i ) = itref_default
482  ELSE
483  ref_type = params( la_linrx_itref_i )
484  END IF
485  END IF
486 *
487 * Set default parameters.
488 *
489  illrcond_thresh = REAL( N ) * slamch( 'Epsilon' )
490  ithresh = int( ithresh_default )
491  rthresh = rthresh_default
492  unstable_thresh = dzthresh_default
493  ignore_cwise = componentwise_default .EQ. 0.0
494 *
495  IF ( nparams.GE.la_linrx_ithresh_i ) THEN
496  IF ( params( la_linrx_ithresh_i ).LT.0.0 ) THEN
497  params( la_linrx_ithresh_i ) = ithresh
498  ELSE
499  ithresh = int( params( la_linrx_ithresh_i ) )
500  END IF
501  END IF
502  IF ( nparams.GE.la_linrx_cwise_i ) THEN
503  IF ( params( la_linrx_cwise_i ).LT.0.0 ) THEN
504  IF ( ignore_cwise ) THEN
505  params( la_linrx_cwise_i ) = 0.0
506  ELSE
507  params( la_linrx_cwise_i ) = 1.0
508  END IF
509  ELSE
510  ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0
511  END IF
512  END IF
513  IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 ) THEN
514  n_norms = 0
515  ELSE IF ( ignore_cwise ) THEN
516  n_norms = 1
517  ELSE
518  n_norms = 2
519  END IF
520 *
521  rcequ = lsame( equed, 'Y' )
522 *
523 * Test input parameters.
524 *
525  IF ( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
526  info = -1
527  ELSE IF( .NOT.rcequ .AND. .NOT.lsame( equed, 'N' ) ) THEN
528  info = -2
529  ELSE IF( n.LT.0 ) THEN
530  info = -3
531  ELSE IF( nrhs.LT.0 ) THEN
532  info = -4
533  ELSE IF( lda.LT.max( 1, n ) ) THEN
534  info = -6
535  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
536  info = -8
537  ELSE IF( ldb.LT.max( 1, n ) ) THEN
538  info = -12
539  ELSE IF( ldx.LT.max( 1, n ) ) THEN
540  info = -14
541  END IF
542  IF( info.NE.0 ) THEN
543  CALL xerbla( 'CSYRFSX', -info )
544  RETURN
545  END IF
546 *
547 * Quick return if possible.
548 *
549  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
550  rcond = 1.0
551  DO j = 1, nrhs
552  berr( j ) = 0.0
553  IF ( n_err_bnds .GE. 1 ) THEN
554  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
555  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
556  END IF
557  IF ( n_err_bnds .GE. 2 ) THEN
558  err_bnds_norm( j, la_linrx_err_i ) = 0.0
559  err_bnds_comp( j, la_linrx_err_i ) = 0.0
560  END IF
561  IF ( n_err_bnds .GE. 3 ) THEN
562  err_bnds_norm( j, la_linrx_rcond_i ) = 1.0
563  err_bnds_comp( j, la_linrx_rcond_i ) = 1.0
564  END IF
565  END DO
566  RETURN
567  END IF
568 *
569 * Default to failure.
570 *
571  rcond = 0.0
572  DO j = 1, nrhs
573  berr( j ) = 1.0
574  IF ( n_err_bnds .GE. 1 ) THEN
575  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
576  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
577  END IF
578  IF ( n_err_bnds .GE. 2 ) THEN
579  err_bnds_norm( j, la_linrx_err_i ) = 1.0
580  err_bnds_comp( j, la_linrx_err_i ) = 1.0
581  END IF
582  IF ( n_err_bnds .GE. 3 ) THEN
583  err_bnds_norm( j, la_linrx_rcond_i ) = 0.0
584  err_bnds_comp( j, la_linrx_rcond_i ) = 0.0
585  END IF
586  END DO
587 *
588 * Compute the norm of A and the reciprocal of the condition
589 * number of A.
590 *
591  norm = 'I'
592  anorm = clansy( norm, uplo, n, a, lda, rwork )
593  CALL csycon( uplo, n, af, ldaf, ipiv, anorm, rcond, work,
594  \$ info )
595 *
596 * Perform refinement on each right-hand side
597 *
598  IF ( ref_type .NE. 0 ) THEN
599
600  prec_type = ilaprec( 'D' )
601
602  CALL cla_syrfsx_extended( prec_type, uplo, n,
603  \$ nrhs, a, lda, af, ldaf, ipiv, rcequ, s, b,
604  \$ ldb, x, ldx, berr, n_norms, err_bnds_norm, err_bnds_comp,
605  \$ work, rwork, work(n+1),
606  \$ transfer(rwork(1:2*n), (/ (zero, zero) /), n), rcond,
607  \$ ithresh, rthresh, unstable_thresh, ignore_cwise,
608  \$ info )
609  END IF
610
611  err_lbnd = max( 10.0, sqrt( REAL( N ) ) ) * slamch( 'Epsilon' )
612  IF (n_err_bnds .GE. 1 .AND. n_norms .GE. 1) THEN
613 *
614 * Compute scaled normwise condition number cond(A*C).
615 *
616  IF ( rcequ ) THEN
617  rcond_tmp = cla_syrcond_c( uplo, n, a, lda, af, ldaf, ipiv,
618  \$ s, .true., info, work, rwork )
619  ELSE
620  rcond_tmp = cla_syrcond_c( uplo, n, a, lda, af, ldaf, ipiv,
621  \$ s, .false., info, work, rwork )
622  END IF
623  DO j = 1, nrhs
624 *
625 * Cap the error at 1.0.
626 *
627  IF ( n_err_bnds .GE. la_linrx_err_i
628  \$ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0 )
629  \$ err_bnds_norm( j, la_linrx_err_i ) = 1.0
630 *
631 * Threshold the error (see LAWN).
632 *
633  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
634  err_bnds_norm( j, la_linrx_err_i ) = 1.0
635  err_bnds_norm( j, la_linrx_trust_i ) = 0.0
636  IF ( info .LE. n ) info = n + j
637  ELSE IF ( err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd )
638  \$ THEN
639  err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
640  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
641  END IF
642 *
643 * Save the condition number.
644 *
645  IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
646  err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
647  END IF
648  END DO
649  END IF
650
651  IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 2 ) THEN
652 *
653 * Compute componentwise condition number cond(A*diag(Y(:,J))) for
654 * each right-hand side using the current solution as an estimate of
655 * the true solution. If the componentwise error estimate is too
656 * large, then the solution is a lousy estimate of truth and the
657 * estimated RCOND may be too optimistic. To avoid misleading users,
658 * the inverse condition number is set to 0.0 when the estimated
659 * cwise error is at least CWISE_WRONG.
660 *
661  cwise_wrong = sqrt( slamch( 'Epsilon' ) )
662  DO j = 1, nrhs
663  IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
664  \$ THEN
665  rcond_tmp = cla_syrcond_x( uplo, n, a, lda, af, ldaf,
666  \$ ipiv, x(1,j), info, work, rwork )
667  ELSE
668  rcond_tmp = 0.0
669  END IF
670 *
671 * Cap the error at 1.0.
672 *
673  IF ( n_err_bnds .GE. la_linrx_err_i
674  \$ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0 )
675  \$ err_bnds_comp( j, la_linrx_err_i ) = 1.0
676
677 *
678 * Threshold the error (see LAWN).
679 *
680  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
681  err_bnds_comp( j, la_linrx_err_i ) = 1.0
682  err_bnds_comp( j, la_linrx_trust_i ) = 0.0
683  IF ( .NOT. ignore_cwise
684  \$ .AND. info.LT.n + j ) info = n + j
685  ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
686  \$ .LT. err_lbnd ) THEN
687  err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
688  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
689  END IF
690 *
691 * Save the condition number.
692 *
693  IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
694  err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp
695  END IF
696
697  END DO
698  END IF
699 *
700  RETURN
701 *
702 * End of CSYRFSX
703 *
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:60
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
real function cla_syrcond_x(UPLO, N, A, LDA, AF, LDAF, IPIV, X, INFO, WORK, RWORK)
CLA_SYRCOND_X computes the infinity norm condition number of op(A)*diag(x) for symmetric indefinite m...
real function cla_syrcond_c(UPLO, N, A, LDA, AF, LDAF, IPIV, C, CAPPLY, INFO, WORK, RWORK)
CLA_SYRCOND_C computes the infinity norm condition number of op(A)*inv(diag(c)) for symmetric indefin...
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine cla_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)
CLA_SYRFSX_EXTENDED improves the computed solution to a system of linear equations for symmetric inde...
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaprec(PREC)
ILAPREC
Definition: ilaprec.f:60
subroutine csycon(UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, INFO)
CSYCON
Definition: csycon.f:127
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.
Definition: clansy.f:125

Here is the call graph for this function:

Here is the caller graph for this function:

 subroutine csytf2 ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO )

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

Purpose:
``` CSYTF2 computes the factorization of a complex 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 COMPLEX 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.```
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.209 and l.377
IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
by
IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. SISNAN(ABSAKK) ) THEN

1-96 - Based on modifications by J. Lewis, Boeing Computer Services
Company```

Definition at line 193 of file csytf2.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

 subroutine csytf2_rook ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO )

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYTRF

Purpose:
``` CSYTRF computes the factorization of a complex 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
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 COMPLEX 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 COMPLEX 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.```
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 csytrf.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  INTEGER ipiv( * )
196  COMPLEX a( lda, * ), work( * )
197 * ..
198 *
199 * =====================================================================
200 *
201 * .. Local Scalars ..
202  LOGICAL lquery, upper
203  INTEGER iinfo, iws, j, k, kb, ldwork, lwkopt, nb, nbmin
204 * ..
205 * .. External Functions ..
206  LOGICAL lsame
207  INTEGER ilaenv
208  EXTERNAL lsame, ilaenv
209 * ..
210 * .. External Subroutines ..
211  EXTERNAL clasyf, csytf2, xerbla
212 * ..
213 * .. Intrinsic Functions ..
214  INTRINSIC max
215 * ..
216 * .. Executable Statements ..
217 *
218 * Test the input parameters.
219 *
220  info = 0
221  upper = lsame( uplo, 'U' )
222  lquery = ( lwork.EQ.-1 )
223  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
224  info = -1
225  ELSE IF( n.LT.0 ) THEN
226  info = -2
227  ELSE IF( lda.LT.max( 1, n ) ) THEN
228  info = -4
229  ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
230  info = -7
231  END IF
232 *
233  IF( info.EQ.0 ) THEN
234 *
235 * Determine the block size
236 *
237  nb = ilaenv( 1, 'CSYTRF', uplo, n, -1, -1, -1 )
238  lwkopt = n*nb
239  work( 1 ) = lwkopt
240  END IF
241 *
242  IF( info.NE.0 ) THEN
243  CALL xerbla( 'CSYTRF', -info )
244  RETURN
245  ELSE IF( lquery ) THEN
246  RETURN
247  END IF
248 *
249  nbmin = 2
250  ldwork = n
251  IF( nb.GT.1 .AND. nb.LT.n ) THEN
252  iws = ldwork*nb
253  IF( lwork.LT.iws ) THEN
254  nb = max( lwork / ldwork, 1 )
255  nbmin = max( 2, ilaenv( 2, 'CSYTRF', uplo, n, -1, -1, -1 ) )
256  END IF
257  ELSE
258  iws = 1
259  END IF
260  IF( nb.LT.nbmin )
261  \$ nb = n
262 *
263  IF( upper ) THEN
264 *
265 * Factorize A as U*D*U**T using the upper triangle of A
266 *
267 * K is the main loop index, decreasing from N to 1 in steps of
268 * KB, where KB is the number of columns factorized by CLASYF;
269 * KB is either NB or NB-1, or K for the last block
270 *
271  k = n
272  10 CONTINUE
273 *
274 * If K < 1, exit from loop
275 *
276  IF( k.LT.1 )
277  \$ GO TO 40
278 *
279  IF( k.GT.nb ) THEN
280 *
281 * Factorize columns k-kb+1:k of A and use blocked code to
282 * update columns 1:k-kb
283 *
284  CALL clasyf( uplo, k, nb, kb, a, lda, ipiv, work, n, iinfo )
285  ELSE
286 *
287 * Use unblocked code to factorize columns 1:k of A
288 *
289  CALL csytf2( uplo, k, a, lda, ipiv, iinfo )
290  kb = k
291  END IF
292 *
293 * Set INFO on the first occurrence of a zero pivot
294 *
295  IF( info.EQ.0 .AND. iinfo.GT.0 )
296  \$ info = iinfo
297 *
298 * Decrease K and return to the start of the main loop
299 *
300  k = k - kb
301  GO TO 10
302 *
303  ELSE
304 *
305 * Factorize A as L*D*L**T using the lower triangle of A
306 *
307 * K is the main loop index, increasing from 1 to N in steps of
308 * KB, where KB is the number of columns factorized by CLASYF;
309 * KB is either NB or NB-1, or N-K+1 for the last block
310 *
311  k = 1
312  20 CONTINUE
313 *
314 * If K > N, exit from loop
315 *
316  IF( k.GT.n )
317  \$ GO TO 40
318 *
319  IF( k.LE.n-nb ) THEN
320 *
321 * Factorize columns k:k+kb-1 of A and use blocked code to
322 * update columns k+kb:n
323 *
324  CALL clasyf( uplo, n-k+1, nb, kb, a( k, k ), lda, ipiv( k ),
325  \$ work, n, iinfo )
326  ELSE
327 *
328 * Use unblocked code to factorize columns k:n of A
329 *
330  CALL csytf2( uplo, n-k+1, a( k, k ), lda, ipiv( k ), iinfo )
331  kb = n - k + 1
332  END IF
333 *
334 * Set INFO on the first occurrence of a zero pivot
335 *
336  IF( info.EQ.0 .AND. iinfo.GT.0 )
337  \$ info = iinfo + k - 1
338 *
340 *
341  DO 30 j = k, k + kb - 1
342  IF( ipiv( j ).GT.0 ) THEN
343  ipiv( j ) = ipiv( j ) + k - 1
344  ELSE
345  ipiv( j ) = ipiv( j ) - k + 1
346  END IF
347  30 CONTINUE
348 *
349 * Increase K and return to the start of the main loop
350 *
351  k = k + kb
352  GO TO 20
353 *
354  END IF
355 *
356  40 CONTINUE
357  work( 1 ) = lwkopt
358  RETURN
359 *
360 * End of CSYTRF
361 *
subroutine clasyf(UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
CLASYF computes a partial factorization of a complex symmetric matrix using the Bunch-Kaufman diagona...
Definition: clasyf.f:179
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
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 csytf2(UPLO, N, A, LDA, IPIV, INFO)
CSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting ...
Definition: csytf2.f:193

Here is the call graph for this function:

Here is the caller graph for this function:

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

CSYTRF_ROOK

Purpose:
``` CSYTRF_ROOK computes the factorization of a complex symmetric matrix A
using the bounded Bunch-Kaufman ("rook") 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 COMPLEX 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] WORK ``` WORK is COMPLEX 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.```
Date
November 2015
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 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 210 of file csytrf_rook.f.

210 *
211 * -- LAPACK computational routine (version 3.6.0) --
212 * -- LAPACK is a software package provided by Univ. of Tennessee, --
213 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
214 * November 2015
215 *
216 * .. Scalar Arguments ..
217  CHARACTER uplo
218  INTEGER info, lda, lwork, n
219 * ..
220 * .. Array Arguments ..
221  INTEGER ipiv( * )
222  COMPLEX a( lda, * ), work( * )
223 * ..
224 *
225 * =====================================================================
226 *
227 * .. Local Scalars ..
228  LOGICAL lquery, upper
229  INTEGER iinfo, iws, j, k, kb, ldwork, lwkopt, nb, nbmin
230 * ..
231 * .. External Functions ..
232  LOGICAL lsame
233  INTEGER ilaenv
234  EXTERNAL lsame, ilaenv
235 * ..
236 * .. External Subroutines ..
237  EXTERNAL clasyf_rook, csytf2_rook, xerbla
238 * ..
239 * .. Intrinsic Functions ..
240  INTRINSIC max
241 * ..
242 * .. Executable Statements ..
243 *
244 * Test the input parameters.
245 *
246  info = 0
247  upper = lsame( uplo, 'U' )
248  lquery = ( lwork.EQ.-1 )
249  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
250  info = -1
251  ELSE IF( n.LT.0 ) THEN
252  info = -2
253  ELSE IF( lda.LT.max( 1, n ) ) THEN
254  info = -4
255  ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
256  info = -7
257  END IF
258 *
259  IF( info.EQ.0 ) THEN
260 *
261 * Determine the block size
262 *
263  nb = ilaenv( 1, 'CSYTRF_ROOK', uplo, n, -1, -1, -1 )
264  lwkopt = n*nb
265  work( 1 ) = lwkopt
266  END IF
267 *
268  IF( info.NE.0 ) THEN
269  CALL xerbla( 'CSYTRF_ROOK', -info )
270  RETURN
271  ELSE IF( lquery ) THEN
272  RETURN
273  END IF
274 *
275  nbmin = 2
276  ldwork = n
277  IF( nb.GT.1 .AND. nb.LT.n ) THEN
278  iws = ldwork*nb
279  IF( lwork.LT.iws ) THEN
280  nb = max( lwork / ldwork, 1 )
281  nbmin = max( 2, ilaenv( 2, 'CSYTRF_ROOK',
282  \$ uplo, n, -1, -1, -1 ) )
283  END IF
284  ELSE
285  iws = 1
286  END IF
287  IF( nb.LT.nbmin )
288  \$ nb = n
289 *
290  IF( upper ) THEN
291 *
292 * Factorize A as U*D*U**T using the upper triangle of A
293 *
294 * K is the main loop index, decreasing from N to 1 in steps of
295 * KB, where KB is the number of columns factorized by CLASYF_ROOK;
296 * KB is either NB or NB-1, or K for the last block
297 *
298  k = n
299  10 CONTINUE
300 *
301 * If K < 1, exit from loop
302 *
303  IF( k.LT.1 )
304  \$ GO TO 40
305 *
306  IF( k.GT.nb ) THEN
307 *
308 * Factorize columns k-kb+1:k of A and use blocked code to
309 * update columns 1:k-kb
310 *
311  CALL clasyf_rook( uplo, k, nb, kb, a, lda,
312  \$ ipiv, work, ldwork, iinfo )
313  ELSE
314 *
315 * Use unblocked code to factorize columns 1:k of A
316 *
317  CALL csytf2_rook( uplo, k, a, lda, ipiv, iinfo )
318  kb = k
319  END IF
320 *
321 * Set INFO on the first occurrence of a zero pivot
322 *
323  IF( info.EQ.0 .AND. iinfo.GT.0 )
324  \$ info = iinfo
325 *
326 * No need to adjust IPIV
327 *
328 * Decrease K and return to the start of the main loop
329 *
330  k = k - kb
331  GO TO 10
332 *
333  ELSE
334 *
335 * Factorize A as L*D*L**T using the lower triangle of A
336 *
337 * K is the main loop index, increasing from 1 to N in steps of
338 * KB, where KB is the number of columns factorized by CLASYF_ROOK;
339 * KB is either NB or NB-1, or N-K+1 for the last block
340 *
341  k = 1
342  20 CONTINUE
343 *
344 * If K > N, exit from loop
345 *
346  IF( k.GT.n )
347  \$ GO TO 40
348 *
349  IF( k.LE.n-nb ) THEN
350 *
351 * Factorize columns k:k+kb-1 of A and use blocked code to
352 * update columns k+kb:n
353 *
354  CALL clasyf_rook( uplo, n-k+1, nb, kb, a( k, k ), lda,
355  \$ ipiv( k ), work, ldwork, iinfo )
356  ELSE
357 *
358 * Use unblocked code to factorize columns k:n of A
359 *
360  CALL csytf2_rook( uplo, n-k+1, a( k, k ), lda, ipiv( k ),
361  \$ iinfo )
362  kb = n - k + 1
363  END IF
364 *
365 * Set INFO on the first occurrence of a zero pivot
366 *
367  IF( info.EQ.0 .AND. iinfo.GT.0 )
368  \$ info = iinfo + k - 1
369 *
371 *
372  DO 30 j = k, k + kb - 1
373  IF( ipiv( j ).GT.0 ) THEN
374  ipiv( j ) = ipiv( j ) + k - 1
375  ELSE
376  ipiv( j ) = ipiv( j ) - k + 1
377  END IF
378  30 CONTINUE
379 *
380 * Increase K and return to the start of the main loop
381 *
382  k = k + kb
383  GO TO 20
384 *
385  END IF
386 *
387  40 CONTINUE
388  work( 1 ) = lwkopt
389  RETURN
390 *
391 * End of CSYTRF_ROOK
392 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine csytf2_rook(UPLO, N, A, LDA, IPIV, INFO)
CSYTF2_ROOK computes the factorization of a complex symmetric indefinite matrix using the bounded Bun...
Definition: csytf2_rook.f:196
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine clasyf_rook(UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO)
CLASYF_ROOK computes a partial factorization of a complex symmetric matrix using the bounded Bunch-Ka...
Definition: clasyf_rook.f:186
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83

Here is the call graph for this function:

Here is the caller graph for this function:

 subroutine csytri ( character UPLO, integer N, complex, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, complex, dimension( * ) WORK, integer INFO )

CSYTRI

Purpose:
``` CSYTRI computes the inverse of a complex symmetric indefinite matrix
A using the factorization A = U*D*U**T or A = L*D*L**T computed by
CSYTRF.```
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,out] A ``` A is COMPLEX array, dimension (LDA,N) On entry, the block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF. On exit, if INFO = 0, the (symmetric) inverse of the original matrix. If UPLO = 'U', the upper triangular part of the inverse is formed and the part of A below the diagonal is not referenced; if UPLO = 'L' the lower triangular part of the inverse is formed and the part of A above the diagonal is not referenced.``` [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 CSYTRF.``` [out] WORK ` WORK is COMPLEX array, dimension (2*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, D(i,i) = 0; the matrix is singular and its inverse could not be computed.```
Date
November 2011

Definition at line 116 of file csytri.f.

116 *
117 * -- LAPACK computational routine (version 3.4.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 2011
121 *
122 * .. Scalar Arguments ..
123  CHARACTER uplo
124  INTEGER info, lda, n
125 * ..
126 * .. Array Arguments ..
127  INTEGER ipiv( * )
128  COMPLEX a( lda, * ), work( * )
129 * ..
130 *
131 * =====================================================================
132 *
133 * .. Parameters ..
134  COMPLEX one, zero
135  parameter( one = ( 1.0e+0, 0.0e+0 ),
136  \$ zero = ( 0.0e+0, 0.0e+0 ) )
137 * ..
138 * .. Local Scalars ..
139  LOGICAL upper
140  INTEGER k, kp, kstep
141  COMPLEX ak, akkp1, akp1, d, t, temp
142 * ..
143 * .. External Functions ..
144  LOGICAL lsame
145  COMPLEX cdotu
146  EXTERNAL lsame, cdotu
147 * ..
148 * .. External Subroutines ..
149  EXTERNAL ccopy, cswap, csymv, xerbla
150 * ..
151 * .. Intrinsic Functions ..
152  INTRINSIC abs, max
153 * ..
154 * .. Executable Statements ..
155 *
156 * Test the input parameters.
157 *
158  info = 0
159  upper = lsame( uplo, 'U' )
160  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
161  info = -1
162  ELSE IF( n.LT.0 ) THEN
163  info = -2
164  ELSE IF( lda.LT.max( 1, n ) ) THEN
165  info = -4
166  END IF
167  IF( info.NE.0 ) THEN
168  CALL xerbla( 'CSYTRI', -info )
169  RETURN
170  END IF
171 *
172 * Quick return if possible
173 *
174  IF( n.EQ.0 )
175  \$ RETURN
176 *
177 * Check that the diagonal matrix D is nonsingular.
178 *
179  IF( upper ) THEN
180 *
181 * Upper triangular storage: examine D from bottom to top
182 *
183  DO 10 info = n, 1, -1
184  IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
185  \$ RETURN
186  10 CONTINUE
187  ELSE
188 *
189 * Lower triangular storage: examine D from top to bottom.
190 *
191  DO 20 info = 1, n
192  IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
193  \$ RETURN
194  20 CONTINUE
195  END IF
196  info = 0
197 *
198  IF( upper ) THEN
199 *
200 * Compute inv(A) from the factorization A = U*D*U**T.
201 *
202 * K is the main loop index, increasing from 1 to N in steps of
203 * 1 or 2, depending on the size of the diagonal blocks.
204 *
205  k = 1
206  30 CONTINUE
207 *
208 * If K > N, exit from loop.
209 *
210  IF( k.GT.n )
211  \$ GO TO 40
212 *
213  IF( ipiv( k ).GT.0 ) THEN
214 *
215 * 1 x 1 diagonal block
216 *
217 * Invert the diagonal block.
218 *
219  a( k, k ) = one / a( k, k )
220 *
221 * Compute column K of the inverse.
222 *
223  IF( k.GT.1 ) THEN
224  CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
225  CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
226  \$ a( 1, k ), 1 )
227  a( k, k ) = a( k, k ) - cdotu( k-1, work, 1, a( 1, k ),
228  \$ 1 )
229  END IF
230  kstep = 1
231  ELSE
232 *
233 * 2 x 2 diagonal block
234 *
235 * Invert the diagonal block.
236 *
237  t = a( k, k+1 )
238  ak = a( k, k ) / t
239  akp1 = a( k+1, k+1 ) / t
240  akkp1 = a( k, k+1 ) / t
241  d = t*( ak*akp1-one )
242  a( k, k ) = akp1 / d
243  a( k+1, k+1 ) = ak / d
244  a( k, k+1 ) = -akkp1 / d
245 *
246 * Compute columns K and K+1 of the inverse.
247 *
248  IF( k.GT.1 ) THEN
249  CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
250  CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
251  \$ a( 1, k ), 1 )
252  a( k, k ) = a( k, k ) - cdotu( k-1, work, 1, a( 1, k ),
253  \$ 1 )
254  a( k, k+1 ) = a( k, k+1 ) -
255  \$ cdotu( k-1, a( 1, k ), 1, a( 1, k+1 ), 1 )
256  CALL ccopy( k-1, a( 1, k+1 ), 1, work, 1 )
257  CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
258  \$ a( 1, k+1 ), 1 )
259  a( k+1, k+1 ) = a( k+1, k+1 ) -
260  \$ cdotu( k-1, work, 1, a( 1, k+1 ), 1 )
261  END IF
262  kstep = 2
263  END IF
264 *
265  kp = abs( ipiv( k ) )
266  IF( kp.NE.k ) THEN
267 *
268 * Interchange rows and columns K and KP in the leading
269 * submatrix A(1:k+1,1:k+1)
270 *
271  CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
272  CALL cswap( k-kp-1, a( kp+1, k ), 1, a( kp, kp+1 ), lda )
273  temp = a( k, k )
274  a( k, k ) = a( kp, kp )
275  a( kp, kp ) = temp
276  IF( kstep.EQ.2 ) THEN
277  temp = a( k, k+1 )
278  a( k, k+1 ) = a( kp, k+1 )
279  a( kp, k+1 ) = temp
280  END IF
281  END IF
282 *
283  k = k + kstep
284  GO TO 30
285  40 CONTINUE
286 *
287  ELSE
288 *
289 * Compute inv(A) from the factorization A = L*D*L**T.
290 *
291 * K is the main loop index, increasing from 1 to N in steps of
292 * 1 or 2, depending on the size of the diagonal blocks.
293 *
294  k = n
295  50 CONTINUE
296 *
297 * If K < 1, exit from loop.
298 *
299  IF( k.LT.1 )
300  \$ GO TO 60
301 *
302  IF( ipiv( k ).GT.0 ) THEN
303 *
304 * 1 x 1 diagonal block
305 *
306 * Invert the diagonal block.
307 *
308  a( k, k ) = one / a( k, k )
309 *
310 * Compute column K of the inverse.
311 *
312  IF( k.LT.n ) THEN
313  CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
314  CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work, 1,
315  \$ zero, a( k+1, k ), 1 )
316  a( k, k ) = a( k, k ) - cdotu( n-k, work, 1, a( k+1, k ),
317  \$ 1 )
318  END IF
319  kstep = 1
320  ELSE
321 *
322 * 2 x 2 diagonal block
323 *
324 * Invert the diagonal block.
325 *
326  t = a( k, k-1 )
327  ak = a( k-1, k-1 ) / t
328  akp1 = a( k, k ) / t
329  akkp1 = a( k, k-1 ) / t
330  d = t*( ak*akp1-one )
331  a( k-1, k-1 ) = akp1 / d
332  a( k, k ) = ak / d
333  a( k, k-1 ) = -akkp1 / d
334 *
335 * Compute columns K-1 and K of the inverse.
336 *
337  IF( k.LT.n ) THEN
338  CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
339  CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work, 1,
340  \$ zero, a( k+1, k ), 1 )
341  a( k, k ) = a( k, k ) - cdotu( n-k, work, 1, a( k+1, k ),
342  \$ 1 )
343  a( k, k-1 ) = a( k, k-1 ) -
344  \$ cdotu( n-k, a( k+1, k ), 1, a( k+1, k-1 ),
345  \$ 1 )
346  CALL ccopy( n-k, a( k+1, k-1 ), 1, work, 1 )
347  CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work, 1,
348  \$ zero, a( k+1, k-1 ), 1 )
349  a( k-1, k-1 ) = a( k-1, k-1 ) -
350  \$ cdotu( n-k, work, 1, a( k+1, k-1 ), 1 )
351  END IF
352  kstep = 2
353  END IF
354 *
355  kp = abs( ipiv( k ) )
356  IF( kp.NE.k ) THEN
357 *
358 * Interchange rows and columns K and KP in the trailing
359 * submatrix A(k-1:n,k-1:n)
360 *
361  IF( kp.LT.n )
362  \$ CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
363  CALL cswap( kp-k-1, a( k+1, k ), 1, a( kp, k+1 ), lda )
364  temp = a( k, k )
365  a( k, k ) = a( kp, kp )
366  a( kp, kp ) = temp
367  IF( kstep.EQ.2 ) THEN
368  temp = a( k, k-1 )
369  a( k, k-1 ) = a( kp, k-1 )
370  a( kp, k-1 ) = temp
371  END IF
372  END IF
373 *
374  k = k - kstep
375  GO TO 50
376  60 CONTINUE
377  END IF
378 *
379  RETURN
380 *
381 * End of CSYTRI
382 *
subroutin