LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ zchkhe_aa_2stage()

subroutine zchkhe_aa_2stage ( logical, dimension( * )  DOTYPE,
integer  NN,
integer, dimension( * )  NVAL,
integer  NNB,
integer, dimension( * )  NBVAL,
integer  NNS,
integer, dimension( * )  NSVAL,
double precision  THRESH,
logical  TSTERR,
integer  NMAX,
complex*16, dimension( * )  A,
complex*16, dimension( * )  AFAC,
complex*16, dimension( * )  AINV,
complex*16, dimension( * )  B,
complex*16, dimension( * )  X,
complex*16, dimension( * )  XACT,
complex*16, dimension( * )  WORK,
complex*16, dimension( * )  RWORK,
integer, dimension( * )  IWORK,
integer  NOUT 
)

ZCHKHE_AA_2STAGE

Purpose:
 ZCHKSY_AA_2STAGE tests ZHETRF_AA_2STAGE, -TRS_AA_2STAGE.
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]NNB
          NNB is INTEGER
          The number of values of NB contained in the vector NBVAL.
[in]NBVAL
          NBVAL is INTEGER array, dimension (NNB)
          The values of the blocksize NB.
[in]NNS
          NNS is INTEGER
          The number of values of NRHS contained in the vector NSVAL.
[in]NSVAL
          NSVAL is INTEGER array, dimension (NNS)
          The values of the number of right hand sides NRHS.
[in]THRESH
          THRESH is DOUBLE PRECISION
          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*16 array, dimension (NMAX*NMAX)
[out]AFAC
          AFAC is COMPLEX*16 array, dimension (NMAX*NMAX)
[out]AINV
          AINV is COMPLEX*16 array, dimension (NMAX*NMAX)
[out]B
          B is COMPLEX*16 array, dimension (NMAX*NSMAX)
          where NSMAX is the largest entry in NSVAL.
[out]X
          X is COMPLEX*16 array, dimension (NMAX*NSMAX)
[out]XACT
          XACT is COMPLEX*16 array, dimension (NMAX*NSMAX)
[out]WORK
          WORK is COMPLEX*16 array, dimension (NMAX*max(3,NSMAX))
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX))
[out]IWORK
          IWORK is INTEGER array, dimension (2*NMAX)
[in]NOUT
          NOUT is INTEGER
          The unit number for output.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 169 of file zchkhe_aa_2stage.f.

172 *
173 * -- LAPACK test routine --
174 * -- LAPACK is a software package provided by Univ. of Tennessee, --
175 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
176 *
177  IMPLICIT NONE
178 *
179 * .. Scalar Arguments ..
180  LOGICAL TSTERR
181  INTEGER NN, NNB, NNS, NMAX, NOUT
182  DOUBLE PRECISION THRESH
183 * ..
184 * .. Array Arguments ..
185  LOGICAL DOTYPE( * )
186  INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
187  COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
188  $ RWORK( * ), WORK( * ), X( * ), XACT( * )
189 * ..
190 *
191 * =====================================================================
192 *
193 * .. Parameters ..
194  DOUBLE PRECISION ZERO
195  parameter( zero = 0.0d+0 )
196  COMPLEX*16 CZERO
197  parameter( czero = ( 0.0d+0, 0.0d+0 ) )
198  INTEGER NTYPES
199  parameter( ntypes = 10 )
200  INTEGER NTESTS
201  parameter( ntests = 9 )
202 * ..
203 * .. Local Scalars ..
204  LOGICAL ZEROT
205  CHARACTER DIST, TYPE, UPLO, XTYPE
206  CHARACTER*3 PATH, MATPATH
207  INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
208  $ IUPLO, IZERO, J, K, KL, KU, LDA, LWORK, MODE,
209  $ N, NB, NERRS, NFAIL, NIMAT, NRHS, NRUN, NT
210  DOUBLE PRECISION ANORM, CNDNUM
211 * ..
212 * .. Local Arrays ..
213  CHARACTER UPLOS( 2 )
214  INTEGER ISEED( 4 ), ISEEDY( 4 )
215  DOUBLE PRECISION RESULT( NTESTS )
216 * ..
217 * .. External Subroutines ..
218  EXTERNAL alaerh, alahd, alasum, zerrhe, zlacpy,
219  $ zlarhs, zlatb4, zlatms, zpot02,
221  $ xlaenv
222 * ..
223 * .. Intrinsic Functions ..
224  INTRINSIC max, min
225 * ..
226 * .. Scalars in Common ..
227  LOGICAL LERR, OK
228  CHARACTER*32 SRNAMT
229  INTEGER INFOT, NUNIT
230 * ..
231 * .. Common blocks ..
232  COMMON / infoc / infot, nunit, ok, lerr
233  COMMON / srnamc / srnamt
234 * ..
235 * .. Data statements ..
236  DATA iseedy / 1988, 1989, 1990, 1991 /
237  DATA uplos / 'U', 'L' /
238 * ..
239 * .. Executable Statements ..
240 *
241 * Initialize constants and the random number seed.
242 *
243 * Test path
244 *
245  path( 1: 1 ) = 'Zomplex precision'
246  path( 2: 3 ) = 'H2'
247 *
248 * Path to generate matrices
249 *
250  matpath( 1: 1 ) = 'Zomplex precision'
251  matpath( 2: 3 ) = 'HE'
252  nrun = 0
253  nfail = 0
254  nerrs = 0
255  DO 10 i = 1, 4
256  iseed( i ) = iseedy( i )
257  10 CONTINUE
258 *
259 * Test the error exits
260 *
261  IF( tsterr )
262  $ CALL zerrhe( path, nout )
263  infot = 0
264 *
265 * Set the minimum block size for which the block routine should
266 * be used, which will be later returned by ILAENV
267 *
268  CALL xlaenv( 2, 2 )
269 *
270 * Do for each value of N in NVAL
271 *
272  DO 180 in = 1, nn
273  n = nval( in )
274  IF( n .GT. nmax ) THEN
275  nfail = nfail + 1
276  WRITE(nout, 9995) 'M ', n, nmax
277  GO TO 180
278  END IF
279  lda = max( n, 1 )
280  xtype = 'N'
281  nimat = ntypes
282  IF( n.LE.0 )
283  $ nimat = 1
284 *
285  izero = 0
286 *
287 * Do for each value of matrix type IMAT
288 *
289  DO 170 imat = 1, nimat
290 *
291 * Do the tests only if DOTYPE( IMAT ) is true.
292 *
293  IF( .NOT.dotype( imat ) )
294  $ GO TO 170
295 *
296 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
297 *
298  zerot = imat.GE.3 .AND. imat.LE.6
299  IF( zerot .AND. n.LT.imat-2 )
300  $ GO TO 170
301 *
302 * Do first for UPLO = 'U', then for UPLO = 'L'
303 *
304  DO 160 iuplo = 1, 2
305  uplo = uplos( iuplo )
306 *
307 * Begin generate the test matrix A.
308 *
309 *
310 * Set up parameters with ZLATB4 for the matrix generator
311 * based on the type of matrix to be generated.
312 *
313  CALL zlatb4( matpath, imat, n, n, TYPE, KL, KU,
314  $ ANORM, MODE, CNDNUM, DIST )
315 *
316 * Generate a matrix with ZLATMS.
317 *
318  srnamt = 'ZLATMS'
319  CALL zlatms( n, n, dist, iseed, TYPE, RWORK, MODE,
320  $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
321  $ INFO )
322 *
323 * Check error code from ZLATMS and handle error.
324 *
325  IF( info.NE.0 ) THEN
326  CALL alaerh( path, 'ZLATMS', info, 0, uplo, n, n, -1,
327  $ -1, -1, imat, nfail, nerrs, nout )
328 *
329 * Skip all tests for this generated matrix
330 *
331  GO TO 160
332  END IF
333 *
334 * For matrix types 3-6, zero one or more rows and
335 * columns of the matrix to test that INFO is returned
336 * correctly.
337 *
338  IF( zerot ) THEN
339  IF( imat.EQ.3 ) THEN
340  izero = 1
341  ELSE IF( imat.EQ.4 ) THEN
342  izero = n
343  ELSE
344  izero = n / 2 + 1
345  END IF
346 *
347  IF( imat.LT.6 ) THEN
348 *
349 * Set row and column IZERO to zero.
350 *
351  IF( iuplo.EQ.1 ) THEN
352  ioff = ( izero-1 )*lda
353  DO 20 i = 1, izero - 1
354  a( ioff+i ) = czero
355  20 CONTINUE
356  ioff = ioff + izero
357  DO 30 i = izero, n
358  a( ioff ) = czero
359  ioff = ioff + lda
360  30 CONTINUE
361  ELSE
362  ioff = izero
363  DO 40 i = 1, izero - 1
364  a( ioff ) = czero
365  ioff = ioff + lda
366  40 CONTINUE
367  ioff = ioff - izero
368  DO 50 i = izero, n
369  a( ioff+i ) = czero
370  50 CONTINUE
371  END IF
372  ELSE
373  IF( iuplo.EQ.1 ) THEN
374 *
375 * Set the first IZERO rows and columns to zero.
376 *
377  ioff = 0
378  DO 70 j = 1, n
379  i2 = min( j, izero )
380  DO 60 i = 1, i2
381  a( ioff+i ) = czero
382  60 CONTINUE
383  ioff = ioff + lda
384  70 CONTINUE
385  izero = 1
386  ELSE
387 *
388 * Set the last IZERO rows and columns to zero.
389 *
390  ioff = 0
391  DO 90 j = 1, n
392  i1 = max( j, izero )
393  DO 80 i = i1, n
394  a( ioff+i ) = czero
395  80 CONTINUE
396  ioff = ioff + lda
397  90 CONTINUE
398  END IF
399  END IF
400  ELSE
401  izero = 0
402  END IF
403 *
404 * End generate test matrix A.
405 *
406 *
407 * Set the imaginary part of the diagonals.
408 *
409  CALL zlaipd( n, a, lda+1, 0 )
410 *
411 * Do for each value of NB in NBVAL
412 *
413  DO 150 inb = 1, nnb
414 *
415 * Set the optimal blocksize, which will be later
416 * returned by ILAENV.
417 *
418  nb = nbval( inb )
419  CALL xlaenv( 1, nb )
420 *
421 * Copy the test matrix A into matrix AFAC which
422 * will be factorized in place. This is needed to
423 * preserve the test matrix A for subsequent tests.
424 *
425  CALL zlacpy( uplo, n, n, a, lda, afac, lda )
426 *
427 * Compute the L*D*L**T or U*D*U**T factorization of the
428 * matrix. IWORK stores details of the interchanges and
429 * the block structure of D. AINV is a work array for
430 * block factorization, LWORK is the length of AINV.
431 *
432  srnamt = 'ZHETRF_AA_2STAGE'
433  lwork = min(n*nb, 3*nmax*nmax)
434  CALL zhetrf_aa_2stage( uplo, n, afac, lda,
435  $ ainv, (3*nb+1)*n,
436  $ iwork, iwork( 1+n ),
437  $ work, lwork,
438  $ info )
439 *
440 * Adjust the expected value of INFO to account for
441 * pivoting.
442 *
443  IF( izero.GT.0 ) THEN
444  j = 1
445  k = izero
446  100 CONTINUE
447  IF( j.EQ.k ) THEN
448  k = iwork( j )
449  ELSE IF( iwork( j ).EQ.k ) THEN
450  k = j
451  END IF
452  IF( j.LT.k ) THEN
453  j = j + 1
454  GO TO 100
455  END IF
456  ELSE
457  k = 0
458  END IF
459 *
460 * Check error code from CHETRF and handle error.
461 *
462  IF( info.NE.k ) THEN
463  CALL alaerh( path, 'ZHETRF_AA_2STAGE', info, k,
464  $ uplo, n, n, -1, -1, nb, imat, nfail,
465  $ nerrs, nout )
466  END IF
467 *
468 *+ TEST 1
469 * Reconstruct matrix from factors and compute residual.
470 *
471 * NEED TO CREATE ZHET01_AA_2STAGE
472 * CALL ZHET01_AA( UPLO, N, A, LDA, AFAC, LDA, IWORK,
473 * $ AINV, LDA, RWORK, RESULT( 1 ) )
474 * NT = 1
475  nt = 0
476 *
477 *
478 * Print information about the tests that did not pass
479 * the threshold.
480 *
481  DO 110 k = 1, nt
482  IF( result( k ).GE.thresh ) THEN
483  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
484  $ CALL alahd( nout, path )
485  WRITE( nout, fmt = 9999 )uplo, n, nb, imat, k,
486  $ result( k )
487  nfail = nfail + 1
488  END IF
489  110 CONTINUE
490  nrun = nrun + nt
491 *
492 * Skip solver test if INFO is not 0.
493 *
494  IF( info.NE.0 ) THEN
495  GO TO 140
496  END IF
497 *
498 * Do for each value of NRHS in NSVAL.
499 *
500  DO 130 irhs = 1, nns
501  nrhs = nsval( irhs )
502 *
503 *+ TEST 2 (Using TRS)
504 * Solve and compute residual for A * X = B.
505 *
506 * Choose a set of NRHS random solution vectors
507 * stored in XACT and set up the right hand side B
508 *
509  srnamt = 'ZLARHS'
510  CALL zlarhs( matpath, xtype, uplo, ' ', n, n,
511  $ kl, ku, nrhs, a, lda, xact, lda,
512  $ b, lda, iseed, info )
513  CALL zlacpy( 'Full', n, nrhs, b, lda, x, lda )
514 *
515  srnamt = 'ZHETRS_AA_2STAGE'
516  lwork = max( 1, 3*n-2 )
517  CALL zhetrs_aa_2stage( uplo, n, nrhs, afac, lda,
518  $ ainv, (3*nb+1)*n, iwork, iwork( 1+n ),
519  $ x, lda, info )
520 *
521 * Check error code from ZHETRS and handle error.
522 *
523  IF( info.NE.0 ) THEN
524  IF( izero.EQ.0 ) THEN
525  CALL alaerh( path, 'ZHETRS_AA_2STAGE',
526  $ info, 0, uplo, n, n, -1, -1,
527  $ nrhs, imat, nfail, nerrs, nout )
528  END IF
529  ELSE
530 *
531  CALL zlacpy( 'Full', n, nrhs, b, lda, work, lda
532  $ )
533 *
534 * Compute the residual for the solution
535 *
536  CALL zpot02( uplo, n, nrhs, a, lda, x, lda,
537  $ work, lda, rwork, result( 2 ) )
538 *
539 * Print information about the tests that did not pass
540 * the threshold.
541 *
542  DO 120 k = 2, 2
543  IF( result( k ).GE.thresh ) THEN
544  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
545  $ CALL alahd( nout, path )
546  WRITE( nout, fmt = 9998 )uplo, n, nrhs,
547  $ imat, k, result( k )
548  nfail = nfail + 1
549  END IF
550  120 CONTINUE
551  END IF
552  nrun = nrun + 1
553 *
554 * End do for each value of NRHS in NSVAL.
555 *
556  130 CONTINUE
557  140 CONTINUE
558  150 CONTINUE
559  160 CONTINUE
560  170 CONTINUE
561  180 CONTINUE
562 *
563 * Print a summary of the results.
564 *
565  CALL alasum( path, nout, nfail, nrun, nerrs )
566 *
567  9999 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NB =', i4, ', type ',
568  $ i2, ', test ', i2, ', ratio =', g12.5 )
569  9998 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NRHS=', i3, ', type ',
570  $ i2, ', test(', i2, ') =', g12.5 )
571  9995 FORMAT( ' Invalid input value: ', a4, '=', i6, '; must be <=',
572  $ i6 )
573  RETURN
574 *
575 * End of ZCHKHE_AA_2STAGE
576 *
subroutine alasum(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASUM
Definition: alasum.f:73
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:81
subroutine alahd(IOUNIT, PATH)
ALAHD
Definition: alahd.f:107
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:147
subroutine zlarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
ZLARHS
Definition: zlarhs.f:208
subroutine zerrhe(PATH, NUNIT)
ZERRHE
Definition: zerrhe.f:55
subroutine zlaipd(N, A, INDA, VINDA)
ZLAIPD
Definition: zlaipd.f:83
subroutine zpot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
ZPOT02
Definition: zpot02.f:127
subroutine zlatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
ZLATB4
Definition: zlatb4.f:121
subroutine zlatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
ZLATMS
Definition: zlatms.f:332
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:103
subroutine zhetrs_aa_2stage(UPLO, N, NRHS, A, LDA, TB, LTB, IPIV, IPIV2, B, LDB, INFO)
ZHETRS_AA_2STAGE
subroutine zhetrf_aa_2stage(UPLO, N, A, LDA, TB, LTB, IPIV, IPIV2, WORK, LWORK, INFO)
ZHETRF_AA_2STAGE
Here is the call graph for this function:
Here is the caller graph for this function: