LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ cdrvhe_rook()

 subroutine cdrvhe_rook ( logical, dimension( * ) DOTYPE, integer NN, integer, dimension( * ) NVAL, integer NRHS, real THRESH, logical TSTERR, integer NMAX, complex, dimension( * ) A, complex, dimension( * ) AFAC, complex, dimension( * ) AINV, complex, dimension( * ) B, complex, dimension( * ) X, complex, dimension( * ) XACT, complex, dimension( * ) WORK, real, dimension( * ) RWORK, integer, dimension( * ) IWORK, integer NOUT )

CDRVHE_ROOK

Purpose:
` CDRVHE_ROOK tests the driver routines CHESV_ROOK.`
Parameters
 [in] DOTYPE ``` DOTYPE is LOGICAL array, dimension (NTYPES) The matrix types to be used for testing. Matrices of type j (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.``` [in] NN ``` NN is INTEGER The number of values of N contained in the vector NVAL.``` [in] NVAL ``` NVAL is INTEGER array, dimension (NN) The values of the matrix dimension N.``` [in] NRHS ``` NRHS is INTEGER The number of right hand side vectors to be generated for each linear system.``` [in] THRESH ``` THRESH is REAL The threshold value for the test ratios. A result is included in the output file if RESULT >= THRESH. To have every test ratio printed, use THRESH = 0.``` [in] TSTERR ``` TSTERR is LOGICAL Flag that indicates whether error exits are to be tested.``` [in] NMAX ``` NMAX is INTEGER The maximum value permitted for N, used in dimensioning the work arrays.``` [out] A ` A is COMPLEX array, dimension (NMAX*NMAX)` [out] AFAC ` AFAC is COMPLEX array, dimension (NMAX*NMAX)` [out] AINV ` AINV is COMPLEX array, dimension (NMAX*NMAX)` [out] B ` B is COMPLEX array, dimension (NMAX*NRHS)` [out] X ` X is COMPLEX array, dimension (NMAX*NRHS)` [out] XACT ` XACT is COMPLEX array, dimension (NMAX*NRHS)` [out] WORK ` WORK is COMPLEX array, dimension (NMAX*max(2,NRHS))` [out] RWORK ` RWORK is REAL array, dimension (NMAX+2*NRHS)` [out] IWORK ` IWORK is INTEGER array, dimension (NMAX)` [in] NOUT ``` NOUT is INTEGER The unit number for output.```
Date
November 2013

Definition at line 155 of file cdrvhe_rook.f.

155 *
156 * -- LAPACK test routine (version 3.5.0) --
157 * -- LAPACK is a software package provided by Univ. of Tennessee, --
158 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159 * November 2013
160 *
161 * .. Scalar Arguments ..
162  LOGICAL tsterr
163  INTEGER nmax, nn, nout, nrhs
164  REAL thresh
165 * ..
166 * .. Array Arguments ..
167  LOGICAL dotype( * )
168  INTEGER iwork( * ), nval( * )
169  REAL rwork( * )
170  COMPLEX a( * ), afac( * ), ainv( * ), b( * ),
171  \$ work( * ), x( * ), xact( * )
172 * ..
173 *
174 * =====================================================================
175 *
176 * .. Parameters ..
177  REAL one, zero
178  parameter( one = 1.0e+0, zero = 0.0e+0 )
179  INTEGER ntypes, ntests
180  parameter( ntypes = 10, ntests = 3 )
181  INTEGER nfact
182  parameter( nfact = 2 )
183 * ..
184 * .. Local Scalars ..
185  LOGICAL zerot
186  CHARACTER dist, fact, TYPE, uplo, xtype
187  CHARACTER*3 matpath, path
188  INTEGER i, i1, i2, ifact, imat, in, info, ioff, iuplo,
189  \$ izero, j, k, kl, ku, lda, lwork, mode, n,
190  \$ nb, nbmin, nerrs, nfail, nimat, nrun, nt
191  REAL ainvnm, anorm, cndnum, rcondc
192 * ..
193 * .. Local Arrays ..
194  CHARACTER facts( nfact ), uplos( 2 )
195  INTEGER iseed( 4 ), iseedy( 4 )
196  REAL result( ntests )
197
198 * ..
199 * .. External Functions ..
200  REAL clanhe
201  EXTERNAL clanhe
202 * ..
203 * .. External Subroutines ..
204  EXTERNAL aladhd, alaerh, alasvm, xlaenv, cerrvx,
208 * ..
209 * .. Scalars in Common ..
210  LOGICAL lerr, ok
211  CHARACTER*32 srnamt
212  INTEGER infot, nunit
213 * ..
214 * .. Common blocks ..
215  COMMON / infoc / infot, nunit, ok, lerr
216  COMMON / srnamc / srnamt
217 * ..
218 * .. Intrinsic Functions ..
219  INTRINSIC max, min
220 * ..
221 * .. Data statements ..
222  DATA iseedy / 1988, 1989, 1990, 1991 /
223  DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
224 * ..
225 * .. Executable Statements ..
226 *
227 * Initialize constants and the random number seed.
228 *
229 * Test path
230 *
231  path( 1: 1 ) = 'Complex precision'
232  path( 2: 3 ) = 'HR'
233 *
234 * Path to generate matrices
235 *
236  matpath( 1: 1 ) = 'Complex precision'
237  matpath( 2: 3 ) = 'HE'
238 *
239  nrun = 0
240  nfail = 0
241  nerrs = 0
242  DO 10 i = 1, 4
243  iseed( i ) = iseedy( i )
244  10 CONTINUE
245  lwork = max( 2*nmax, nmax*nrhs )
246 *
247 * Test the error exits
248 *
249  IF( tsterr )
250  \$ CALL cerrvx( path, nout )
251  infot = 0
252 *
253 * Set the block size and minimum block size for which the block
254 * routine should be used, which will be later returned by ILAENV.
255 *
256  nb = 1
257  nbmin = 2
258  CALL xlaenv( 1, nb )
259  CALL xlaenv( 2, nbmin )
260 *
261 * Do for each value of N in NVAL
262 *
263  DO 180 in = 1, nn
264  n = nval( in )
265  lda = max( n, 1 )
266  xtype = 'N'
267  nimat = ntypes
268  IF( n.LE.0 )
269  \$ nimat = 1
270 *
271  DO 170 imat = 1, nimat
272 *
273 * Do the tests only if DOTYPE( IMAT ) is true.
274 *
275  IF( .NOT.dotype( imat ) )
276  \$ GO TO 170
277 *
278 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
279 *
280  zerot = imat.GE.3 .AND. imat.LE.6
281  IF( zerot .AND. n.LT.imat-2 )
282  \$ GO TO 170
283 *
284 * Do first for UPLO = 'U', then for UPLO = 'L'
285 *
286  DO 160 iuplo = 1, 2
287  uplo = uplos( iuplo )
288 *
289 * Begin generate the test matrix A.
290 *
291 * Set up parameters with CLATB4 for the matrix generator
292 * based on the type of matrix to be generated.
293 *
294  CALL clatb4( matpath, imat, n, n, TYPE, kl, ku, anorm,
295  \$ mode, cndnum, dist )
296 *
297 * Generate a matrix with CLATMS.
298 *
299  srnamt = 'CLATMS'
300  CALL clatms( n, n, dist, iseed, TYPE, rwork, mode,
301  \$ cndnum, anorm, kl, ku, uplo, a, lda,
302  \$ work, info )
303 *
304 * Check error code from CLATMS and handle error.
305 *
306  IF( info.NE.0 ) THEN
307  CALL alaerh( path, 'CLATMS', info, 0, uplo, n, n,
308  \$ -1, -1, -1, imat, nfail, nerrs, nout )
309  GO TO 160
310  END IF
311 *
312 * For types 3-6, zero one or more rows and columns of
313 * the matrix to test that INFO is returned correctly.
314 *
315  IF( zerot ) THEN
316  IF( imat.EQ.3 ) THEN
317  izero = 1
318  ELSE IF( imat.EQ.4 ) THEN
319  izero = n
320  ELSE
321  izero = n / 2 + 1
322  END IF
323 *
324  IF( imat.LT.6 ) THEN
325 *
326 * Set row and column IZERO to zero.
327 *
328  IF( iuplo.EQ.1 ) THEN
329  ioff = ( izero-1 )*lda
330  DO 20 i = 1, izero - 1
331  a( ioff+i ) = zero
332  20 CONTINUE
333  ioff = ioff + izero
334  DO 30 i = izero, n
335  a( ioff ) = zero
336  ioff = ioff + lda
337  30 CONTINUE
338  ELSE
339  ioff = izero
340  DO 40 i = 1, izero - 1
341  a( ioff ) = zero
342  ioff = ioff + lda
343  40 CONTINUE
344  ioff = ioff - izero
345  DO 50 i = izero, n
346  a( ioff+i ) = zero
347  50 CONTINUE
348  END IF
349  ELSE
350  IF( iuplo.EQ.1 ) THEN
351 *
352 * Set the first IZERO rows and columns to zero.
353 *
354  ioff = 0
355  DO 70 j = 1, n
356  i2 = min( j, izero )
357  DO 60 i = 1, i2
358  a( ioff+i ) = zero
359  60 CONTINUE
360  ioff = ioff + lda
361  70 CONTINUE
362  ELSE
363 *
364 * Set the first IZERO rows and columns to zero.
365 *
366  ioff = 0
367  DO 90 j = 1, n
368  i1 = max( j, izero )
369  DO 80 i = i1, n
370  a( ioff+i ) = zero
371  80 CONTINUE
372  ioff = ioff + lda
373  90 CONTINUE
374  END IF
375  END IF
376  ELSE
377  izero = 0
378  END IF
379 *
380 * End generate the test matrix A.
381 *
382 *
383  DO 150 ifact = 1, nfact
384 *
385 * Do first for FACT = 'F', then for other values.
386 *
387  fact = facts( ifact )
388 *
389 * Compute the condition number for comparison with
390 * the value returned by CHESVX_ROOK.
391 *
392  IF( zerot ) THEN
393  IF( ifact.EQ.1 )
394  \$ GO TO 150
395  rcondc = zero
396 *
397  ELSE IF( ifact.EQ.1 ) THEN
398 *
399 * Compute the 1-norm of A.
400 *
401  anorm = clanhe( '1', uplo, n, a, lda, rwork )
402 *
403 * Factor the matrix A.
404 *
405  CALL clacpy( uplo, n, n, a, lda, afac, lda )
406  CALL chetrf_rook( uplo, n, afac, lda, iwork, work,
407  \$ lwork, info )
408 *
409 * Compute inv(A) and take its norm.
410 *
411  CALL clacpy( uplo, n, n, afac, lda, ainv, lda )
412  lwork = (n+nb+1)*(nb+3)
413  CALL chetri_rook( uplo, n, ainv, lda, iwork,
414  \$ work, info )
415  ainvnm = clanhe( '1', uplo, n, ainv, lda, rwork )
416 *
417 * Compute the 1-norm condition number of A.
418 *
419  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
420  rcondc = one
421  ELSE
422  rcondc = ( one / anorm ) / ainvnm
423  END IF
424  END IF
425 *
426 * Form an exact solution and set the right hand side.
427 *
428  srnamt = 'CLARHS'
429  CALL clarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
430  \$ nrhs, a, lda, xact, lda, b, lda, iseed,
431  \$ info )
432  xtype = 'C'
433 *
434 * --- Test CHESV_ROOK ---
435 *
436  IF( ifact.EQ.2 ) THEN
437  CALL clacpy( uplo, n, n, a, lda, afac, lda )
438  CALL clacpy( 'Full', n, nrhs, b, lda, x, lda )
439 *
440 * Factor the matrix and solve the system using
441 * CHESV_ROOK.
442 *
443  srnamt = 'CHESV_ROOK'
444  CALL chesv_rook( uplo, n, nrhs, afac, lda, iwork,
445  \$ x, lda, work, lwork, info )
446 *
447 * Adjust the expected value of INFO to account for
448 * pivoting.
449 *
450  k = izero
451  IF( k.GT.0 ) THEN
452  100 CONTINUE
453  IF( iwork( k ).LT.0 ) THEN
454  IF( iwork( k ).NE.-k ) THEN
455  k = -iwork( k )
456  GO TO 100
457  END IF
458  ELSE IF( iwork( k ).NE.k ) THEN
459  k = iwork( k )
460  GO TO 100
461  END IF
462  END IF
463 *
464 * Check error code from CHESV_ROOK and handle error.
465 *
466  IF( info.NE.k ) THEN
467  CALL alaerh( path, 'CHESV_ROOK', info, k, uplo,
468  \$ n, n, -1, -1, nrhs, imat, nfail,
469  \$ nerrs, nout )
470  GO TO 120
471  ELSE IF( info.NE.0 ) THEN
472  GO TO 120
473  END IF
474 *
475 *+ TEST 1 Reconstruct matrix from factors and compute
476 * residual.
477 *
478  CALL chet01_rook( uplo, n, a, lda, afac, lda,
479  \$ iwork, ainv, lda, rwork,
480  \$ result( 1 ) )
481 *
482 *+ TEST 2 Compute residual of the computed solution.
483 *
484  CALL clacpy( 'Full', n, nrhs, b, lda, work, lda )
485  CALL cpot02( uplo, n, nrhs, a, lda, x, lda, work,
486  \$ lda, rwork, result( 2 ) )
487 *
488 *+ TEST 3
489 * Check solution from generated exact solution.
490 *
491  CALL cget04( n, nrhs, x, lda, xact, lda, rcondc,
492  \$ result( 3 ) )
493  nt = 3
494 *
495 * Print information about the tests that did not pass
496 * the threshold.
497 *
498  DO 110 k = 1, nt
499  IF( result( k ).GE.thresh ) THEN
500  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
501  \$ CALL aladhd( nout, path )
502  WRITE( nout, fmt = 9999 )'CHESV_ROOK', uplo,
503  \$ n, imat, k, result( k )
504  nfail = nfail + 1
505  END IF
506  110 CONTINUE
507  nrun = nrun + nt
508  120 CONTINUE
509  END IF
510 *
511  150 CONTINUE
512 *
513  160 CONTINUE
514  170 CONTINUE
515  180 CONTINUE
516 *
517 * Print a summary of the results.
518 *
519  CALL alasvm( path, nout, nfail, nrun, nerrs )
520 *
521  9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
522  \$ ', test ', i2, ', ratio =', g12.5 )
523  RETURN
524 *
525 * End of CDRVHE_ROOK
526 *
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:75
subroutine chetri_rook(UPLO, N, A, LDA, IPIV, WORK, INFO)
CHETRI_ROOK computes the inverse of HE matrix using the factorization obtained with the bounded Bunch...
Definition: chetri_rook.f:130
subroutine chetrf_rook(UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
CHETRF_ROOK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bun...
Definition: chetrf_rook.f:214
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:149
subroutine cpot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
CPOT02
Definition: cpot02.f:129
subroutine chesv_rook(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
CHESV_ROOK computes the solution to a system of linear equations A * X = B for HE matrices using the ...
Definition: chesv_rook.f:207
subroutine cerrvx(PATH, NUNIT)
CERRVX
Definition: cerrvx.f:57
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:83
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
subroutine clatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
CLATMS
Definition: clatms.f:334
subroutine chet01_rook(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
CHET01_ROOK
Definition: chet01_rook.f:127
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE 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 Hermitian matrix.
Definition: clanhe.f:126
subroutine clarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
CLARHS
Definition: clarhs.f:211
subroutine cget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
CGET04
Definition: cget04.f:104
subroutine clatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
CLATB4
Definition: clatb4.f:123
Here is the call graph for this function:
Here is the caller graph for this function: