LAPACK  3.10.1 LAPACK: Linear Algebra PACKage
dchksy_aa_2stage.f
Go to the documentation of this file.
1 *> \brief \b DCHKSY_AA_2STAGE
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE DCHKSY_AA_2STAGE( DOTYPE, NN, NVAL, NNB, NBVAL,
12 * NNS, NSVAL, THRESH, TSTERR, NMAX, A,
13 * AFAC, AINV, B, X, XACT, WORK, RWORK,
14 * IWORK, NOUT )
15 *
16 * .. Scalar Arguments ..
17 * LOGICAL TSTERR
18 * INTEGER NMAX, NN, NNB, NNS, NOUT
19 * DOUBLE PRECISION THRESH
20 * ..
21 * .. Array Arguments ..
22 * LOGICAL DOTYPE( * )
23 * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
24 * DOUBLE PRECISION A( * ), AFAC( * ), AINV( * ), B( * ),
25 * \$ RWORK( * ), WORK( * ), X( * ), XACT( * )
26 * ..
27 *
28 *
29 *> \par Purpose:
30 * =============
31 *>
32 *> \verbatim
33 *>
34 *> DCHKSY_AA_2STAGE tests DSYTRF_AA_2STAGE, -TRS_AA_2STAGE.
35 *> \endverbatim
36 *
37 * Arguments:
38 * ==========
39 *
40 *> \param[in] DOTYPE
41 *> \verbatim
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.
46 *> \endverbatim
47 *>
48 *> \param[in] NN
49 *> \verbatim
50 *> NN is INTEGER
51 *> The number of values of N contained in the vector NVAL.
52 *> \endverbatim
53 *>
54 *> \param[in] NVAL
55 *> \verbatim
56 *> NVAL is INTEGER array, dimension (NN)
57 *> The values of the matrix dimension N.
58 *> \endverbatim
59 *>
60 *> \param[in] NNB
61 *> \verbatim
62 *> NNB is INTEGER
63 *> The number of values of NB contained in the vector NBVAL.
64 *> \endverbatim
65 *>
66 *> \param[in] NBVAL
67 *> \verbatim
68 *> NBVAL is INTEGER array, dimension (NNB)
69 *> The values of the blocksize NB.
70 *> \endverbatim
71 *>
72 *> \param[in] NNS
73 *> \verbatim
74 *> NNS is INTEGER
75 *> The number of values of NRHS contained in the vector NSVAL.
76 *> \endverbatim
77 *>
78 *> \param[in] NSVAL
79 *> \verbatim
80 *> NSVAL is INTEGER array, dimension (NNS)
81 *> The values of the number of right hand sides NRHS.
82 *> \endverbatim
83 *>
84 *> \param[in] THRESH
85 *> \verbatim
86 *> THRESH is DOUBLE PRECISION
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.
90 *> \endverbatim
91 *>
92 *> \param[in] TSTERR
93 *> \verbatim
94 *> TSTERR is LOGICAL
95 *> Flag that indicates whether error exits are to be tested.
96 *> \endverbatim
97 *>
98 *> \param[in] NMAX
99 *> \verbatim
100 *> NMAX is INTEGER
101 *> The maximum value permitted for N, used in dimensioning the
102 *> work arrays.
103 *> \endverbatim
104 *>
105 *> \param[out] A
106 *> \verbatim
107 *> A is DOUBLE PRECISION array, dimension (NMAX*NMAX)
108 *> \endverbatim
109 *>
110 *> \param[out] AFAC
111 *> \verbatim
112 *> AFAC is DOUBLE PRECISION array, dimension (NMAX*NMAX)
113 *> \endverbatim
114 *>
115 *> \param[out] AINV
116 *> \verbatim
117 *> AINV is DOUBLE PRECISION array, dimension (NMAX*NMAX)
118 *> \endverbatim
119 *>
120 *> \param[out] B
121 *> \verbatim
122 *> B is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
123 *> where NSMAX is the largest entry in NSVAL.
124 *> \endverbatim
125 *>
126 *> \param[out] X
127 *> \verbatim
128 *> X is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
129 *> \endverbatim
130 *>
131 *> \param[out] XACT
132 *> \verbatim
133 *> XACT is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
134 *> \endverbatim
135 *>
136 *> \param[out] WORK
137 *> \verbatim
138 *> WORK is DOUBLE PRECISION array, dimension (NMAX*max(3,NSMAX))
139 *> \endverbatim
140 *>
141 *> \param[out] RWORK
142 *> \verbatim
143 *> RWORK is DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX))
144 *> \endverbatim
145 *>
146 *> \param[out] IWORK
147 *> \verbatim
148 *> IWORK is INTEGER array, dimension (2*NMAX)
149 *> \endverbatim
150 *>
151 *> \param[in] NOUT
152 *> \verbatim
153 *> NOUT is INTEGER
154 *> The unit number for output.
155 *> \endverbatim
156 *
157 * Authors:
158 * ========
159 *
160 *> \author Univ. of Tennessee
161 *> \author Univ. of California Berkeley
162 *> \author Univ. of Colorado Denver
163 *> \author NAG Ltd.
164 *
165 *> \ingroup double_lin
166 *
167 * =====================================================================
168  SUBROUTINE dchksy_aa_2stage( DOTYPE, NN, NVAL, NNB, NBVAL, NNS,
169  \$ NSVAL, THRESH, TSTERR, NMAX, A, AFAC, AINV,
170  \$ B, X, XACT, WORK, RWORK, IWORK, NOUT )
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 *
567  END
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 dchksy_aa_2stage(DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
DCHKSY_AA_2STAGE
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