LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
sdrvsy_aa.f
Go to the documentation of this file.
1 *> \brief \b SDRVSY_AA
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 SDRVSY_AA( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
12 * A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
13 * NOUT )
14 *
15 * .. Scalar Arguments ..
16 * LOGICAL TSTERR
17 * INTEGER NMAX, NN, NOUT, NRHS
18 * REAL THRESH
19 * ..
20 * .. Array Arguments ..
21 * LOGICAL DOTYPE( * )
22 * INTEGER IWORK( * ), NVAL( * )
23 * REAL A( * ), AFAC( * ), AINV( * ), B( * ),
24 * $ RWORK( * ), WORK( * ), X( * ), XACT( * )
25 * ..
26 *
27 *
28 *> \par Purpose:
29 * =============
30 *>
31 *> \verbatim
32 *>
33 *> SDRVSY_AA tests the driver routine SSYSV_AA.
34 *> \endverbatim
35 *
36 * Arguments:
37 * ==========
38 *
39 *> \param[in] DOTYPE
40 *> \verbatim
41 *> DOTYPE is LOGICAL array, dimension (NTYPES)
42 *> The matrix types to be used for testing. Matrices of type j
43 *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
44 *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
45 *> \endverbatim
46 *>
47 *> \param[in] NN
48 *> \verbatim
49 *> NN is INTEGER
50 *> The number of values of N contained in the vector NVAL.
51 *> \endverbatim
52 *>
53 *> \param[in] NVAL
54 *> \verbatim
55 *> NVAL is INTEGER array, dimension (NN)
56 *> The values of the matrix dimension N.
57 *> \endverbatim
58 *>
59 *> \param[in] NRHS
60 *> \verbatim
61 *> NRHS is INTEGER
62 *> The number of right hand side vectors to be generated for
63 *> each linear system.
64 *> \endverbatim
65 *>
66 *> \param[in] THRESH
67 *> \verbatim
68 *> THRESH is REAL
69 *> The threshold value for the test ratios. A result is
70 *> included in the output file if RESULT >= THRESH. To have
71 *> every test ratio printed, use THRESH = 0.
72 *> \endverbatim
73 *>
74 *> \param[in] TSTERR
75 *> \verbatim
76 *> TSTERR is LOGICAL
77 *> Flag that indicates whether error exits are to be tested.
78 *> \endverbatim
79 *>
80 *> \param[in] NMAX
81 *> \verbatim
82 *> NMAX is INTEGER
83 *> The maximum value permitted for N, used in dimensioning the
84 *> work arrays.
85 *> \endverbatim
86 *>
87 *> \param[out] A
88 *> \verbatim
89 *> A is REAL array, dimension (NMAX*NMAX)
90 *> \endverbatim
91 *>
92 *> \param[out] AFAC
93 *> \verbatim
94 *> AFAC is REAL array, dimension (NMAX*NMAX)
95 *> \endverbatim
96 *>
97 *> \param[out] AINV
98 *> \verbatim
99 *> AINV is REAL array, dimension (NMAX*NMAX)
100 *> \endverbatim
101 *>
102 *> \param[out] B
103 *> \verbatim
104 *> B is REAL array, dimension (NMAX*NRHS)
105 *> \endverbatim
106 *>
107 *> \param[out] X
108 *> \verbatim
109 *> X is REAL array, dimension (NMAX*NRHS)
110 *> \endverbatim
111 *>
112 *> \param[out] XACT
113 *> \verbatim
114 *> XACT is REAL array, dimension (NMAX*NRHS)
115 *> \endverbatim
116 *>
117 *> \param[out] WORK
118 *> \verbatim
119 *> WORK is REAL array, dimension (NMAX*max(2,NRHS))
120 *> \endverbatim
121 *>
122 *> \param[out] RWORK
123 *> \verbatim
124 *> RWORK is REAL array, dimension (NMAX+2*NRHS)
125 *> \endverbatim
126 *>
127 *> \param[out] IWORK
128 *> \verbatim
129 *> IWORK is INTEGER array, dimension (2*NMAX)
130 *> \endverbatim
131 *>
132 *> \param[in] NOUT
133 *> \verbatim
134 *> NOUT is INTEGER
135 *> The unit number for output.
136 *> \endverbatim
137 *
138 * Authors:
139 * ========
140 *
141 *> \author Univ. of Tennessee
142 *> \author Univ. of California Berkeley
143 *> \author Univ. of Colorado Denver
144 *> \author NAG Ltd.
145 *
146 *> \date November 2017
147 *
148 *> \ingroup real_lin
149 *
150 * =====================================================================
151  SUBROUTINE sdrvsy_aa( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR,
152  $ NMAX, A, AFAC, AINV, B, X, XACT, WORK,
153  $ RWORK, IWORK, NOUT )
154 *
155 * -- LAPACK test routine (version 3.8.0) --
156 * -- LAPACK is a software package provided by Univ. of Tennessee, --
157 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
158 * November 2017
159 *
160 * .. Scalar Arguments ..
161  LOGICAL TSTERR
162  INTEGER NMAX, NN, NOUT, NRHS
163  REAL THRESH
164 * ..
165 * .. Array Arguments ..
166  LOGICAL DOTYPE( * )
167  INTEGER IWORK( * ), NVAL( * )
168  REAL A( * ), AFAC( * ), AINV( * ), B( * ),
169  $ rwork( * ), work( * ), x( * ), xact( * )
170 * ..
171 *
172 * =====================================================================
173 *
174 * .. Parameters ..
175  REAL ONE, ZERO
176  parameter( one = 1.0e+0, zero = 0.0e+0 )
177  INTEGER NTYPES, NTESTS
178  parameter( ntypes = 10, ntests = 3 )
179  INTEGER NFACT
180  parameter( nfact = 2 )
181 * ..
182 * .. Local Scalars ..
183  LOGICAL ZEROT
184  CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
185  CHARACTER*3 MATPATH, PATH
186  INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
187  $ izero, j, k, kl, ku, lda, lwork, mode, n,
188  $ nb, nbmin, nerrs, nfail, nimat, nrun, nt
189  REAL ANORM, CNDNUM
190 * ..
191 * .. Local Arrays ..
192  CHARACTER FACTS( nfact ), UPLOS( 2 )
193  INTEGER ISEED( 4 ), ISEEDY( 4 )
194  REAL RESULT( ntests )
195 * ..
196 * .. External Functions ..
197  REAL DGET06, SLANSY
198  EXTERNAL dget06, slansy
199 * ..
200 * .. External Subroutines ..
201  EXTERNAL aladhd, alaerh, alasvm, serrvx, sget04, slacpy,
204 * ..
205 * .. Scalars in Common ..
206  LOGICAL LERR, OK
207  CHARACTER*32 SRNAMT
208  INTEGER INFOT, NUNIT
209 * ..
210 * .. Common blocks ..
211  COMMON / infoc / infot, nunit, ok, lerr
212  COMMON / srnamc / srnamt
213 * ..
214 * .. Intrinsic Functions ..
215  INTRINSIC max, min
216 * ..
217 * .. Data statements ..
218  DATA iseedy / 1988, 1989, 1990, 1991 /
219  DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
220 * ..
221 * .. Executable Statements ..
222 *
223 * Initialize constants and the random number seed.
224 *
225 * Test path
226 *
227  path( 1: 1 ) = 'Single precision'
228  path( 2: 3 ) = 'SA'
229 *
230 * Path to generate matrices
231 *
232  matpath( 1: 1 ) = 'Single precision'
233  matpath( 2: 3 ) = 'SY'
234 *
235  nrun = 0
236  nfail = 0
237  nerrs = 0
238  DO 10 i = 1, 4
239  iseed( i ) = iseedy( i )
240  10 CONTINUE
241 *
242 * Test the error exits
243 *
244  IF( tsterr )
245  $ CALL serrvx( path, nout )
246  infot = 0
247 *
248 * Set the block size and minimum block size for testing.
249 *
250  nb = 1
251  nbmin = 2
252  CALL xlaenv( 1, nb )
253  CALL xlaenv( 2, nbmin )
254 *
255 * Do for each value of N in NVAL
256 *
257  DO 180 in = 1, nn
258  n = nval( in )
259  lwork = max( 3*n-2, n*(1+nb) )
260  lwork = max( lwork, 1 )
261  lda = max( n, 1 )
262  xtype = 'N'
263  nimat = ntypes
264  IF( n.LE.0 )
265  $ nimat = 1
266 *
267  DO 170 imat = 1, nimat
268 *
269 * Do the tests only if DOTYPE( IMAT ) is true.
270 *
271  IF( .NOT.dotype( imat ) )
272  $ GO TO 170
273 *
274 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
275 *
276  zerot = imat.GE.3 .AND. imat.LE.6
277  IF( zerot .AND. n.LT.imat-2 )
278  $ GO TO 170
279 *
280 * Do first for UPLO = 'U', then for UPLO = 'L'
281 *
282  DO 160 iuplo = 1, 2
283  uplo = uplos( iuplo )
284 *
285 * Set up parameters with SLATB4 and generate a test matrix
286 * with SLATMS.
287 *
288  CALL slatb4( matpath, imat, n, n, TYPE, KL, KU, ANORM,
289  $ mode, cndnum, dist )
290 *
291  srnamt = 'SLATMS'
292  CALL slatms( n, n, dist, iseed, TYPE, RWORK, MODE,
293  $ cndnum, anorm, kl, ku, uplo, a, lda, work,
294  $ info )
295 *
296 * Check error code from SLATMS.
297 *
298  IF( info.NE.0 ) THEN
299  CALL alaerh( path, 'SLATMS', info, 0, uplo, n, n, -1,
300  $ -1, -1, imat, nfail, nerrs, nout )
301  GO TO 160
302  END IF
303 *
304 * For types 3-6, zero one or more rows and columns of the
305 * matrix to test that INFO is returned correctly.
306 *
307  IF( zerot ) THEN
308  IF( imat.EQ.3 ) THEN
309  izero = 1
310  ELSE IF( imat.EQ.4 ) THEN
311  izero = n
312  ELSE
313  izero = n / 2 + 1
314  END IF
315 *
316  IF( imat.LT.6 ) THEN
317 *
318 * Set row and column IZERO to zero.
319 *
320  IF( iuplo.EQ.1 ) THEN
321  ioff = ( izero-1 )*lda
322  DO 20 i = 1, izero - 1
323  a( ioff+i ) = zero
324  20 CONTINUE
325  ioff = ioff + izero
326  DO 30 i = izero, n
327  a( ioff ) = zero
328  ioff = ioff + lda
329  30 CONTINUE
330  ELSE
331  ioff = izero
332  DO 40 i = 1, izero - 1
333  a( ioff ) = zero
334  ioff = ioff + lda
335  40 CONTINUE
336  ioff = ioff - izero
337  DO 50 i = izero, n
338  a( ioff+i ) = zero
339  50 CONTINUE
340  END IF
341  ELSE
342  ioff = 0
343  IF( iuplo.EQ.1 ) THEN
344 *
345 * Set the first IZERO rows and columns to zero.
346 *
347  DO 70 j = 1, n
348  i2 = min( j, izero )
349  DO 60 i = 1, i2
350  a( ioff+i ) = zero
351  60 CONTINUE
352  ioff = ioff + lda
353  70 CONTINUE
354  izero = 1
355  ELSE
356 *
357 * Set the last IZERO rows and columns to zero.
358 *
359  DO 90 j = 1, n
360  i1 = max( j, izero )
361  DO 80 i = i1, n
362  a( ioff+i ) = zero
363  80 CONTINUE
364  ioff = ioff + lda
365  90 CONTINUE
366  END IF
367  END IF
368  ELSE
369  izero = 0
370  END IF
371 *
372  DO 150 ifact = 1, nfact
373 *
374 * Do first for FACT = 'F', then for other values.
375 *
376  fact = facts( ifact )
377 *
378 * Form an exact solution and set the right hand side.
379 *
380  srnamt = 'SLARHS'
381  CALL slarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
382  $ nrhs, a, lda, xact, lda, b, lda, iseed,
383  $ info )
384  xtype = 'C'
385 *
386 * --- Test SSYSV_AA ---
387 *
388  IF( ifact.EQ.2 ) THEN
389  CALL slacpy( uplo, n, n, a, lda, afac, lda )
390  CALL slacpy( 'Full', n, nrhs, b, lda, x, lda )
391 *
392 * Factor the matrix and solve the system using SSYSV_AA.
393 *
394  srnamt = 'SSYSV_AA'
395  CALL ssysv_aa( uplo, n, nrhs, afac, lda, iwork,
396  $ x, lda, work, lwork, info )
397 *
398 * Adjust the expected value of INFO to account for
399 * pivoting.
400 *
401  IF( izero.GT.0 ) THEN
402  j = 1
403  k = izero
404  100 CONTINUE
405  IF( j.EQ.k ) THEN
406  k = iwork( j )
407  ELSE IF( iwork( j ).EQ.k ) THEN
408  k = j
409  END IF
410  IF( j.LT.k ) THEN
411  j = j + 1
412  GO TO 100
413  END IF
414  ELSE
415  k = 0
416  END IF
417 *
418 * Check error code from SSYSV_AA .
419 *
420  IF( info.NE.k ) THEN
421  CALL alaerh( path, 'SSYSV_AA ', info, k,
422  $ uplo, n, n, -1, -1, nrhs,
423  $ imat, nfail, nerrs, nout )
424  GO TO 120
425  ELSE IF( info.NE.0 ) THEN
426  GO TO 120
427  END IF
428 *
429 * Reconstruct matrix from factors and compute
430 * residual.
431 *
432  CALL ssyt01_aa( uplo, n, a, lda, afac, lda,
433  $ iwork, ainv, lda, rwork,
434  $ result( 1 ) )
435 *
436 * Compute residual of the computed solution.
437 *
438  CALL slacpy( 'Full', n, nrhs, b, lda, work, lda )
439  CALL spot02( uplo, n, nrhs, a, lda, x, lda, work,
440  $ lda, rwork, result( 2 ) )
441  nt = 2
442 *
443 * Print information about the tests that did not pass
444 * the threshold.
445 *
446  DO 110 k = 1, nt
447  IF( result( k ).GE.thresh ) THEN
448  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
449  $ CALL aladhd( nout, path )
450  WRITE( nout, fmt = 9999 )'SSYSV_AA ',
451  $ uplo, n, imat, k, result( k )
452  nfail = nfail + 1
453  END IF
454  110 CONTINUE
455  nrun = nrun + nt
456  120 CONTINUE
457  END IF
458 *
459  150 CONTINUE
460 *
461  160 CONTINUE
462  170 CONTINUE
463  180 CONTINUE
464 *
465 * Print a summary of the results.
466 *
467  CALL alasvm( path, nout, nfail, nrun, nerrs )
468 *
469  9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
470  $ ', test ', i2, ', ratio =', g12.5 )
471  RETURN
472 *
473 * End of SDRVSY_AA
474 *
475  END
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:75
subroutine ssytrf_aa(UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
SSYTRF_AA
Definition: ssytrf_aa.f:134
subroutine spot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
SPOT02
Definition: spot02.f:129
subroutine ssyt01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
SSYT01_AA
Definition: ssyt01_aa.f:127
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:149
subroutine slatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
SLATB4
Definition: slatb4.f:122
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:83
subroutine sdrvsy_aa(DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
SDRVSY_AA
Definition: sdrvsy_aa.f:154
subroutine slatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
SLATMS
Definition: slatms.f:323
subroutine sget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
SGET04
Definition: sget04.f:104
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: slaset.f:112
subroutine aladhd(IOUNIT, PATH)
ALADHD
Definition: aladhd.f:92
subroutine serrvx(PATH, NUNIT)
SERRVX
Definition: serrvx.f:57
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:105
subroutine slarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
SLARHS
Definition: slarhs.f:206
subroutine ssysv_aa(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
SSYSV_AA computes the solution to system of linear equations A * X = B for SY matrices ...
Definition: ssysv_aa.f:164