LAPACK  3.10.0 LAPACK: Linear Algebra PACKage
schksy_aa_2stage.f
Go to the documentation of this file.
1 *> \brief \b SCHKSY_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 SCHKSY_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 * REAL THRESH
20 * ..
21 * .. Array Arguments ..
22 * LOGICAL DOTYPE( * )
23 * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
24 * REAL A( * ), AFAC( * ), AINV( * ), B( * ),
25 * \$ RWORK( * ), WORK( * ), X( * ), XACT( * )
26 * ..
27 *
28 *
29 *> \par Purpose:
30 * =============
31 *>
32 *> \verbatim
33 *>
34 *> SCHKSY_AA_2STAGE tests SSYTRF_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 REAL
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 REAL array, dimension (NMAX*NMAX)
108 *> \endverbatim
109 *>
110 *> \param[out] AFAC
111 *> \verbatim
112 *> AFAC is REAL array, dimension (NMAX*NMAX)
113 *> \endverbatim
114 *>
115 *> \param[out] AINV
116 *> \verbatim
117 *> AINV is REAL array, dimension (NMAX*NMAX)
118 *> \endverbatim
119 *>
120 *> \param[out] B
121 *> \verbatim
122 *> B is REAL 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 REAL array, dimension (NMAX*NSMAX)
129 *> \endverbatim
130 *>
131 *> \param[out] XACT
132 *> \verbatim
133 *> XACT is REAL array, dimension (NMAX*NSMAX)
134 *> \endverbatim
135 *>
136 *> \param[out] WORK
137 *> \verbatim
138 *> WORK is REAL array, dimension (NMAX*max(3,NSMAX))
139 *> \endverbatim
140 *>
141 *> \param[out] RWORK
142 *> \verbatim
143 *> RWORK is REAL 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 real_lin
166 *
167 * =====================================================================
168  SUBROUTINE schksy_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  REAL THRESH
182 * ..
183 * .. Array Arguments ..
184  LOGICAL DOTYPE( * )
185  INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
186  REAL A( * ), AFAC( * ), AINV( * ), B( * ),
187  \$ rwork( * ), work( * ), x( * ), xact( * )
188 * ..
189 *
190 * =====================================================================
191 *
192 * .. Parameters ..
193  REAL ZERO
194  PARAMETER ( ZERO = 0.0e+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  REAL ANORM, CNDNUM
208 * ..
209 * .. Local Arrays ..
210  CHARACTER UPLOS( 2 )
211  INTEGER ISEED( 4 ), ISEEDY( 4 )
212  REAL RESULT( NTESTS )
213 * ..
214 * .. External Subroutines ..
215  EXTERNAL alaerh, alahd, alasum, serrsy, slacpy, slarhs,
218  \$ xlaenv
219 * ..
220 * .. Intrinsic Functions ..
221  INTRINSIC max, min
222 * ..
223 * .. Scalars in Common ..
224  LOGICAL LERR, OK
225  CHARACTER*32 SRNAMT
226  INTEGER INFOT, NUNIT
227 * ..
228 * .. Common blocks ..
229  COMMON / infoc / infot, nunit, ok, lerr
230  COMMON / srnamc / srnamt
231 * ..
232 * .. Data statements ..
233  DATA iseedy / 1988, 1989, 1990, 1991 /
234  DATA uplos / 'U', 'L' /
235 * ..
236 * .. Executable Statements ..
237 *
238 * Initialize constants and the random number seed.
239 *
240 *
241 * Test path
242 *
243  path( 1: 1 ) = 'Single precision'
244  path( 2: 3 ) = 'S2'
245 *
246 * Path to generate matrices
247 *
248  matpath( 1: 1 ) = 'Single precision'
249  matpath( 2: 3 ) = 'SY'
250  nrun = 0
251  nfail = 0
252  nerrs = 0
253  DO 10 i = 1, 4
254  iseed( i ) = iseedy( i )
255  10 CONTINUE
256 *
257 * Test the error exits
258 *
259  IF( tsterr )
260  \$ CALL serrsy( path, nout )
261  infot = 0
262 *
263 * Set the minimum block size for which the block routine should
264 * be used, which will be later returned by ILAENV
265 *
266  CALL xlaenv( 2, 2 )
267 *
268 * Do for each value of N in NVAL
269 *
270  DO 180 in = 1, nn
271  n = nval( in )
272  IF( n .GT. nmax ) THEN
273  nfail = nfail + 1
274  WRITE(nout, 9995) 'M ', n, nmax
275  GO TO 180
276  END IF
277  lda = max( n, 1 )
278  xtype = 'N'
279  nimat = ntypes
280  IF( n.LE.0 )
281  \$ nimat = 1
282 *
283  izero = 0
284 *
285 * Do for each value of matrix type IMAT
286 *
287  DO 170 imat = 1, nimat
288 *
289 * Do the tests only if DOTYPE( IMAT ) is true.
290 *
291  IF( .NOT.dotype( imat ) )
292  \$ GO TO 170
293 *
294 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
295 *
296  zerot = imat.GE.3 .AND. imat.LE.6
297  IF( zerot .AND. n.LT.imat-2 )
298  \$ GO TO 170
299 *
300 * Do first for UPLO = 'U', then for UPLO = 'L'
301 *
302  DO 160 iuplo = 1, 2
303  uplo = uplos( iuplo )
304 *
305 * Begin generate the test matrix A.
306 *
307 *
308 * Set up parameters with SLATB4 for the matrix generator
309 * based on the type of matrix to be generated.
310 *
311  CALL slatb4( matpath, imat, n, n, TYPE, kl, ku,
312  \$ anorm, mode, cndnum, dist )
313 *
314 * Generate a matrix with SLATMS.
315 *
316  srnamt = 'SLATMS'
317  CALL slatms( n, n, dist, iseed, TYPE, rwork, mode,
318  \$ cndnum, anorm, kl, ku, uplo, a, lda, work,
319  \$ info )
320 *
321 * Check error code from SLATMS and handle error.
322 *
323  IF( info.NE.0 ) THEN
324  CALL alaerh( path, 'SLATMS', info, 0, uplo, n, n, -1,
325  \$ -1, -1, imat, nfail, nerrs, nout )
326 *
327 * Skip all tests for this generated matrix
328 *
329  GO TO 160
330  END IF
331 *
332 * For matrix types 3-6, zero one or more rows and
333 * columns of the matrix to test that INFO is returned
334 * correctly.
335 *
336  IF( zerot ) THEN
337  IF( imat.EQ.3 ) THEN
338  izero = 1
339  ELSE IF( imat.EQ.4 ) THEN
340  izero = n
341  ELSE
342  izero = n / 2 + 1
343  END IF
344 *
345  IF( imat.LT.6 ) THEN
346 *
347 * Set row and column IZERO to zero.
348 *
349  IF( iuplo.EQ.1 ) THEN
350  ioff = ( izero-1 )*lda
351  DO 20 i = 1, izero - 1
352  a( ioff+i ) = zero
353  20 CONTINUE
354  ioff = ioff + izero
355  DO 30 i = izero, n
356  a( ioff ) = zero
357  ioff = ioff + lda
358  30 CONTINUE
359  ELSE
360  ioff = izero
361  DO 40 i = 1, izero - 1
362  a( ioff ) = zero
363  ioff = ioff + lda
364  40 CONTINUE
365  ioff = ioff - izero
366  DO 50 i = izero, n
367  a( ioff+i ) = zero
368  50 CONTINUE
369  END IF
370  ELSE
371  IF( iuplo.EQ.1 ) THEN
372 *
373 * Set the first IZERO rows and columns to zero.
374 *
375  ioff = 0
376  DO 70 j = 1, n
377  i2 = min( j, izero )
378  DO 60 i = 1, i2
379  a( ioff+i ) = zero
380  60 CONTINUE
381  ioff = ioff + lda
382  70 CONTINUE
383  izero = 1
384  ELSE
385 *
386 * Set the last IZERO rows and columns to zero.
387 *
388  ioff = 0
389  DO 90 j = 1, n
390  i1 = max( j, izero )
391  DO 80 i = i1, n
392  a( ioff+i ) = zero
393  80 CONTINUE
394  ioff = ioff + lda
395  90 CONTINUE
396  END IF
397  END IF
398  ELSE
399  izero = 0
400  END IF
401 *
402 * End generate the test matrix A.
403 *
404 * Do for each value of NB in NBVAL
405 *
406  DO 150 inb = 1, nnb
407 *
408 * Set the optimal blocksize, which will be later
409 * returned by ILAENV.
410 *
411  nb = nbval( inb )
412  CALL xlaenv( 1, nb )
413 *
414 * Copy the test matrix A into matrix AFAC which
415 * will be factorized in place. This is needed to
416 * preserve the test matrix A for subsequent tests.
417 *
418  CALL slacpy( uplo, n, n, a, lda, afac, lda )
419 *
420 * Compute the L*D*L**T or U*D*U**T factorization of the
421 * matrix. IWORK stores details of the interchanges and
422 * the block structure of D. AINV is a work array for
423 * block factorization, LWORK is the length of AINV.
424 *
425  srnamt = 'SSYTRF_AA_2STAGE'
426  lwork = min(n*nb, 3*nmax*nmax)
427  CALL ssytrf_aa_2stage( uplo, n, afac, lda,
428  \$ ainv, (3*nb+1)*n,
429  \$ iwork, iwork( 1+n ),
430  \$ work, lwork,
431  \$ info )
432 *
433 * Adjust the expected value of INFO to account for
434 * pivoting.
435 *
436  IF( izero.GT.0 ) THEN
437  j = 1
438  k = izero
439  100 CONTINUE
440  IF( j.EQ.k ) THEN
441  k = iwork( j )
442  ELSE IF( iwork( j ).EQ.k ) THEN
443  k = j
444  END IF
445  IF( j.LT.k ) THEN
446  j = j + 1
447  GO TO 100
448  END IF
449  ELSE
450  k = 0
451  END IF
452 *
453 * Check error code from SSYTRF and handle error.
454 *
455  IF( info.NE.k ) THEN
456  CALL alaerh( path, 'SSYTRF_AA_2STAGE', info, k,
457  \$ uplo, n, n, -1, -1, nb, imat, nfail,
458  \$ nerrs, nout )
459  END IF
460 *
461 *+ TEST 1
462 * Reconstruct matrix from factors and compute residual.
463 *
464 * CALL SSYT01_AA( UPLO, N, A, LDA, AFAC, LDA, IWORK,
465 * \$ AINV, LDA, RWORK, RESULT( 1 ) )
466 * NT = 1
467  nt = 0
468 *
469 *
470 * Print information about the tests that did not pass
471 * the threshold.
472 *
473  DO 110 k = 1, nt
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,
478  \$ result( k )
479  nfail = nfail + 1
480  END IF
481  110 CONTINUE
482  nrun = nrun + nt
483 *
484 * Skip solver test if INFO is not 0.
485 *
486  IF( info.NE.0 ) THEN
487  GO TO 140
488  END IF
489 *
490 * Do for each value of NRHS in NSVAL.
491 *
492  DO 130 irhs = 1, nns
493  nrhs = nsval( irhs )
494 *
495 *+ TEST 2 (Using TRS)
496 * Solve and compute residual for A * X = B.
497 *
498 * Choose a set of NRHS random solution vectors
499 * stored in XACT and set up the right hand side B
500 *
501  srnamt = 'SLARHS'
502  CALL slarhs( matpath, xtype, uplo, ' ', n, n,
503  \$ kl, ku, nrhs, a, lda, xact, lda,
504  \$ b, lda, iseed, info )
505  CALL slacpy( 'Full', n, nrhs, b, lda, x, lda )
506 *
507  srnamt = 'SSYTRS_AA_2STAGE'
508  lwork = max( 1, 3*n-2 )
509  CALL ssytrs_aa_2stage( uplo, n, nrhs, afac, lda,
510  \$ ainv, (3*nb+1)*n, iwork, iwork( 1+n ),
511  \$ x, lda, info )
512 *
513 * Check error code from SSYTRS and handle error.
514 *
515  IF( info.NE.0 ) THEN
516  IF( izero.EQ.0 ) THEN
517  CALL alaerh( path, 'SSYTRS_AA_2STAGE',
518  \$ info, 0, uplo, n, n, -1, -1,
519  \$ nrhs, imat, nfail, nerrs, nout )
520  END IF
521  ELSE
522  CALL slacpy( 'Full', n, nrhs, b, lda, work, lda
523  \$ )
524 *
525 * Compute the residual for the solution
526 *
527  CALL spot02( uplo, n, nrhs, a, lda, x, lda,
528  \$ work, lda, rwork, result( 2 ) )
529 *
530 *
531 * Print information about the tests that did not pass
532 * the threshold.
533 *
534  DO 120 k = 2, 2
535  IF( result( k ).GE.thresh ) THEN
536  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
537  \$ CALL alahd( nout, path )
538  WRITE( nout, fmt = 9998 )uplo, n, nrhs,
539  \$ imat, k, result( k )
540  nfail = nfail + 1
541  END IF
542  120 CONTINUE
543  END IF
544  nrun = nrun + 1
545 *
546 * End do for each value of NRHS in NSVAL.
547 *
548  130 CONTINUE
549  140 CONTINUE
550  150 CONTINUE
551  160 CONTINUE
552  170 CONTINUE
553  180 CONTINUE
554 *
555 * Print a summary of the results.
556 *
557  CALL alasum( path, nout, nfail, nrun, nerrs )
558 *
559  9999 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NB =', i4, ', type ',
560  \$ i2, ', test ', i2, ', ratio =', g12.5 )
561  9998 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NRHS=', i3, ', type ',
562  \$ i2, ', test(', i2, ') =', g12.5 )
563  9995 FORMAT( ' Invalid input value: ', a4, '=', i6, '; must be <=',
564  \$ i6 )
565  RETURN
566 *
567 * End of SCHKSY_AA_2STAGE
568 *
569  END
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.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 slatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
SLATMS
Definition: slatms.f:321
subroutine ssytrs_aa_2stage(UPLO, N, NRHS, A, LDA, TB, LTB, IPIV, IPIV2, B, LDB, INFO)
SSYTRS_AA_2STAGE
subroutine ssytrf_aa_2stage(UPLO, N, A, LDA, TB, LTB, IPIV, IPIV2, WORK, LWORK, INFO)
SSYTRF_AA_2STAGE
subroutine slarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
SLARHS
Definition: slarhs.f:205
subroutine slatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
SLATB4
Definition: slatb4.f:120
subroutine serrsy(PATH, NUNIT)
SERRSY
Definition: serrsy.f:55
subroutine spot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
SPOT02
Definition: spot02.f:127
subroutine schksy_aa_2stage(DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
SCHKSY_AA_2STAGE
subroutine ssyt01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
SSYT01_AA
Definition: ssyt01_aa.f:124