LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ cdrvsy_rk()

subroutine cdrvsy_rk ( logical, dimension( * )  DOTYPE,
integer  NN,
integer, dimension( * )  NVAL,
integer  NRHS,
real  THRESH,
logical  TSTERR,
integer  NMAX,
complex, dimension( * )  A,
complex, dimension( * )  AFAC,
complex, dimension( * )  E,
complex, dimension( * )  AINV,
complex, dimension( * )  B,
complex, dimension( * )  X,
complex, dimension( * )  XACT,
complex, dimension( * )  WORK,
real, dimension( * )  RWORK,
integer, dimension( * )  IWORK,
integer  NOUT 
)

CDRVSY_RK

Purpose:
 CDRVSY_RK tests the driver routines CSYSV_RK.
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]NRHS
          NRHS is INTEGER
          The number of right hand side vectors to be generated for
          each linear system.
[in]THRESH
          THRESH is REAL
          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 array, dimension (NMAX*NMAX)
[out]AFAC
          AFAC is COMPLEX array, dimension (NMAX*NMAX)
[out]E
          E is COMPLEX array, dimension (NMAX)
[out]AINV
          AINV is COMPLEX array, dimension (NMAX*NMAX)
[out]B
          B is COMPLEX array, dimension (NMAX*NRHS)
[out]X
          X is COMPLEX array, dimension (NMAX*NRHS)
[out]XACT
          XACT is COMPLEX array, dimension (NMAX*NRHS)
[out]WORK
 
[out]RWORK
          RWORK is REAL array, dimension (NMAX+2*NRHS)
[out]IWORK
          IWORK is INTEGER array, dimension (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 154 of file cdrvsy_rk.f.

157 *
158 * -- LAPACK test routine --
159 * -- LAPACK is a software package provided by Univ. of Tennessee, --
160 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161 *
162 * .. Scalar Arguments ..
163  LOGICAL TSTERR
164  INTEGER NMAX, NN, NOUT, NRHS
165  REAL THRESH
166 * ..
167 * .. Array Arguments ..
168  LOGICAL DOTYPE( * )
169  INTEGER IWORK( * ), NVAL( * )
170  REAL RWORK( * )
171  COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ), E( * ),
172  $ WORK( * ), X( * ), XACT( * )
173 * ..
174 *
175 * =====================================================================
176 *
177 * .. Parameters ..
178  REAL ONE, ZERO
179  parameter( one = 1.0e+0, zero = 0.0e+0 )
180  INTEGER NTYPES, NTESTS
181  parameter( ntypes = 11, ntests = 3 )
182  INTEGER NFACT
183  parameter( nfact = 2 )
184 * ..
185 * .. Local Scalars ..
186  LOGICAL ZEROT
187  CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
188  CHARACTER*3 MATPATH, PATH
189  INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
190  $ IZERO, J, K, KL, KU, LDA, LWORK, MODE, N,
191  $ NB, NBMIN, NERRS, NFAIL, NIMAT, NRUN, NT
192  REAL AINVNM, ANORM, CNDNUM, RCONDC
193 * ..
194 * .. Local Arrays ..
195  CHARACTER FACTS( NFACT ), UPLOS( 2 )
196  INTEGER ISEED( 4 ), ISEEDY( 4 )
197  REAL RESULT( NTESTS )
198 
199 * ..
200 * .. External Functions ..
201  REAL CLANSY
202  EXTERNAL clansy
203 * ..
204 * .. External Subroutines ..
205  EXTERNAL aladhd, alaerh, alasvm, xlaenv, cerrvx, cget04,
208 * ..
209 * .. Scalars in Common ..
210  LOGICAL LERR, OK
211  CHARACTER*32 SRNAMT
212  INTEGER INFOT, NUNIT
213 * ..
214 * .. Common blocks ..
215  COMMON / infoc / infot, nunit, ok, lerr
216  COMMON / srnamc / srnamt
217 * ..
218 * .. Intrinsic Functions ..
219  INTRINSIC max, min
220 * ..
221 * .. Data statements ..
222  DATA iseedy / 1988, 1989, 1990, 1991 /
223  DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
224 * ..
225 * .. Executable Statements ..
226 *
227 * Initialize constants and the random number seed.
228 *
229 * Test path
230 *
231  path( 1: 1 ) = 'Complex precision'
232  path( 2: 3 ) = 'SK'
233 *
234 * Path to generate matrices
235 *
236  matpath( 1: 1 ) = 'Complex precision'
237  matpath( 2: 3 ) = 'SY'
238 *
239  nrun = 0
240  nfail = 0
241  nerrs = 0
242  DO 10 i = 1, 4
243  iseed( i ) = iseedy( i )
244  10 CONTINUE
245  lwork = max( 2*nmax, nmax*nrhs )
246 *
247 * Test the error exits
248 *
249  IF( tsterr )
250  $ CALL cerrvx( path, nout )
251  infot = 0
252 *
253 * Set the block size and minimum block size for which the block
254 * routine should be used, which will be later returned by ILAENV.
255 *
256  nb = 1
257  nbmin = 2
258  CALL xlaenv( 1, nb )
259  CALL xlaenv( 2, nbmin )
260 *
261 * Do for each value of N in NVAL
262 *
263  DO 180 in = 1, nn
264  n = nval( in )
265  lda = max( n, 1 )
266  xtype = 'N'
267  nimat = ntypes
268  IF( n.LE.0 )
269  $ nimat = 1
270 *
271  DO 170 imat = 1, nimat
272 *
273 * Do the tests only if DOTYPE( IMAT ) is true.
274 *
275  IF( .NOT.dotype( imat ) )
276  $ GO TO 170
277 *
278 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
279 *
280  zerot = imat.GE.3 .AND. imat.LE.6
281  IF( zerot .AND. n.LT.imat-2 )
282  $ GO TO 170
283 *
284 * Do first for UPLO = 'U', then for UPLO = 'L'
285 *
286  DO 160 iuplo = 1, 2
287  uplo = uplos( iuplo )
288 *
289  IF( imat.NE.ntypes ) THEN
290 *
291 * Begin generate the test matrix A.
292 *
293 * Set up parameters with CLATB4 for the matrix generator
294 * based on the type of matrix to be generated.
295 *
296  CALL clatb4( matpath, imat, n, n, TYPE, KL, KU, ANORM,
297  $ MODE, CNDNUM, DIST )
298 *
299 * Generate a matrix with CLATMS.
300 *
301  srnamt = 'CLATMS'
302  CALL clatms( n, n, dist, iseed, TYPE, RWORK, MODE,
303  $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA,
304  $ WORK, INFO )
305 *
306 * Check error code from CLATMS and handle error.
307 *
308  IF( info.NE.0 ) THEN
309  CALL alaerh( path, 'CLATMS', info, 0, uplo, n, n,
310  $ -1, -1, -1, imat, nfail, nerrs, nout )
311  GO TO 160
312  END IF
313 *
314 * For types 3-6, zero one or more rows and columns of
315 * the matrix to test that INFO is returned correctly.
316 *
317  IF( zerot ) THEN
318  IF( imat.EQ.3 ) THEN
319  izero = 1
320  ELSE IF( imat.EQ.4 ) THEN
321  izero = n
322  ELSE
323  izero = n / 2 + 1
324  END IF
325 *
326  IF( imat.LT.6 ) THEN
327 *
328 * Set row and column IZERO to zero.
329 *
330  IF( iuplo.EQ.1 ) THEN
331  ioff = ( izero-1 )*lda
332  DO 20 i = 1, izero - 1
333  a( ioff+i ) = zero
334  20 CONTINUE
335  ioff = ioff + izero
336  DO 30 i = izero, n
337  a( ioff ) = zero
338  ioff = ioff + lda
339  30 CONTINUE
340  ELSE
341  ioff = izero
342  DO 40 i = 1, izero - 1
343  a( ioff ) = zero
344  ioff = ioff + lda
345  40 CONTINUE
346  ioff = ioff - izero
347  DO 50 i = izero, n
348  a( ioff+i ) = zero
349  50 CONTINUE
350  END IF
351  ELSE
352  IF( iuplo.EQ.1 ) THEN
353 *
354 * Set the first IZERO rows and columns to zero.
355 *
356  ioff = 0
357  DO 70 j = 1, n
358  i2 = min( j, izero )
359  DO 60 i = 1, i2
360  a( ioff+i ) = zero
361  60 CONTINUE
362  ioff = ioff + lda
363  70 CONTINUE
364  ELSE
365 *
366 * Set the first IZERO rows and columns to zero.
367 *
368  ioff = 0
369  DO 90 j = 1, n
370  i1 = max( j, izero )
371  DO 80 i = i1, n
372  a( ioff+i ) = zero
373  80 CONTINUE
374  ioff = ioff + lda
375  90 CONTINUE
376  END IF
377  END IF
378  ELSE
379  izero = 0
380  END IF
381 *
382 * End generate the test matrix A.
383 *
384  ELSE
385 *
386 * IMAT = NTYPES: Use a special block diagonal matrix to
387 * test alternate code for the 2-by-2 blocks.
388 *
389  CALL clatsy( uplo, n, a, lda, iseed )
390  END IF
391 *
392  DO 150 ifact = 1, nfact
393 *
394 * Do first for FACT = 'F', then for other values.
395 *
396  fact = facts( ifact )
397 *
398 * Compute the condition number
399 *
400  IF( zerot ) THEN
401  IF( ifact.EQ.1 )
402  $ GO TO 150
403  rcondc = zero
404 *
405  ELSE IF( ifact.EQ.1 ) THEN
406 *
407 * Compute the 1-norm of A.
408 *
409  anorm = clansy( '1', uplo, n, a, lda, rwork )
410 *
411 * Factor the matrix A.
412 *
413 
414  CALL clacpy( uplo, n, n, a, lda, afac, lda )
415  CALL csytrf_rk( uplo, n, afac, lda, e, iwork, work,
416  $ lwork, info )
417 *
418 * Compute inv(A) and take its norm.
419 *
420  CALL clacpy( uplo, n, n, afac, lda, ainv, lda )
421  lwork = (n+nb+1)*(nb+3)
422 *
423 * We need to compute the inverse to compute
424 * RCONDC that is used later in TEST3.
425 *
426  CALL csytri_3( uplo, n, ainv, lda, e, iwork,
427  $ work, lwork, info )
428  ainvnm = clansy( '1', uplo, n, ainv, lda, rwork )
429 *
430 * Compute the 1-norm condition number of A.
431 *
432  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
433  rcondc = one
434  ELSE
435  rcondc = ( one / anorm ) / ainvnm
436  END IF
437  END IF
438 *
439 * Form an exact solution and set the right hand side.
440 *
441  srnamt = 'CLARHS'
442  CALL clarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
443  $ nrhs, a, lda, xact, lda, b, lda, iseed,
444  $ info )
445  xtype = 'C'
446 *
447 * --- Test CSYSV_RK ---
448 *
449  IF( ifact.EQ.2 ) THEN
450  CALL clacpy( uplo, n, n, a, lda, afac, lda )
451  CALL clacpy( 'Full', n, nrhs, b, lda, x, lda )
452 *
453 * Factor the matrix and solve the system using
454 * CSYSV_RK.
455 *
456  srnamt = 'CSYSV_RK'
457  CALL csysv_rk( uplo, n, nrhs, afac, lda, e, iwork,
458  $ x, lda, work, lwork, info )
459 *
460 * Adjust the expected value of INFO to account for
461 * pivoting.
462 *
463  k = izero
464  IF( k.GT.0 ) THEN
465  100 CONTINUE
466  IF( iwork( k ).LT.0 ) THEN
467  IF( iwork( k ).NE.-k ) THEN
468  k = -iwork( k )
469  GO TO 100
470  END IF
471  ELSE IF( iwork( k ).NE.k ) THEN
472  k = iwork( k )
473  GO TO 100
474  END IF
475  END IF
476 *
477 * Check error code from CSYSV_RK and handle error.
478 *
479  IF( info.NE.k ) THEN
480  CALL alaerh( path, 'CSYSV_RK', info, k, uplo,
481  $ n, n, -1, -1, nrhs, imat, nfail,
482  $ nerrs, nout )
483  GO TO 120
484  ELSE IF( info.NE.0 ) THEN
485  GO TO 120
486  END IF
487 *
488 *+ TEST 1 Reconstruct matrix from factors and compute
489 * residual.
490 *
491  CALL csyt01_3( uplo, n, a, lda, afac, lda, e,
492  $ iwork, ainv, lda, rwork,
493  $ result( 1 ) )
494 *
495 *+ TEST 2 Compute residual of the computed solution.
496 *
497  CALL clacpy( 'Full', n, nrhs, b, lda, work, lda )
498  CALL csyt02( uplo, n, nrhs, a, lda, x, lda, work,
499  $ lda, rwork, result( 2 ) )
500 *
501 *+ TEST 3
502 * Check solution from generated exact solution.
503 *
504  CALL cget04( n, nrhs, x, lda, xact, lda, rcondc,
505  $ result( 3 ) )
506  nt = 3
507 *
508 * Print information about the tests that did not pass
509 * the threshold.
510 *
511  DO 110 k = 1, nt
512  IF( result( k ).GE.thresh ) THEN
513  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
514  $ CALL aladhd( nout, path )
515  WRITE( nout, fmt = 9999 )'CSYSV_RK', uplo,
516  $ n, imat, k, result( k )
517  nfail = nfail + 1
518  END IF
519  110 CONTINUE
520  nrun = nrun + nt
521  120 CONTINUE
522  END IF
523 *
524  150 CONTINUE
525 *
526  160 CONTINUE
527  170 CONTINUE
528  180 CONTINUE
529 *
530 * Print a summary of the results.
531 *
532  CALL alasvm( path, nout, nfail, nrun, nerrs )
533 *
534  9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
535  $ ', test ', i2, ', ratio =', g12.5 )
536  RETURN
537 *
538 * End of CDRVSY_RK
539 *
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:73
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:81
subroutine aladhd(IOUNIT, PATH)
ALADHD
Definition: aladhd.f:90
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:147
subroutine clarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
CLARHS
Definition: clarhs.f:208
subroutine clatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
CLATB4
Definition: clatb4.f:121
subroutine cget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
CGET04
Definition: cget04.f:102
subroutine csyt01_3(UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C, LDC, RWORK, RESID)
CSYT01_3
Definition: csyt01_3.f:141
subroutine cerrvx(PATH, NUNIT)
CERRVX
Definition: cerrvx.f:55
subroutine csyt02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
CSYT02
Definition: csyt02.f:127
subroutine clatsy(UPLO, N, X, LDX, ISEED)
CLATSY
Definition: clatsy.f:89
subroutine clatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
CLATMS
Definition: clatms.f:332
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clansy.f:123
subroutine csytri_3(UPLO, N, A, LDA, E, IPIV, WORK, LWORK, INFO)
CSYTRI_3
Definition: csytri_3.f:170
subroutine csytrf_rk(UPLO, N, A, LDA, E, IPIV, WORK, LWORK, INFO)
CSYTRF_RK computes the factorization of a complex symmetric indefinite matrix using the bounded Bunch...
Definition: csytrf_rk.f:259
subroutine csysv_rk(UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB, WORK, LWORK, INFO)
CSYSV_RK computes the solution to system of linear equations A * X = B for SY matrices
Definition: csysv_rk.f:228
Here is the call graph for this function:
Here is the caller graph for this function: