3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE CCHKHE_AA( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
12 * THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
13 * XACT, WORK, RWORK, IWORK, NOUT )
15 * .. Scalar Arguments ..
17 * INTEGER NN, NNB, NNS, NOUT
20 * .. Array Arguments ..
22 * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
24 * COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
25 * $ WORK( * ), X( * ), XACT( * )
34 *> CCHKHE_AA tests CHETRF_AA, -TRS_AA.
42 *> DOTYPE is LOGICAL array, dimension (NTYPES)
43 *> The matrix types to be used for testing. Matrices of type j
44 *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
45 *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
51 *> The number of values of N contained in the vector NVAL.
56 *> NVAL is INTEGER array, dimension (NN)
57 *> The values of the matrix dimension N.
63 *> The number of values of NB contained in the vector NBVAL.
68 *> NBVAL is INTEGER array, dimension (NBVAL)
69 *> The values of the blocksize NB.
75 *> The number of values of NRHS contained in the vector NSVAL.
80 *> NSVAL is INTEGER array, dimension (NNS)
81 *> The values of the number of right hand sides NRHS.
87 *> The threshold value for the test ratios. A result is
88 *> included in the output file if RESULT >= THRESH. To have
89 *> every test ratio printed, use THRESH = 0.
95 *> Flag that indicates whether error exits are to be tested.
101 *> The maximum value permitted for N, used in dimensioning the
107 *> A is COMPLEX array, dimension (NMAX*NMAX)
112 *> AFAC is COMPLEX array, dimension (NMAX*NMAX)
117 *> AINV is COMPLEX array, dimension (NMAX*NMAX)
122 *> B is COMPLEX array, dimension (NMAX*NSMAX)
123 *> where NSMAX is the largest entry in NSVAL.
128 *> X is COMPLEX array, dimension (NMAX*NSMAX)
133 *> XACT is COMPLEX array, dimension (NMAX*NSMAX)
138 *> WORK is COMPLEX array, dimension (NMAX*max(3,NSMAX))
143 *> RWORK is REAL array, dimension (max(NMAX,2*NSMAX))
148 *> IWORK is INTEGER array, dimension (NMAX)
154 *> The unit number for output.
160 *> \author Univ. of Tennessee
161 *> \author Univ. of California Berkeley
162 *> \author Univ. of Colorado Denver
168 *> \ingroup complex_lin
170 * =====================================================================
171 SUBROUTINE CCHKHE_AA( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
172 $ THRESH, TSTERR, NMAX, A, AFAC, AINV, B,
173 $ X, XACT, WORK, RWORK, IWORK, NOUT )
175 * -- LAPACK test routine (version 3.7.1) --
176 * -- LAPACK is a software package provided by Univ. of Tennessee, --
177 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
182 * .. Scalar Arguments ..
184 INTEGER NMAX, NN, NNB, NNS, NOUT
187 * .. Array Arguments ..
189 INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
191 COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
192 $ WORK( * ), X( * ), XACT( * )
195 * =====================================================================
199 PARAMETER ( ZERO = 0.0E+0 )
201 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) )
203 PARAMETER ( NTYPES = 10 )
205 PARAMETER ( NTESTS = 9 )
207 * .. Local Scalars ..
209 CHARACTER DIST, TYPE, UPLO, XTYPE
210 CHARACTER*3 PATH, MATPATH
211 INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
212 $ IUPLO, IZERO, J, K, KL, KU, LDA, LWORK, MODE,
213 $ N, NB, NERRS, NFAIL, NIMAT, NRHS, NRUN, NT
218 INTEGER ISEED( 4 ), ISEEDY( 4 )
219 REAL RESULT( NTESTS )
221 * .. External Subroutines ..
222 EXTERNAL ALAERH, ALAHD, ALASUM, XLAENV, CERRHE, CHET01_AA,
223 $ CHETRF_AA, CHETRS_AA, CLACPY, CLAIPD, CLARHS,
224 $ CLATB4, CLATMS, CPOT02
226 * .. Intrinsic Functions ..
229 * .. Scalars in Common ..
234 * .. Common blocks ..
235 COMMON / INFOC / INFOT, NUNIT, OK, LERR
236 COMMON / SRNAMC / SRNAMT
238 * .. Data statements ..
239 DATA ISEEDY / 1988, 1989, 1990, 1991 /
240 DATA UPLOS / 'U', 'L' /
242 * .. Executable Statements ..
244 * Initialize constants and the random number seed.
249 PATH( 1: 1 ) = 'Complex precision'
252 * Path to generate matrices
254 MATPATH( 1: 1 ) = 'Complex precision'
255 MATPATH( 2: 3 ) = 'HE'
260 ISEED( I ) = ISEEDY( I )
263 * Test the error exits
266 $ CALL CERRHE( PATH, NOUT )
269 * Set the minimum block size for which the block routine should
270 * be used, which will be later returned by ILAENV
274 * Do for each value of N in NVAL
278 IF( N .GT. NMAX ) THEN
280 WRITE(NOUT, 9995) 'M ', N, NMAX
290 DO 170 IMAT = 1, NIMAT
292 * Do the tests only if DOTYPE( IMAT ) is true.
294 IF( .NOT.DOTYPE( IMAT ) )
297 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
299 ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
300 IF( ZEROT .AND. N.LT.IMAT-2 )
303 * Do first for UPLO = 'U', then for UPLO = 'L'
306 UPLO = UPLOS( IUPLO )
308 * Set up parameters with CLATB4 for the matrix generator
309 * based on the type of matrix to be generated.
311 CALL CLATB4( MATPATH, IMAT, N, N, TYPE, KL, KU,
312 $ ANORM, MODE, CNDNUM, DIST )
314 * Generate a matrix with CLATMS.
317 CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
318 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
321 * Check error code from CLATMS and handle error.
324 CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
325 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
327 * Skip all tests for this generated matrix
332 * For types 3-6, zero one or more rows and columns of
333 * the matrix to test that INFO is returned correctly.
338 ELSE IF( IMAT.EQ.4 ) THEN
346 * Set row and column IZERO to zero.
348 IF( IUPLO.EQ.1 ) THEN
349 IOFF = ( IZERO-1 )*LDA
350 DO 20 I = 1, IZERO - 1
360 DO 40 I = 1, IZERO - 1
370 IF( IUPLO.EQ.1 ) THEN
372 * Set the first IZERO rows and columns to zero.
385 * Set the last IZERO rows and columns to zero.
401 * End generate test matrix A.
404 * Set the imaginary part of the diagonals.
406 CALL CLAIPD( N, A, LDA+1, 0 )
408 * Do for each value of NB in NBVAL
412 * Set the optimal blocksize, which will be later
413 * returned by ILAENV.
418 * Copy the test matrix A into matrix AFAC which
419 * will be factorized in place. This is needed to
420 * preserve the test matrix A for subsequent tests.
422 CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
424 * Compute the L*D*L**T or U*D*U**T factorization of the
425 * matrix. IWORK stores details of the interchanges and
426 * the block structure of D. AINV is a work array for
427 * block factorization, LWORK is the length of AINV.
429 LWORK = MAX( 1, ( NB+1 )*LDA )
431 CALL CHETRF_AA( UPLO, N, AFAC, LDA, IWORK, AINV,
434 * Adjust the expected value of INFO to account for
437 c IF( IZERO.GT.0 ) THEN
443 c ELSE IF( IWORK( J ).EQ.K ) THEN
454 * Check error code from CHETRF and handle error.
457 CALL ALAERH( PATH, 'CHETRF_AA', INFO, K, UPLO,
458 $ N, N, -1, -1, NB, IMAT, NFAIL, NERRS,
463 * Reconstruct matrix from factors and compute residual.
465 CALL CHET01_AA( UPLO, N, A, LDA, AFAC, LDA, IWORK,
466 $ AINV, LDA, RWORK, RESULT( 1 ) )
470 * Print information about the tests that did not pass
474 IF( RESULT( K ).GE.THRESH ) THEN
475 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
476 $ CALL ALAHD( NOUT, PATH )
477 WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
484 * Skip solver test if INFO is not 0.
490 * Do for each value of NRHS in NSVAL.
495 *+ TEST 2 (Using TRS)
496 * Solve and compute residual for A * X = B.
498 * Choose a set of NRHS random solution vectors
499 * stored in XACT and set up the right hand side B
502 CALL CLARHS( MATPATH, XTYPE, UPLO, ' ', N, N,
503 $ KL, KU, NRHS, A, LDA, XACT, LDA,
504 $ B, LDA, ISEED, INFO )
505 CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
508 LWORK = MAX( 1, 3*N-2 )
509 CALL CHETRS_AA( UPLO, N, NRHS, AFAC, LDA, IWORK,
510 $ X, LDA, WORK, LWORK, INFO )
512 * Check error code from CHETRS and handle error.
515 IF( IZERO.EQ.0 ) THEN
516 CALL ALAERH( PATH, 'CHETRS_AA', INFO, 0,
517 $ UPLO, N, N, -1, -1, NRHS, IMAT,
518 $ NFAIL, NERRS, NOUT )
521 CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA
524 * Compute the residual for the solution
526 CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA,
527 $ WORK, LDA, RWORK, RESULT( 2 ) )
529 * Print information about the tests that did not pass
533 IF( RESULT( K ).GE.THRESH ) THEN
534 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
535 $ CALL ALAHD( NOUT, PATH )
536 WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS,
537 $ IMAT, K, RESULT( K )
544 * End do for each value of NRHS in NSVAL.
553 * Print a summary of the results.
555 CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
557 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NB =', I4, ', type ',
558 $ I2, ', test ', I2, ', ratio =', G12.5 )
559 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
560 $ I2, ', test(', I2, ') =', G12.5 )
561 9995 FORMAT( ' Invalid input value: ', A4, '=', I6, '; must be <=',