LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ dchksy_aa_2stage()

subroutine dchksy_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,
double precision, dimension( * )  A,
double precision, dimension( * )  AFAC,
double precision, dimension( * )  AINV,
double precision, dimension( * )  B,
double precision, dimension( * )  X,
double precision, dimension( * )  XACT,
double precision, dimension( * )  WORK,
double precision, dimension( * )  RWORK,
integer, dimension( * )  IWORK,
integer  NOUT 
)

DCHKSY_AA_2STAGE

Purpose:
 DCHKSY_AA_2STAGE tests DSYTRF_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 DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]AFAC
          AFAC is DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]AINV
          AINV is DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]B
          B is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
          where NSMAX is the largest entry in NSVAL.
[out]X
          X is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
[out]XACT
          XACT is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
[out]WORK
          WORK is DOUBLE PRECISION 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 168 of file dchksy_aa_2stage.f.

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