/* Subroutine */ int zdrvpt_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, doublecomplex *a, doublereal *d__, doublecomplex *e, doublecomplex *b, doublecomplex *x, doublecomplex *xact, doublecomplex *work, doublereal *rwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 0,0,0,1 }; /* Format strings */ static char fmt_9999[] = "(1x,a6,\002, N =\002,i5,\002, type \002,i2," "\002, test \002,i2,\002, ratio = \002,g12.5)"; static char fmt_9998[] = "(1x,a6,\002, FACT='\002,a1,\002', N =\002,i5" ",\002, type \002,i2,\002, test \002,i2,\002, ratio = \002,g12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; doublereal d__1, d__2; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); double z_abs(doublecomplex *); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, j, k, n; doublereal z__[3]; integer k1, ia, in, kl, ku, ix, nt, lda; char fact[1]; doublereal cond; integer mode; doublereal dmax__; integer imat, info; char path[3], dist[1], type__[1]; integer nrun, ifact; extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, integer *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); doublereal rcond; integer nimat; doublereal anorm; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ), dcopy_(integer *, doublereal *, integer *, doublereal *, integer *); integer izero, nerrs; extern /* Subroutine */ int zptt01_(integer *, doublereal *, doublecomplex *, doublereal *, doublecomplex *, doublecomplex *, doublereal *); logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zptt02_(char *, integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *), zptt05_( integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *), zptsv_(integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, integer *, integer *), zlatb4_( char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *), alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); extern integer idamax_(integer *, doublereal *, integer *); doublereal rcondc; extern /* Subroutine */ int zdscal_(integer *, doublereal *, doublecomplex *, integer *), alasvm_(char *, integer *, integer *, integer *, integer *), dlarnv_(integer *, integer *, integer *, doublereal *); doublereal ainvnm; extern doublereal zlanht_(char *, integer *, doublereal *, doublecomplex * ); extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); extern doublereal dzasum_(integer *, doublecomplex *, integer *); extern /* Subroutine */ int zlaset_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *), zlaptm_(char *, integer *, integer *, doublereal *, doublereal *, doublecomplex *, doublecomplex *, integer *, doublereal *, doublecomplex *, integer *), zlatms_( integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *), zlarnv_(integer *, integer *, integer *, doublecomplex *); doublereal result[6]; extern /* Subroutine */ int zpttrf_(integer *, doublereal *, doublecomplex *, integer *), zerrvx_(char *, integer *), zpttrs_(char *, integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, integer *, integer *), zptsvx_(char *, integer *, integer *, doublereal *, doublecomplex *, doublereal * , doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *); /* Fortran I/O blocks */ static cilist io___35 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___38 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZDRVPT tests ZPTSV and -SVX. */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NRHS (input) INTEGER */ /* The number of right hand side vectors to be generated for */ /* each linear system. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* A (workspace) COMPLEX*16 array, dimension (NMAX*2) */ /* D (workspace) DOUBLE PRECISION array, dimension (NMAX*2) */ /* E (workspace) COMPLEX*16 array, dimension (NMAX*2) */ /* B (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* X (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* WORK (workspace) COMPLEX*16 array, dimension */ /* (NMAX*max(3,NRHS)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --rwork; --work; --xact; --x; --b; --e; --d__; --a; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "PT", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrvx_(path, nout); } infoc_1.infot = 0; i__1 = *nn; for (in = 1; in <= i__1; ++in) { /* Do for each value of N in NVAL. */ n = nval[in]; lda = max(1,n); nimat = 12; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (n > 0 && ! dotype[imat]) { goto L110; } /* Set up parameters with ZLATB4. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, & cond, dist); zerot = imat >= 8 && imat <= 10; if (imat <= 6) { /* Type 1-6: generate a symmetric tridiagonal matrix of */ /* known condition number in lower triangular band storage. */ s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond, &anorm, &kl, &ku, "B", &a[1], &c__2, &work[1], &info); /* Check the error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, " ", &n, &n, &kl, & ku, &c_n1, &imat, &nfail, &nerrs, nout); goto L110; } izero = 0; /* Copy the matrix to D and E. */ ia = 1; i__3 = n - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = i__; i__5 = ia; d__[i__4] = a[i__5].r; i__4 = i__; i__5 = ia + 1; e[i__4].r = a[i__5].r, e[i__4].i = a[i__5].i; ia += 2; /* L20: */ } if (n > 0) { i__3 = n; i__4 = ia; d__[i__3] = a[i__4].r; } } else { /* Type 7-12: generate a diagonally dominant matrix with */ /* unknown condition number in the vectors D and E. */ if (! zerot || ! dotype[7]) { /* Let D and E have values from [-1,1]. */ dlarnv_(&c__2, iseed, &n, &d__[1]); i__3 = n - 1; zlarnv_(&c__2, iseed, &i__3, &e[1]); /* Make the tridiagonal matrix diagonally dominant. */ if (n == 1) { d__[1] = abs(d__[1]); } else { d__[1] = abs(d__[1]) + z_abs(&e[1]); d__[n] = (d__1 = d__[n], abs(d__1)) + z_abs(&e[n - 1]) ; i__3 = n - 1; for (i__ = 2; i__ <= i__3; ++i__) { d__[i__] = (d__1 = d__[i__], abs(d__1)) + z_abs(& e[i__]) + z_abs(&e[i__ - 1]); /* L30: */ } } /* Scale D and E so the maximum element is ANORM. */ ix = idamax_(&n, &d__[1], &c__1); dmax__ = d__[ix]; d__1 = anorm / dmax__; dscal_(&n, &d__1, &d__[1], &c__1); if (n > 1) { i__3 = n - 1; d__1 = anorm / dmax__; zdscal_(&i__3, &d__1, &e[1], &c__1); } } else if (izero > 0) { /* Reuse the last matrix by copying back the zeroed out */ /* elements. */ if (izero == 1) { d__[1] = z__[1]; if (n > 1) { e[1].r = z__[2], e[1].i = 0.; } } else if (izero == n) { i__3 = n - 1; e[i__3].r = z__[0], e[i__3].i = 0.; d__[n] = z__[1]; } else { i__3 = izero - 1; e[i__3].r = z__[0], e[i__3].i = 0.; d__[izero] = z__[1]; i__3 = izero; e[i__3].r = z__[2], e[i__3].i = 0.; } } /* For types 8-10, set one row and column of the matrix to */ /* zero. */ izero = 0; if (imat == 8) { izero = 1; z__[1] = d__[1]; d__[1] = 0.; if (n > 1) { z__[2] = e[1].r; e[1].r = 0., e[1].i = 0.; } } else if (imat == 9) { izero = n; if (n > 1) { i__3 = n - 1; z__[0] = e[i__3].r; i__3 = n - 1; e[i__3].r = 0., e[i__3].i = 0.; } z__[1] = d__[n]; d__[n] = 0.; } else if (imat == 10) { izero = (n + 1) / 2; if (izero > 1) { i__3 = izero - 1; z__[0] = e[i__3].r; i__3 = izero - 1; e[i__3].r = 0., e[i__3].i = 0.; i__3 = izero; z__[2] = e[i__3].r; i__3 = izero; e[i__3].r = 0., e[i__3].i = 0.; } z__[1] = d__[izero]; d__[izero] = 0.; } } /* Generate NRHS random solution vectors. */ ix = 1; i__3 = *nrhs; for (j = 1; j <= i__3; ++j) { zlarnv_(&c__2, iseed, &n, &xact[ix]); ix += lda; /* L40: */ } /* Set the right hand side. */ zlaptm_("Lower", &n, nrhs, &c_b24, &d__[1], &e[1], &xact[1], &lda, &c_b25, &b[1], &lda); for (ifact = 1; ifact <= 2; ++ifact) { if (ifact == 1) { *(unsigned char *)fact = 'F'; } else { *(unsigned char *)fact = 'N'; } /* Compute the condition number for comparison with */ /* the value returned by ZPTSVX. */ if (zerot) { if (ifact == 1) { goto L100; } rcondc = 0.; } else if (ifact == 1) { /* Compute the 1-norm of A. */ anorm = zlanht_("1", &n, &d__[1], &e[1]); dcopy_(&n, &d__[1], &c__1, &d__[n + 1], &c__1); if (n > 1) { i__3 = n - 1; zcopy_(&i__3, &e[1], &c__1, &e[n + 1], &c__1); } /* Factor the matrix A. */ zpttrf_(&n, &d__[n + 1], &e[n + 1], &info); /* Use ZPTTRS to solve for one column at a time of */ /* inv(A), computing the maximum column sum as we go. */ ainvnm = 0.; i__3 = n; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = n; for (j = 1; j <= i__4; ++j) { i__5 = j; x[i__5].r = 0., x[i__5].i = 0.; /* L50: */ } i__4 = i__; x[i__4].r = 1., x[i__4].i = 0.; zpttrs_("Lower", &n, &c__1, &d__[n + 1], &e[n + 1], & x[1], &lda, &info); /* Computing MAX */ d__1 = ainvnm, d__2 = dzasum_(&n, &x[1], &c__1); ainvnm = max(d__1,d__2); /* L60: */ } /* Compute the 1-norm condition number of A. */ if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } } if (ifact == 2) { /* --- Test ZPTSV -- */ dcopy_(&n, &d__[1], &c__1, &d__[n + 1], &c__1); if (n > 1) { i__3 = n - 1; zcopy_(&i__3, &e[1], &c__1, &e[n + 1], &c__1); } zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda); /* Factor A as L*D*L' and solve the system A*X = B. */ s_copy(srnamc_1.srnamt, "ZPTSV ", (ftnlen)6, (ftnlen)6); zptsv_(&n, nrhs, &d__[n + 1], &e[n + 1], &x[1], &lda, & info); /* Check error code from ZPTSV . */ if (info != izero) { alaerh_(path, "ZPTSV ", &info, &izero, " ", &n, &n, & c__1, &c__1, nrhs, &imat, &nfail, &nerrs, nout); } nt = 0; if (izero == 0) { /* Check the factorization by computing the ratio */ /* norm(L*D*L' - A) / (n * norm(A) * EPS ) */ zptt01_(&n, &d__[1], &e[1], &d__[n + 1], &e[n + 1], & work[1], result); /* Compute the residual in the solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); zptt02_("Lower", &n, nrhs, &d__[1], &e[1], &x[1], & lda, &work[1], &lda, &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); nt = 3; } /* Print information about the tests that did not pass */ /* the threshold. */ i__3 = nt; for (k = 1; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___35.ciunit = *nout; s_wsfe(&io___35); do_fio(&c__1, "ZPTSV ", (ftnlen)6); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L70: */ } nrun += nt; } /* --- Test ZPTSVX --- */ if (ifact > 1) { /* Initialize D( N+1:2*N ) and E( N+1:2*N ) to zero. */ i__3 = n - 1; for (i__ = 1; i__ <= i__3; ++i__) { d__[n + i__] = 0.; i__4 = n + i__; e[i__4].r = 0., e[i__4].i = 0.; /* L80: */ } if (n > 0) { d__[n + n] = 0.; } } zlaset_("Full", &n, nrhs, &c_b62, &c_b62, &x[1], &lda); /* Solve the system and compute the condition number and */ /* error bounds using ZPTSVX. */ s_copy(srnamc_1.srnamt, "ZPTSVX", (ftnlen)6, (ftnlen)6); zptsvx_(fact, &n, nrhs, &d__[1], &e[1], &d__[n + 1], &e[n + 1] , &b[1], &lda, &x[1], &lda, &rcond, &rwork[1], &rwork[ *nrhs + 1], &work[1], &rwork[(*nrhs << 1) + 1], &info); /* Check the error code from ZPTSVX. */ if (info != izero) { alaerh_(path, "ZPTSVX", &info, &izero, fact, &n, &n, & c__1, &c__1, nrhs, &imat, &nfail, &nerrs, nout); } if (izero == 0) { if (ifact == 2) { /* Check the factorization by computing the ratio */ /* norm(L*D*L' - A) / (n * norm(A) * EPS ) */ k1 = 1; zptt01_(&n, &d__[1], &e[1], &d__[n + 1], &e[n + 1], & work[1], result); } else { k1 = 2; } /* Compute the residual in the solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); zptt02_("Lower", &n, nrhs, &d__[1], &e[1], &x[1], &lda, & work[1], &lda, &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, & result[2]); /* Check error bounds from iterative refinement. */ zptt05_(&n, nrhs, &d__[1], &e[1], &b[1], &lda, &x[1], & lda, &xact[1], &lda, &rwork[1], &rwork[*nrhs + 1], &result[3]); } else { k1 = 6; } /* Check the reciprocal of the condition number. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = k1; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___38.ciunit = *nout; s_wsfe(&io___38); do_fio(&c__1, "ZPTSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } /* L90: */ } nrun = nrun + 7 - k1; L100: ; } L110: ; } /* L120: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZDRVPT */ } /* zdrvpt_ */
/* Subroutine */ int dchksy_(logical *dotype, integer *nn, integer *nval, integer *nnb, integer *nbval, integer *nns, integer *nsval, doublereal *thresh, logical *tsterr, integer *nmax, doublereal *a, doublereal *afac, doublereal *ainv, doublereal *b, doublereal *x, doublereal *xact, doublereal *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char uplos[1*2] = "U" "L"; /* Format strings */ static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "NB =\002,i4,\002, type \002,i2,\002, test \002,i2,\002, ratio " "=\002,g12.5)"; static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g" "12.5)"; static char fmt_9997[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002" ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)" ; /* System generated locals */ integer i__1, i__2, i__3, i__4; /* Builtin functions Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ static integer ioff, mode, imat, info; static char path[3], dist[1]; static integer irhs, nrhs; static char uplo[1], type__[1]; static integer nrun, i__, j, k; extern /* Subroutine */ int alahd_(integer *, char *); static integer n; extern /* Subroutine */ int dget04_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); static integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); static doublereal rcond; static integer nimat; extern /* Subroutine */ int dpot02_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dpot03_(char *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *), dpot05_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *); static doublereal anorm; extern /* Subroutine */ int dsyt01_(char *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, doublereal *, doublereal *); static integer iuplo, izero, i1, i2, nerrs, lwork; static logical zerot; static char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *); static integer nb, in, kl; extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); static integer ku, nt; static doublereal rcondc; extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *), alasum_(char *, integer *, integer *, integer *, integer *); static doublereal cndnum; extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *); extern doublereal dlansy_(char *, char *, integer *, doublereal *, integer *, doublereal *); static logical trfcon; extern /* Subroutine */ int xlaenv_(integer *, integer *), dsycon_(char *, integer *, doublereal *, integer *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *), derrsy_(char *, integer *), dsyrfs_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *), dsytrf_(char *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *); static doublereal result[8]; extern /* Subroutine */ int dsytri_(char *, integer *, doublereal *, integer *, integer *, doublereal *, integer *), dsytrs_( char *, integer *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *); static integer lda, inb; /* Fortran I/O blocks */ static cilist io___39 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___42 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___44 = { 0, 0, 0, fmt_9997, 0 }; /* -- LAPACK test routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University December 7, 1999 Purpose ======= DCHKSY tests DSYTRF, -TRI, -TRS, -RFS, and -CON. Arguments ========= DOTYPE (input) 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. NN (input) INTEGER The number of values of N contained in the vector NVAL. NVAL (input) INTEGER array, dimension (NN) The values of the matrix dimension N. NNB (input) INTEGER The number of values of NB contained in the vector NBVAL. NBVAL (input) INTEGER array, dimension (NBVAL) The values of the blocksize NB. NNS (input) INTEGER The number of values of NRHS contained in the vector NSVAL. NSVAL (input) INTEGER array, dimension (NNS) The values of the number of right hand sides NRHS. THRESH (input) 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. TSTERR (input) LOGICAL Flag that indicates whether error exits are to be tested. NMAX (input) INTEGER The maximum value permitted for N, used in dimensioning the work arrays. A (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) AFAC (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) AINV (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) B (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) where NSMAX is the largest entry in NSVAL. X (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) WORK (workspace) DOUBLE PRECISION array, dimension (NMAX*max(3,NSMAX)) RWORK (workspace) DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX)) IWORK (workspace) INTEGER array, dimension (2*NMAX) NOUT (input) INTEGER The unit number for output. ===================================================================== Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nsval; --nbval; --nval; --dotype; /* Function Body Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "SY", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { derrsy_(path, nout); } infoc_1.infot = 0; xlaenv_(&c__2, &c__2); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; nimat = 10; if (n <= 0) { nimat = 1; } izero = 0; i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L170; } /* Skip types 3, 4, 5, or 6 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 6; if (zerot && n < imat - 2) { goto L170; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1]; /* Set up parameters with DLATB4 and generate a test matrix with DLATMS. */ dlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)6, (ftnlen)6); dlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1], &info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L160; } /* For types 3-6, zero one or more rows and columns of the matrix to test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } if (imat < 6) { /* Set row and column IZERO to zero. */ if (iuplo == 1) { ioff = (izero - 1) * lda; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff += lda; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff += lda; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L50: */ } } } else { ioff = 0; if (iuplo == 1) { /* Set the first IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i2 = min(j,izero); i__4 = i2; for (i__ = 1; i__ <= i__4; ++i__) { a[ioff + i__] = 0.; /* L60: */ } ioff += lda; /* L70: */ } } else { /* Set the last IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i1 = max(j,izero); i__4 = n; for (i__ = i1; i__ <= i__4; ++i__) { a[ioff + i__] = 0.; /* L80: */ } ioff += lda; /* L90: */ } } } } else { izero = 0; } /* Do for each value of NB in NBVAL */ i__3 = *nnb; for (inb = 1; inb <= i__3; ++inb) { nb = nbval[inb]; xlaenv_(&c__1, &nb); /* Compute the L*D*L' or U*D*U' factorization of the matrix. */ dlacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda); lwork = max(2,nb) * lda; s_copy(srnamc_1.srnamt, "DSYTRF", (ftnlen)6, (ftnlen)6); dsytrf_(uplo, &n, &afac[1], &lda, &iwork[1], &ainv[1], & lwork, &info); /* Adjust the expected value of INFO to account for pivoting. */ k = izero; if (k > 0) { L100: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L100; } } else if (iwork[k] != k) { k = iwork[k]; goto L100; } } /* Check error code from DSYTRF. */ if (info != k) { alaerh_(path, "DSYTRF", &info, &k, uplo, &n, &n, & c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout); } if (info != 0) { trfcon = TRUE_; } else { trfcon = FALSE_; } /* + TEST 1 Reconstruct matrix from factors and compute residual. */ dsyt01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &iwork[1], &ainv[1], &lda, &rwork[1], result); nt = 1; /* + TEST 2 Form the inverse and compute the residual. */ if (inb == 1 && ! trfcon) { dlacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda); s_copy(srnamc_1.srnamt, "DSYTRI", (ftnlen)6, (ftnlen) 6); dsytri_(uplo, &n, &ainv[1], &lda, &iwork[1], &work[1], &info); /* Check error code from DSYTRI. */ if (info != 0) { alaerh_(path, "DSYTRI", &info, &c_n1, uplo, &n, & n, &c_n1, &c_n1, &c_n1, &imat, &nfail, & nerrs, nout); } dpot03_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &work[ 1], &lda, &rwork[1], &rcondc, &result[1]); nt = 2; } /* Print information about the tests that did not pass the threshold. */ i__4 = nt; for (k = 1; k <= i__4; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___39.ciunit = *nout; s_wsfe(&io___39); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L110: */ } nrun += nt; /* Skip the other tests if this is not the first block size. */ if (inb > 1) { goto L150; } /* Do only the condition estimate if INFO is not 0. */ if (trfcon) { rcondc = 0.; goto L140; } i__4 = *nns; for (irhs = 1; irhs <= i__4; ++irhs) { nrhs = nsval[irhs]; /* + TEST 3 Solve and compute residual for A * X = B. */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)6, (ftnlen) 6); dlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, & nrhs, &a[1], &lda, &xact[1], &lda, &b[1], & lda, iseed, &info); dlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "DSYTRS", (ftnlen)6, (ftnlen) 6); dsytrs_(uplo, &n, &nrhs, &afac[1], &lda, &iwork[1], & x[1], &lda, &info); /* Check error code from DSYTRS. */ if (info != 0) { alaerh_(path, "DSYTRS", &info, &c__0, uplo, &n, & n, &c_n1, &c_n1, &nrhs, &imat, &nfail, & nerrs, nout); } dlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], & lda); dpot02_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, & work[1], &lda, &rwork[1], &result[2]); /* + TEST 4 Check solution from generated exact solution. */ dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[3]); /* + TESTS 5, 6, and 7 Use iterative refinement to improve the solution. */ s_copy(srnamc_1.srnamt, "DSYRFS", (ftnlen)6, (ftnlen) 6); dsyrfs_(uplo, &n, &nrhs, &a[1], &lda, &afac[1], &lda, &iwork[1], &b[1], &lda, &x[1], &lda, &rwork[1] , &rwork[nrhs + 1], &work[1], &iwork[n + 1], & info); /* Check error code from DSYRFS. */ if (info != 0) { alaerh_(path, "DSYRFS", &info, &c__0, uplo, &n, & n, &c_n1, &c_n1, &nrhs, &imat, &nfail, & nerrs, nout); } dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[4]); dpot05_(uplo, &n, &nrhs, &a[1], &lda, &b[1], &lda, &x[ 1], &lda, &xact[1], &lda, &rwork[1], &rwork[ nrhs + 1], &result[5]); /* Print information about the tests that did not pass the threshold. */ for (k = 3; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___42.ciunit = *nout; s_wsfe(&io___42); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L120: */ } nrun += 5; /* L130: */ } /* + TEST 8 Get an estimate of RCOND = 1/CNDNUM. */ L140: anorm = dlansy_("1", uplo, &n, &a[1], &lda, &rwork[1]); s_copy(srnamc_1.srnamt, "DSYCON", (ftnlen)6, (ftnlen)6); dsycon_(uplo, &n, &afac[1], &lda, &iwork[1], &anorm, & rcond, &work[1], &iwork[n + 1], &info); /* Check error code from DSYCON. */ if (info != 0) { alaerh_(path, "DSYCON", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } result[7] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass the threshold. */ if (result[7] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___44.ciunit = *nout; s_wsfe(&io___44); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; L150: ; } L160: ; } L170: ; } /* L180: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of DCHKSY */ } /* dchksy_ */
/* Subroutine */ int zdrvpb_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, doublecomplex *afac, doublecomplex *asav, doublecomplex *b, doublecomplex *bsav, doublecomplex *x, doublecomplex *xact, doublereal *s, doublecomplex *work, doublereal * rwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char facts[1*3] = "F" "N" "E"; static char equeds[1*2] = "N" "Y"; /* Format strings */ static char fmt_9999[] = "(1x,a6,\002, UPLO='\002,a1,\002', N =\002,i5" ",\002, KD =\002,i5,\002, type \002,i1,\002, test(\002,i1,\002)" "=\002,g12.5)"; static char fmt_9997[] = "(1x,a6,\002( '\002,a1,\002', '\002,a1,\002'," " \002,i5,\002, \002,i5,\002, ... ), EQUED='\002,a1,\002', type" " \002,i1,\002, test(\002,i1,\002)=\002,g12.5)"; static char fmt_9998[] = "(1x,a6,\002( '\002,a1,\002', '\002,a1,\002'," " \002,i5,\002, \002,i5,\002, ... ), type \002,i1,\002, test(\002" ",i1,\002)=\002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5, i__6, i__7[2]; char ch__1[2]; /* Builtin functions Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ static integer ldab; static char fact[1]; static integer ioff, mode, koff; static doublereal amax; static char path[3]; static integer imat, info; static char dist[1], uplo[1], type__[1]; static integer nrun, i__, k, n, ifact, nfail, iseed[4], nfact; extern doublereal dget06_(doublereal *, doublereal *); static integer kdval[4]; extern logical lsame_(char *, char *); static char equed[1]; static integer nbmin; static doublereal rcond, roldc, scond; static integer nimat; static doublereal anorm; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ); static logical equil; extern /* Subroutine */ int zpbt01_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *), zpbt02_(char *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ), zpbt05_(char *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); static integer iuplo, izero, i1, i2, k1, nerrs; static logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zpbsv_(char *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *), zswap_(integer *, doublecomplex *, integer *, doublecomplex *, integer *); static char xtype[1]; extern /* Subroutine */ int zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *); static integer kd, nb, in, kl; extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); static logical prefac; static integer iw, ku, nt; static doublereal rcondc; static logical nofact; static char packit[1]; static integer iequed; extern doublereal zlanhb_(char *, char *, integer *, integer *, doublecomplex *, integer *, doublereal *), zlange_(char *, integer *, integer *, doublecomplex *, integer *, doublereal *); extern /* Subroutine */ int zlaqhb_(char *, integer *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *, char *), alasvm_(char *, integer *, integer *, integer *, integer *); static doublereal cndnum; extern /* Subroutine */ int zlaipd_(integer *, doublecomplex *, integer *, integer *); static doublereal ainvnm; extern /* Subroutine */ int xlaenv_(integer *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex * , integer *), zlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, integer *), zlaset_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *), zpbequ_(char *, integer *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *, integer *), zpbtrf_(char *, integer *, integer *, doublecomplex *, integer *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *); static doublereal result[6]; extern /* Subroutine */ int zpbtrs_(char *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *), zpbsvx_(char *, char *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, char *, doublereal *, doublecomplex *, integer *, doublecomplex * , integer *, doublereal *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *), zerrvx_(char *, integer *); static integer lda, ikd, nkd; /* Fortran I/O blocks */ static cilist io___57 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___60 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___61 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University June 30, 1999 Purpose ======= ZDRVPB tests the driver routines ZPBSV and -SVX. Arguments ========= DOTYPE (input) 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. NN (input) INTEGER The number of values of N contained in the vector NVAL. NVAL (input) INTEGER array, dimension (NN) The values of the matrix dimension N. NRHS (input) INTEGER The number of right hand side vectors to be generated for each linear system. THRESH (input) 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. TSTERR (input) LOGICAL Flag that indicates whether error exits are to be tested. NMAX (input) INTEGER The maximum value permitted for N, used in dimensioning the work arrays. A (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) AFAC (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) ASAV (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) B (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) BSAV (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) X (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) XACT (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) S (workspace) DOUBLE PRECISION array, dimension (NMAX) WORK (workspace) COMPLEX*16 array, dimension (NMAX*max(3,NRHS)) RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) NOUT (input) INTEGER The unit number for output. ===================================================================== Parameter adjustments */ --rwork; --work; --s; --xact; --x; --bsav; --b; --asav; --afac; --a; --nval; --dotype; /* Function Body Initialize constants and the random number seed. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "PB", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrvx_(path, nout); } infoc_1.infot = 0; kdval[0] = 0; /* Set the block size and minimum block size for testing. */ nb = 1; nbmin = 2; xlaenv_(&c__1, &nb); xlaenv_(&c__2, &nbmin); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; /* Set limits on the number of loop iterations. Computing MAX */ i__2 = 1, i__3 = min(n,4); nkd = max(i__2,i__3); nimat = 8; if (n == 0) { nimat = 1; } kdval[1] = n + (n + 1) / 4; kdval[2] = (n * 3 - 1) / 4; kdval[3] = (n + 1) / 4; i__2 = nkd; for (ikd = 1; ikd <= i__2; ++ikd) { /* Do for KD = 0, (5*N+1)/4, (3N-1)/4, and (N+1)/4. This order makes it easier to skip redundant values for small values of N. */ kd = kdval[ikd - 1]; ldab = kd + 1; /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { koff = 1; if (iuplo == 1) { *(unsigned char *)uplo = 'U'; *(unsigned char *)packit = 'Q'; /* Computing MAX */ i__3 = 1, i__4 = kd + 2 - n; koff = max(i__3,i__4); } else { *(unsigned char *)uplo = 'L'; *(unsigned char *)packit = 'B'; } i__3 = nimat; for (imat = 1; imat <= i__3; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L80; } /* Skip types 2, 3, or 4 if the matrix size is too small. */ zerot = imat >= 2 && imat <= 4; if (zerot && n < imat - 1) { goto L80; } if (! zerot || ! dotype[1]) { /* Set up parameters with ZLATB4 and generate a test matrix with ZLATMS. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, (ftnlen) 6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cndnum, &anorm, &kd, &kd, packit, &a[koff], &ldab, &work[1], &info); /* Check error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, & n, &c_n1, &c_n1, &c_n1, &imat, &nfail, & nerrs, nout); goto L80; } } else if (izero > 0) { /* Use the same matrix for types 3 and 4 as for type 2 by copying back the zeroed out column, */ iw = (lda << 1) + 1; if (iuplo == 1) { ioff = (izero - 1) * ldab + kd + 1; i__4 = izero - i1; zcopy_(&i__4, &work[iw], &c__1, &a[ioff - izero + i1], &c__1); iw = iw + izero - i1; i__4 = i2 - izero + 1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); zcopy_(&i__4, &work[iw], &c__1, &a[ioff], &i__5); } else { ioff = (i1 - 1) * ldab + 1; i__4 = izero - i1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); zcopy_(&i__4, &work[iw], &c__1, &a[ioff + izero - i1], &i__5); ioff = (izero - 1) * ldab + 1; iw = iw + izero - i1; i__4 = i2 - izero + 1; zcopy_(&i__4, &work[iw], &c__1, &a[ioff], &c__1); } } /* For types 2-4, zero one row and column of the matrix to test that INFO is returned correctly. */ izero = 0; if (zerot) { if (imat == 2) { izero = 1; } else if (imat == 3) { izero = n; } else { izero = n / 2 + 1; } /* Save the zeroed out row and column in WORK(*,3) */ iw = lda << 1; /* Computing MIN */ i__5 = (kd << 1) + 1; i__4 = min(i__5,n); for (i__ = 1; i__ <= i__4; ++i__) { i__5 = iw + i__; work[i__5].r = 0., work[i__5].i = 0.; /* L20: */ } ++iw; /* Computing MAX */ i__4 = izero - kd; i1 = max(i__4,1); /* Computing MIN */ i__4 = izero + kd; i2 = min(i__4,n); if (iuplo == 1) { ioff = (izero - 1) * ldab + kd + 1; i__4 = izero - i1; zswap_(&i__4, &a[ioff - izero + i1], &c__1, &work[ iw], &c__1); iw = iw + izero - i1; i__4 = i2 - izero + 1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); zswap_(&i__4, &a[ioff], &i__5, &work[iw], &c__1); } else { ioff = (i1 - 1) * ldab + 1; i__4 = izero - i1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); zswap_(&i__4, &a[ioff + izero - i1], &i__5, &work[ iw], &c__1); ioff = (izero - 1) * ldab + 1; iw = iw + izero - i1; i__4 = i2 - izero + 1; zswap_(&i__4, &a[ioff], &c__1, &work[iw], &c__1); } } /* Set the imaginary part of the diagonals. */ if (iuplo == 1) { zlaipd_(&n, &a[kd + 1], &ldab, &c__0); } else { zlaipd_(&n, &a[1], &ldab, &c__0); } /* Save a copy of the matrix A in ASAV. */ i__4 = kd + 1; zlacpy_("Full", &i__4, &n, &a[1], &ldab, &asav[1], &ldab); for (iequed = 1; iequed <= 2; ++iequed) { *(unsigned char *)equed = *(unsigned char *)&equeds[ iequed - 1]; if (iequed == 1) { nfact = 3; } else { nfact = 1; } i__4 = nfact; for (ifact = 1; ifact <= i__4; ++ifact) { *(unsigned char *)fact = *(unsigned char *)&facts[ ifact - 1]; prefac = lsame_(fact, "F"); nofact = lsame_(fact, "N"); equil = lsame_(fact, "E"); if (zerot) { if (prefac) { goto L60; } rcondc = 0.; } else if (! lsame_(fact, "N")) { /* Compute the condition number for comparison with the value returned by ZPBSVX (FACT = 'N' reuses the condition number from the previous iteration with FACT = 'F'). */ i__5 = kd + 1; zlacpy_("Full", &i__5, &n, &asav[1], &ldab, & afac[1], &ldab); if (equil || iequed > 1) { /* Compute row and column scale factors to equilibrate the matrix A. */ zpbequ_(uplo, &n, &kd, &afac[1], &ldab, & s[1], &scond, &amax, &info); if (info == 0 && n > 0) { if (iequed > 1) { scond = 0.; } /* Equilibrate the matrix. */ zlaqhb_(uplo, &n, &kd, &afac[1], & ldab, &s[1], &scond, &amax, equed); } } /* Save the condition number of the non-equilibrated system for use in ZGET04. */ if (equil) { roldc = rcondc; } /* Compute the 1-norm of A. */ anorm = zlanhb_("1", uplo, &n, &kd, &afac[1], &ldab, &rwork[1]); /* Factor the matrix A. */ zpbtrf_(uplo, &n, &kd, &afac[1], &ldab, &info); /* Form the inverse of A. */ zlaset_("Full", &n, &n, &c_b47, &c_b48, &a[1], &lda); s_copy(srnamc_1.srnamt, "ZPBTRS", (ftnlen)6, ( ftnlen)6); zpbtrs_(uplo, &n, &kd, &n, &afac[1], &ldab, & a[1], &lda, &info); /* Compute the 1-norm condition number of A. */ ainvnm = zlange_("1", &n, &n, &a[1], &lda, & rwork[1]); if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } } /* Restore the matrix A. */ i__5 = kd + 1; zlacpy_("Full", &i__5, &n, &asav[1], &ldab, &a[1], &ldab); /* Form an exact solution and set the right hand side. */ s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)6, ( ftnlen)6); zlarhs_(path, xtype, uplo, " ", &n, &n, &kd, &kd, nrhs, &a[1], &ldab, &xact[1], &lda, &b[1], &lda, iseed, &info); *(unsigned char *)xtype = 'C'; zlacpy_("Full", &n, nrhs, &b[1], &lda, &bsav[1], & lda); if (nofact) { /* --- Test ZPBSV --- Compute the L*L' or U'*U factorization of the matrix and solve the system. */ i__5 = kd + 1; zlacpy_("Full", &i__5, &n, &a[1], &ldab, & afac[1], &ldab); zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "ZPBSV ", (ftnlen)6, ( ftnlen)6); zpbsv_(uplo, &n, &kd, nrhs, &afac[1], &ldab, & x[1], &lda, &info); /* Check error code from ZPBSV . */ if (info != izero) { alaerh_(path, "ZPBSV ", &info, &izero, uplo, &n, &n, &kd, &kd, nrhs, & imat, &nfail, &nerrs, nout); goto L40; } else if (info != 0) { goto L40; } /* Reconstruct matrix from factors and compute residual. */ zpbt01_(uplo, &n, &kd, &a[1], &ldab, &afac[1], &ldab, &rwork[1], result); /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[ 1], &lda); zpbt02_(uplo, &n, &kd, nrhs, &a[1], &ldab, &x[ 1], &lda, &work[1], &lda, &rwork[1], & result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &result[2]); nt = 3; /* Print information about the tests that did not pass the threshold. */ i__5 = nt; for (k = 1; k <= i__5; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___57.ciunit = *nout; s_wsfe(&io___57); do_fio(&c__1, "ZPBSV ", (ftnlen)6); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&kd, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } /* L30: */ } nrun += nt; L40: ; } /* --- Test ZPBSVX --- */ if (! prefac) { i__5 = kd + 1; zlaset_("Full", &i__5, &n, &c_b47, &c_b47, & afac[1], &ldab); } zlaset_("Full", &n, nrhs, &c_b47, &c_b47, &x[1], & lda); if (iequed > 1 && n > 0) { /* Equilibrate the matrix if FACT='F' and EQUED='Y' */ zlaqhb_(uplo, &n, &kd, &a[1], &ldab, &s[1], & scond, &amax, equed); } /* Solve the system and compute the condition number and error bounds using ZPBSVX. */ s_copy(srnamc_1.srnamt, "ZPBSVX", (ftnlen)6, ( ftnlen)6); zpbsvx_(fact, uplo, &n, &kd, nrhs, &a[1], &ldab, & afac[1], &ldab, equed, &s[1], &b[1], &lda, &x[1], &lda, &rcond, &rwork[1], &rwork[* nrhs + 1], &work[1], &rwork[(*nrhs << 1) + 1], &info); /* Check the error code from ZPBSVX. */ if (info != izero) { /* Writing concatenation */ i__7[0] = 1, a__1[0] = fact; i__7[1] = 1, a__1[1] = uplo; s_cat(ch__1, a__1, i__7, &c__2, (ftnlen)2); alaerh_(path, "ZPBSVX", &info, &izero, ch__1, &n, &n, &kd, &kd, nrhs, &imat, &nfail, &nerrs, nout); goto L60; } if (info == 0) { if (! prefac) { /* Reconstruct matrix from factors and compute residual. */ zpbt01_(uplo, &n, &kd, &a[1], &ldab, & afac[1], &ldab, &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &bsav[1], &lda, & work[1], &lda); zpbt02_(uplo, &n, &kd, nrhs, &asav[1], &ldab, &x[1], &lda, &work[1], &lda, &rwork[(* nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ if (nofact || prefac && lsame_(equed, "N")) { zget04_(&n, nrhs, &x[1], &lda, &xact[1], & lda, &rcondc, &result[2]); } else { zget04_(&n, nrhs, &x[1], &lda, &xact[1], & lda, &roldc, &result[2]); } /* Check the error bounds from iterative refinement. */ zpbt05_(uplo, &n, &kd, nrhs, &asav[1], &ldab, &b[1], &lda, &x[1], &lda, &xact[1], & lda, &rwork[1], &rwork[*nrhs + 1], & result[3]); } else { k1 = 6; } /* Compare RCOND from ZPBSVX with the computed value in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass the threshold. */ for (k = k1; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___60.ciunit = *nout; s_wsfe(&io___60); do_fio(&c__1, "ZPBSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&kd, (ftnlen) sizeof(integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } else { io___61.ciunit = *nout; s_wsfe(&io___61); do_fio(&c__1, "ZPBSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&kd, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } ++nfail; } /* L50: */ } nrun = nrun + 7 - k1; L60: ; } /* L70: */ } L80: ; } /* L90: */ } /* L100: */ } /* L110: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZDRVPB */ } /* zdrvpb_ */
/* Subroutine */ int zchkhp_(logical *dotype, integer *nn, integer *nval, integer *nns, integer *nsval, doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, doublecomplex *afac, doublecomplex * ainv, doublecomplex *b, doublecomplex *x, doublecomplex *xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char uplos[1*2] = "U" "L"; /* Format strings */ static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)"; static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g" "12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, j, k, n, i1, i2, in, kl, ku, nt, lda, npp, ioff, mode, imat, info; char path[3], dist[1]; integer irhs, nrhs; char uplo[1], type__[1]; integer nrun; extern /* Subroutine */ int alahd_(integer *, char *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); extern logical lsame_(char *, char *); doublereal rcond; integer nimat; doublereal anorm; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ), zhpt01_(char *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *); integer iuplo, izero, nerrs; extern /* Subroutine */ int zppt02_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *), zppt03_(char *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zppt05_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); char xtype[1]; extern /* Subroutine */ int zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); doublereal rcondc; char packit[1]; extern /* Subroutine */ int alasum_(char *, integer *, integer *, integer *, integer *); doublereal cndnum; extern /* Subroutine */ int zlaipd_(integer *, doublecomplex *, integer *, integer *); logical trfcon; extern doublereal zlanhp_(char *, char *, integer *, doublecomplex *, doublereal *); extern /* Subroutine */ int zhpcon_(char *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublecomplex *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *), zlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer * , integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *), zhprfs_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *), zhptrf_(char *, integer *, doublecomplex *, integer *, integer *); doublereal result[8]; extern /* Subroutine */ int zhptri_(char *, integer *, doublecomplex *, integer *, doublecomplex *, integer *), zhptrs_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *), zerrsy_(char *, integer *) ; /* Fortran I/O blocks */ static cilist io___38 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___41 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___43 = { 0, 0, 0, fmt_9999, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZCHKHP tests ZHPTRF, -TRI, -TRS, -RFS, and -CON */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NNS (input) INTEGER */ /* The number of values of NRHS contained in the vector NSVAL. */ /* NSVAL (input) INTEGER array, dimension (NNS) */ /* The values of the number of right hand sides NRHS. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for N, used in dimensioning the */ /* work arrays. */ /* A (workspace) COMPLEX*16 array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* AFAC (workspace) COMPLEX*16 array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* AINV (workspace) COMPLEX*16 array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* B (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* where NSMAX is the largest entry in NSVAL. */ /* X (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* WORK (workspace) COMPLEX*16 array, dimension */ /* (NMAX*max(2,NSMAX)) */ /* RWORK (workspace) DOUBLE PRECISION array, */ /* dimension (NMAX+2*NSMAX) */ /* IWORK (workspace) INTEGER array, dimension (NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nsval; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "HP", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrsy_(path, nout); } infoc_1.infot = 0; /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; nimat = 10; if (n <= 0) { nimat = 1; } izero = 0; i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L160; } /* Skip types 3, 4, 5, or 6 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 6; if (zerot && n < imat - 2) { goto L160; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1]; if (lsame_(uplo, "U")) { *(unsigned char *)packit = 'C'; } else { *(unsigned char *)packit = 'R'; } /* Set up parameters with ZLATB4 and generate a test matrix */ /* with ZLATMS. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, packit, &a[1], &lda, &work[ 1], &info); /* Check error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L150; } /* For types 3-6, zero one or more rows and columns of */ /* the matrix to test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } if (imat < 6) { /* Set row and column IZERO to zero. */ if (iuplo == 1) { ioff = (izero - 1) * izero / 2; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff += i__; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff = ioff + n - i__; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L50: */ } } } else { ioff = 0; if (iuplo == 1) { /* Set the first IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i2 = min(j,izero); i__4 = i2; for (i__ = 1; i__ <= i__4; ++i__) { i__5 = ioff + i__; a[i__5].r = 0., a[i__5].i = 0.; /* L60: */ } ioff += j; /* L70: */ } } else { /* Set the last IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i1 = max(j,izero); i__4 = n; for (i__ = i1; i__ <= i__4; ++i__) { i__5 = ioff + i__; a[i__5].r = 0., a[i__5].i = 0.; /* L80: */ } ioff = ioff + n - j; /* L90: */ } } } } else { izero = 0; } /* Set the imaginary part of the diagonals. */ if (iuplo == 1) { zlaipd_(&n, &a[1], &c__2, &c__1); } else { zlaipd_(&n, &a[1], &n, &c_n1); } /* Compute the L*D*L' or U*D*U' factorization of the matrix. */ npp = n * (n + 1) / 2; zcopy_(&npp, &a[1], &c__1, &afac[1], &c__1); s_copy(srnamc_1.srnamt, "ZHPTRF", (ftnlen)6, (ftnlen)6); zhptrf_(uplo, &n, &afac[1], &iwork[1], &info); /* Adjust the expected value of INFO to account for */ /* pivoting. */ k = izero; if (k > 0) { L100: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L100; } } else if (iwork[k] != k) { k = iwork[k]; goto L100; } } /* Check error code from ZHPTRF. */ if (info != k) { alaerh_(path, "ZHPTRF", &info, &k, uplo, &n, &n, &c_n1, & c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } if (info != 0) { trfcon = TRUE_; } else { trfcon = FALSE_; } /* + TEST 1 */ /* Reconstruct matrix from factors and compute residual. */ zhpt01_(uplo, &n, &a[1], &afac[1], &iwork[1], &ainv[1], &lda, &rwork[1], result); nt = 1; /* + TEST 2 */ /* Form the inverse and compute the residual. */ if (! trfcon) { zcopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1); s_copy(srnamc_1.srnamt, "ZHPTRI", (ftnlen)6, (ftnlen)6); zhptri_(uplo, &n, &ainv[1], &iwork[1], &work[1], &info); /* Check error code from ZHPTRI. */ if (info != 0) { alaerh_(path, "ZHPTRI", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } zppt03_(uplo, &n, &a[1], &ainv[1], &work[1], &lda, &rwork[ 1], &rcondc, &result[1]); nt = 2; } /* Print information about the tests that did not pass */ /* the threshold. */ i__3 = nt; for (k = 1; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___38.ciunit = *nout; s_wsfe(&io___38); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } /* L110: */ } nrun += nt; /* Do only the condition estimate if INFO is not 0. */ if (trfcon) { rcondc = 0.; goto L140; } i__3 = *nns; for (irhs = 1; irhs <= i__3; ++irhs) { nrhs = nsval[irhs]; /* + TEST 3 */ /* Solve and compute residual for A * X = B. */ s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)6, (ftnlen)6); zlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, &nrhs, & a[1], &lda, &xact[1], &lda, &b[1], &lda, iseed, & info); *(unsigned char *)xtype = 'C'; zlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "ZHPTRS", (ftnlen)6, (ftnlen)6); zhptrs_(uplo, &n, &nrhs, &afac[1], &iwork[1], &x[1], &lda, &info); /* Check error code from ZHPTRS. */ if (info != 0) { alaerh_(path, "ZHPTRS", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs, nout); } zlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda); zppt02_(uplo, &n, &nrhs, &a[1], &x[1], &lda, &work[1], & lda, &rwork[1], &result[2]); /* + TEST 4 */ /* Check solution from generated exact solution. */ zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, & result[3]); /* + TESTS 5, 6, and 7 */ /* Use iterative refinement to improve the solution. */ s_copy(srnamc_1.srnamt, "ZHPRFS", (ftnlen)6, (ftnlen)6); zhprfs_(uplo, &n, &nrhs, &a[1], &afac[1], &iwork[1], &b[1] , &lda, &x[1], &lda, &rwork[1], &rwork[nrhs + 1], &work[1], &rwork[(nrhs << 1) + 1], &info); /* Check error code from ZHPRFS. */ if (info != 0) { alaerh_(path, "ZHPRFS", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs, nout); } zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, & result[4]); zppt05_(uplo, &n, &nrhs, &a[1], &b[1], &lda, &x[1], &lda, &xact[1], &lda, &rwork[1], &rwork[nrhs + 1], & result[5]); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = 3; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___41.ciunit = *nout; s_wsfe(&io___41); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L120: */ } nrun += 5; /* L130: */ } /* + TEST 8 */ /* Get an estimate of RCOND = 1/CNDNUM. */ L140: anorm = zlanhp_("1", uplo, &n, &a[1], &rwork[1]); s_copy(srnamc_1.srnamt, "ZHPCON", (ftnlen)6, (ftnlen)6); zhpcon_(uplo, &n, &afac[1], &iwork[1], &anorm, &rcond, &work[ 1], &info); /* Check error code from ZHPCON. */ if (info != 0) { alaerh_(path, "ZHPCON", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } result[7] = dget06_(&rcond, &rcondc); /* Print the test ratio if it is .GE. THRESH. */ if (result[7] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___43.ciunit = *nout; s_wsfe(&io___43); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; L150: ; } L160: ; } /* L170: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZCHKHP */ } /* zchkhp_ */
/* Subroutine */ int zchkgt_(logical *dotype, integer *nn, integer *nval, integer *nns, integer *nsval, doublereal *thresh, logical *tsterr, doublecomplex *a, doublecomplex *af, doublecomplex *b, doublecomplex * x, doublecomplex *xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 0,0,0,1 }; static char transs[1*3] = "N" "T" "C"; /* Format strings */ static char fmt_9999[] = "(12x,\002N =\002,i5,\002,\002,10x,\002 type" " \002,i2,\002, test(\002,i2,\002) = \002,g12.5)"; static char fmt_9997[] = "(\002 NORM ='\002,a1,\002', N =\002,i5,\002" ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) = \002,g12." "5)"; static char fmt_9998[] = "(\002 TRANS='\002,a1,\002', N =\002,i5,\002, N" "RHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) = \002,g" "12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; doublereal d__1, d__2; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, j, k, m, n; doublecomplex z__[3]; integer in, kl, ku, ix, lda; doublereal cond; integer mode, koff, imat, info; char path[3], dist[1]; integer irhs, nrhs; char norm[1], type__[1]; integer nrun; extern /* Subroutine */ int alahd_(integer *, char *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); doublereal rcond; integer nimat; doublereal anorm; integer itran; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ); char trans[1]; integer izero, nerrs; extern /* Subroutine */ int zgtt01_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *), zgtt02_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *), zgtt05_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); doublereal rcondc, rcondi; extern /* Subroutine */ int zdscal_(integer *, doublereal *, doublecomplex *, integer *), alasum_(char *, integer *, integer *, integer *, integer *); doublereal rcondo, ainvnm; logical trfcon; extern /* Subroutine */ int zerrge_(char *, integer *); extern doublereal zlangt_(char *, integer *, doublecomplex *, doublecomplex *, doublecomplex *); extern /* Subroutine */ int zlagtm_(char *, integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublereal *, doublecomplex *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); extern doublereal dzasum_(integer *, doublecomplex *, integer *); extern /* Subroutine */ int zgtcon_(char *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublereal *, doublereal *, doublecomplex *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *), zlarnv_(integer *, integer *, integer *, doublecomplex *); doublereal result[7]; extern /* Subroutine */ int zgtrfs_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *), zgttrf_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, integer *), zgttrs_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, integer *); /* Fortran I/O blocks */ static cilist io___29 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___39 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___44 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZCHKGT tests ZGTTRF, -TRS, -RFS, and -CON */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NNS (input) INTEGER */ /* The number of values of NRHS contained in the vector NSVAL. */ /* NSVAL (input) INTEGER array, dimension (NNS) */ /* The values of the number of right hand sides NRHS. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* A (workspace) COMPLEX*16 array, dimension (NMAX*4) */ /* AF (workspace) COMPLEX*16 array, dimension (NMAX*4) */ /* B (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* where NSMAX is the largest entry in NSVAL. */ /* X (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* WORK (workspace) COMPLEX*16 array, dimension */ /* (NMAX*max(3,NSMAX)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension */ /* (max(NMAX)+2*NSMAX) */ /* IWORK (workspace) INTEGER array, dimension (NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --af; --a; --nsval; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "GT", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrge_(path, nout); } infoc_1.infot = 0; i__1 = *nn; for (in = 1; in <= i__1; ++in) { /* Do for each value of N in NVAL. */ n = nval[in]; /* Computing MAX */ i__2 = n - 1; m = max(i__2,0); lda = max(1,n); nimat = 12; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L100; } /* Set up parameters with ZLATB4. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, & cond, dist); zerot = imat >= 8 && imat <= 10; if (imat <= 6) { /* Types 1-6: generate matrices of known condition number. */ /* Computing MAX */ i__3 = 2 - ku, i__4 = 3 - max(1,n); koff = max(i__3,i__4); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond, &anorm, &kl, &ku, "Z", &af[koff], &c__3, &work[1], & info); /* Check the error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, " ", &n, &n, &kl, & ku, &c_n1, &imat, &nfail, &nerrs, nout); goto L100; } izero = 0; if (n > 1) { i__3 = n - 1; zcopy_(&i__3, &af[4], &c__3, &a[1], &c__1); i__3 = n - 1; zcopy_(&i__3, &af[3], &c__3, &a[n + m + 1], &c__1); } zcopy_(&n, &af[2], &c__3, &a[m + 1], &c__1); } else { /* Types 7-12: generate tridiagonal matrices with */ /* unknown condition numbers. */ if (! zerot || ! dotype[7]) { /* Generate a matrix with elements whose real and */ /* imaginary parts are from [-1,1]. */ i__3 = n + (m << 1); zlarnv_(&c__2, iseed, &i__3, &a[1]); if (anorm != 1.) { i__3 = n + (m << 1); zdscal_(&i__3, &anorm, &a[1], &c__1); } } else if (izero > 0) { /* Reuse the last matrix by copying back the zeroed out */ /* elements. */ if (izero == 1) { i__3 = n; a[i__3].r = z__[1].r, a[i__3].i = z__[1].i; if (n > 1) { a[1].r = z__[2].r, a[1].i = z__[2].i; } } else if (izero == n) { i__3 = n * 3 - 2; a[i__3].r = z__[0].r, a[i__3].i = z__[0].i; i__3 = (n << 1) - 1; a[i__3].r = z__[1].r, a[i__3].i = z__[1].i; } else { i__3 = (n << 1) - 2 + izero; a[i__3].r = z__[0].r, a[i__3].i = z__[0].i; i__3 = n - 1 + izero; a[i__3].r = z__[1].r, a[i__3].i = z__[1].i; i__3 = izero; a[i__3].r = z__[2].r, a[i__3].i = z__[2].i; } } /* If IMAT > 7, set one column of the matrix to 0. */ if (! zerot) { izero = 0; } else if (imat == 8) { izero = 1; i__3 = n; z__[1].r = a[i__3].r, z__[1].i = a[i__3].i; i__3 = n; a[i__3].r = 0., a[i__3].i = 0.; if (n > 1) { z__[2].r = a[1].r, z__[2].i = a[1].i; a[1].r = 0., a[1].i = 0.; } } else if (imat == 9) { izero = n; i__3 = n * 3 - 2; z__[0].r = a[i__3].r, z__[0].i = a[i__3].i; i__3 = (n << 1) - 1; z__[1].r = a[i__3].r, z__[1].i = a[i__3].i; i__3 = n * 3 - 2; a[i__3].r = 0., a[i__3].i = 0.; i__3 = (n << 1) - 1; a[i__3].r = 0., a[i__3].i = 0.; } else { izero = (n + 1) / 2; i__3 = n - 1; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = (n << 1) - 2 + i__; a[i__4].r = 0., a[i__4].i = 0.; i__4 = n - 1 + i__; a[i__4].r = 0., a[i__4].i = 0.; i__4 = i__; a[i__4].r = 0., a[i__4].i = 0.; /* L20: */ } i__3 = n * 3 - 2; a[i__3].r = 0., a[i__3].i = 0.; i__3 = (n << 1) - 1; a[i__3].r = 0., a[i__3].i = 0.; } } /* + TEST 1 */ /* Factor A as L*U and compute the ratio */ /* norm(L*U - A) / (n * norm(A) * EPS ) */ i__3 = n + (m << 1); zcopy_(&i__3, &a[1], &c__1, &af[1], &c__1); s_copy(srnamc_1.srnamt, "ZGTTRF", (ftnlen)32, (ftnlen)6); zgttrf_(&n, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &info); /* Check error code from ZGTTRF. */ if (info != izero) { alaerh_(path, "ZGTTRF", &info, &izero, " ", &n, &n, &c__1, & c__1, &c_n1, &imat, &nfail, &nerrs, nout); } trfcon = info != 0; zgtt01_(&n, &a[1], &a[m + 1], &a[n + m + 1], &af[1], &af[m + 1], & af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &work[1], &lda, &rwork[1], result); /* Print the test ratio if it is .GE. THRESH. */ if (result[0] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___29.ciunit = *nout; s_wsfe(&io___29); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } ++nrun; for (itran = 1; itran <= 2; ++itran) { *(unsigned char *)trans = *(unsigned char *)&transs[itran - 1] ; if (itran == 1) { *(unsigned char *)norm = 'O'; } else { *(unsigned char *)norm = 'I'; } anorm = zlangt_(norm, &n, &a[1], &a[m + 1], &a[n + m + 1]); if (! trfcon) { /* Use ZGTTRS to solve for one column at a time of */ /* inv(A), computing the maximum column sum as we go. */ ainvnm = 0.; i__3 = n; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = n; for (j = 1; j <= i__4; ++j) { i__5 = j; x[i__5].r = 0., x[i__5].i = 0.; /* L30: */ } i__4 = i__; x[i__4].r = 1., x[i__4].i = 0.; zgttrs_(trans, &n, &c__1, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &x[ 1], &lda, &info); /* Computing MAX */ d__1 = ainvnm, d__2 = dzasum_(&n, &x[1], &c__1); ainvnm = max(d__1,d__2); /* L40: */ } /* Compute RCONDC = 1 / (norm(A) * norm(inv(A)) */ if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } if (itran == 1) { rcondo = rcondc; } else { rcondi = rcondc; } } else { rcondc = 0.; } /* + TEST 7 */ /* Estimate the reciprocal of the condition number of the */ /* matrix. */ s_copy(srnamc_1.srnamt, "ZGTCON", (ftnlen)32, (ftnlen)6); zgtcon_(norm, &n, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &anorm, &rcond, &work[1], & info); /* Check error code from ZGTCON. */ if (info != 0) { alaerh_(path, "ZGTCON", &info, &c__0, norm, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } result[6] = dget06_(&rcond, &rcondc); /* Print the test ratio if it is .GE. THRESH. */ if (result[6] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___39.ciunit = *nout; s_wsfe(&io___39); do_fio(&c__1, norm, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; /* L50: */ } /* Skip the remaining tests if the matrix is singular. */ if (trfcon) { goto L100; } i__3 = *nns; for (irhs = 1; irhs <= i__3; ++irhs) { nrhs = nsval[irhs]; /* Generate NRHS random solution vectors. */ ix = 1; i__4 = nrhs; for (j = 1; j <= i__4; ++j) { zlarnv_(&c__2, iseed, &n, &xact[ix]); ix += lda; /* L60: */ } for (itran = 1; itran <= 3; ++itran) { *(unsigned char *)trans = *(unsigned char *)&transs[itran - 1]; if (itran == 1) { rcondc = rcondo; } else { rcondc = rcondi; } /* Set the right hand side. */ zlagtm_(trans, &n, &nrhs, &c_b63, &a[1], &a[m + 1], &a[n + m + 1], &xact[1], &lda, &c_b64, &b[1], &lda); /* + TEST 2 */ /* Solve op(A) * X = B and compute the residual. */ zlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "ZGTTRS", (ftnlen)32, (ftnlen)6); zgttrs_(trans, &n, &nrhs, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &x[1], &lda, &info); /* Check error code from ZGTTRS. */ if (info != 0) { alaerh_(path, "ZGTTRS", &info, &c__0, trans, &n, &n, & c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs, nout); } zlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda); zgtt02_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1], &x[1], &lda, &work[1], &lda, &rwork[1], &result[ 1]); /* + TEST 3 */ /* Check solution from generated exact solution. */ zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, & result[2]); /* + TESTS 4, 5, and 6 */ /* Use iterative refinement to improve the solution. */ s_copy(srnamc_1.srnamt, "ZGTRFS", (ftnlen)32, (ftnlen)6); zgtrfs_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1], &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &b[1], &lda, &x[1], &lda, & rwork[1], &rwork[nrhs + 1], &work[1], &rwork[( nrhs << 1) + 1], &info); /* Check error code from ZGTRFS. */ if (info != 0) { alaerh_(path, "ZGTRFS", &info, &c__0, trans, &n, &n, & c_n1, &c_n1, &nrhs, &imat, &nfail, &nerrs, nout); } zget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, & result[3]); zgtt05_(trans, &n, &nrhs, &a[1], &a[m + 1], &a[n + m + 1], &b[1], &lda, &x[1], &lda, &xact[1], &lda, &rwork[ 1], &rwork[nrhs + 1], &result[4]); /* Print information about the tests that did not pass the */ /* threshold. */ for (k = 2; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___44.ciunit = *nout; s_wsfe(&io___44); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L70: */ } nrun += 5; /* L80: */ } /* L90: */ } L100: ; } /* L110: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZCHKGT */ } /* zchkgt_ */
/* Subroutine */ int zdrvpo_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, doublecomplex *afac, doublecomplex *asav, doublecomplex *b, doublecomplex *bsav, doublecomplex *x, doublecomplex *xact, doublereal *s, doublecomplex *work, doublereal * rwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char uplos[1*2] = "U" "L"; static char facts[1*3] = "F" "N" "E"; static char equeds[1*2] = "N" "Y"; /* Format strings */ static char fmt_9999[] = "(1x,a,\002, UPLO='\002,a1,\002', N =\002,i5" ",\002, type \002,i1,\002, test(\002,i1,\002)=\002,g12.5)"; static char fmt_9997[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002," "a1,\002', N=\002,i5,\002, EQUED='\002,a1,\002', type \002,i1," "\002, test(\002,i1,\002) =\002,g12.5)"; static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', UPLO='\002," "a1,\002', N=\002,i5,\002, type \002,i1,\002, test(\002,i1,\002)" "=\002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5[2]; char ch__1[2]; /* Local variables */ integer i__, k, n, k1, nb, in, kl, ku, nt, lda; char fact[1]; integer ioff, mode; doublereal amax; char path[3]; integer imat, info; char dist[1], uplo[1], type__[1]; integer nrun, ifact, nfail, iseed[4], nfact; char equed[1]; integer nbmin; doublereal rcond, roldc, scond; integer nimat; doublereal anorm; logical equil; integer iuplo, izero, nerrs; logical zerot; char xtype[1]; logical prefac; doublereal rcondc; logical nofact; integer iequed; doublereal cndnum; doublereal ainvnm; doublereal result[6]; /* Fortran I/O blocks */ static cilist io___48 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___51 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___52 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZDRVPO tests the driver routines ZPOSV and -SVX. */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NRHS (input) INTEGER */ /* The number of right hand side vectors to be generated for */ /* each linear system. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for N, used in dimensioning the */ /* work arrays. */ /* A (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */ /* AFAC (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */ /* ASAV (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */ /* B (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* BSAV (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* X (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) */ /* S (workspace) DOUBLE PRECISION array, dimension (NMAX) */ /* WORK (workspace) COMPLEX*16 array, dimension */ /* (NMAX*max(3,NRHS)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --rwork; --work; --s; --xact; --x; --bsav; --b; --asav; --afac; --a; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "PO", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrvx_(path, nout); } infoc_1.infot = 0; /* Set the block size and minimum block size for testing. */ nb = 1; nbmin = 2; xlaenv_(&c__1, &nb); xlaenv_(&c__2, &nbmin); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; nimat = 9; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L120; } /* Skip types 3, 4, or 5 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 5; if (zerot && n < imat - 2) { goto L120; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1]; /* Set up parameters with ZLATB4 and generate a test matrix */ /* with ZLATMS. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1], &info); /* Check error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L110; } /* For types 3-5, zero one row and column of the matrix to */ /* test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } ioff = (izero - 1) * lda; /* Set row and column IZERO of A to 0. */ if (iuplo == 1) { i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff += lda; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff += lda; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L50: */ } } } else { izero = 0; } /* Set the imaginary part of the diagonals. */ i__3 = lda + 1; zlaipd_(&n, &a[1], &i__3, &c__0); /* Save a copy of the matrix A in ASAV. */ zlacpy_(uplo, &n, &n, &a[1], &lda, &asav[1], &lda); for (iequed = 1; iequed <= 2; ++iequed) { *(unsigned char *)equed = *(unsigned char *)&equeds[ iequed - 1]; if (iequed == 1) { nfact = 3; } else { nfact = 1; } i__3 = nfact; for (ifact = 1; ifact <= i__3; ++ifact) { *(unsigned char *)fact = *(unsigned char *)&facts[ ifact - 1]; prefac = lsame_(fact, "F"); nofact = lsame_(fact, "N"); equil = lsame_(fact, "E"); if (zerot) { if (prefac) { goto L90; } rcondc = 0.; } else if (! lsame_(fact, "N")) { /* Compute the condition number for comparison with */ /* the value returned by ZPOSVX (FACT = 'N' reuses */ /* the condition number from the previous iteration */ /* with FACT = 'F'). */ zlacpy_(uplo, &n, &n, &asav[1], &lda, &afac[1], & lda); if (equil || iequed > 1) { /* Compute row and column scale factors to */ /* equilibrate the matrix A. */ zpoequ_(&n, &afac[1], &lda, &s[1], &scond, & amax, &info); if (info == 0 && n > 0) { if (iequed > 1) { scond = 0.; } /* Equilibrate the matrix. */ zlaqhe_(uplo, &n, &afac[1], &lda, &s[1], & scond, &amax, equed); } } /* Save the condition number of the */ /* non-equilibrated system for use in ZGET04. */ if (equil) { roldc = rcondc; } /* Compute the 1-norm of A. */ anorm = zlanhe_("1", uplo, &n, &afac[1], &lda, & rwork[1]); /* Factor the matrix A. */ zpotrf_(uplo, &n, &afac[1], &lda, &info); /* Form the inverse of A. */ zlacpy_(uplo, &n, &n, &afac[1], &lda, &a[1], &lda); zpotri_(uplo, &n, &a[1], &lda, &info); /* Compute the 1-norm condition number of A. */ ainvnm = zlanhe_("1", uplo, &n, &a[1], &lda, & rwork[1]); if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } } /* Restore the matrix A. */ zlacpy_(uplo, &n, &n, &asav[1], &lda, &a[1], &lda); /* Form an exact solution and set the right hand side. */ s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)32, (ftnlen) 6); zlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, nrhs, &a[1], &lda, &xact[1], &lda, &b[1], & lda, iseed, &info); *(unsigned char *)xtype = 'C'; zlacpy_("Full", &n, nrhs, &b[1], &lda, &bsav[1], &lda); if (nofact) { /* --- Test ZPOSV --- */ /* Compute the L*L' or U'*U factorization of the */ /* matrix and solve the system. */ zlacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda); zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], & lda); s_copy(srnamc_1.srnamt, "ZPOSV ", (ftnlen)32, ( ftnlen)6); zposv_(uplo, &n, nrhs, &afac[1], &lda, &x[1], & lda, &info); /* Check error code from ZPOSV . */ if (info != izero) { alaerh_(path, "ZPOSV ", &info, &izero, uplo, & n, &n, &c_n1, &c_n1, nrhs, &imat, & nfail, &nerrs, nout); goto L70; } else if (info != 0) { goto L70; } /* Reconstruct matrix from factors and compute */ /* residual. */ zpot01_(uplo, &n, &a[1], &lda, &afac[1], &lda, & rwork[1], result); /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], & lda); zpot02_(uplo, &n, nrhs, &a[1], &lda, &x[1], &lda, &work[1], &lda, &rwork[1], &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); nt = 3; /* Print information about the tests that did not */ /* pass the threshold. */ i__4 = nt; for (k = 1; k <= i__4; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___48.ciunit = *nout; s_wsfe(&io___48); do_fio(&c__1, "ZPOSV ", (ftnlen)6); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } /* L60: */ } nrun += nt; L70: ; } /* --- Test ZPOSVX --- */ if (! prefac) { zlaset_(uplo, &n, &n, &c_b51, &c_b51, &afac[1], & lda); } zlaset_("Full", &n, nrhs, &c_b51, &c_b51, &x[1], &lda); if (iequed > 1 && n > 0) { /* Equilibrate the matrix if FACT='F' and */ /* EQUED='Y'. */ zlaqhe_(uplo, &n, &a[1], &lda, &s[1], &scond, & amax, equed); } /* Solve the system and compute the condition number */ /* and error bounds using ZPOSVX. */ s_copy(srnamc_1.srnamt, "ZPOSVX", (ftnlen)32, (ftnlen) 6); zposvx_(fact, uplo, &n, nrhs, &a[1], &lda, &afac[1], & lda, equed, &s[1], &b[1], &lda, &x[1], &lda, & rcond, &rwork[1], &rwork[*nrhs + 1], &work[1], &rwork[(*nrhs << 1) + 1], &info); /* Check the error code from ZPOSVX. */ if (info != izero) { /* Writing concatenation */ i__5[0] = 1, a__1[0] = fact; i__5[1] = 1, a__1[1] = uplo; s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2); alaerh_(path, "ZPOSVX", &info, &izero, ch__1, &n, &n, &c_n1, &c_n1, nrhs, &imat, &nfail, & nerrs, nout); goto L90; } if (info == 0) { if (! prefac) { /* Reconstruct matrix from factors and compute */ /* residual. */ zpot01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &bsav[1], &lda, &work[1] , &lda); zpot02_(uplo, &n, nrhs, &asav[1], &lda, &x[1], & lda, &work[1], &lda, &rwork[(*nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ if (nofact || prefac && lsame_(equed, "N")) { zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &result[2]); } else { zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &roldc, &result[2]); } /* Check the error bounds from iterative */ /* refinement. */ zpot05_(uplo, &n, nrhs, &asav[1], &lda, &b[1], & lda, &x[1], &lda, &xact[1], &lda, &rwork[ 1], &rwork[*nrhs + 1], &result[3]); } else { k1 = 6; } /* Compare RCOND from ZPOSVX with the computed value */ /* in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = k1; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___51.ciunit = *nout; s_wsfe(&io___51); do_fio(&c__1, "ZPOSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); } else { io___52.ciunit = *nout; s_wsfe(&io___52); do_fio(&c__1, "ZPOSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); } ++nfail; } /* L80: */ } nrun = nrun + 7 - k1; L90: ; } /* L100: */ } L110: ; } L120: ; } /* L130: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZDRVPO */ } /* zdrvpo_ */
/* Subroutine */ int dchkpb_(logical *dotype, integer *nn, integer *nval, integer *nnb, integer *nbval, integer *nns, integer *nsval, doublereal *thresh, logical *tsterr, integer *nmax, doublereal *a, doublereal *afac, doublereal *ainv, doublereal *b, doublereal *x, doublereal *xact, doublereal *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; /* Format strings */ static char fmt_9999[] = "(\002 UPLO='\002,a1,\002', N=\002,i5,\002, KD" "=\002,i5,\002, NB=\002,i4,\002, type \002,i2,\002, test \002,i2" ",\002, ratio= \002,g12.5)"; static char fmt_9998[] = "(\002 UPLO='\002,a1,\002', N=\002,i5,\002, KD" "=\002,i5,\002, NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i" "2,\002) = \002,g12.5)"; static char fmt_9997[] = "(\002 UPLO='\002,a1,\002', N=\002,i5,\002, KD" "=\002,i5,\002,\002,10x,\002 type \002,i2,\002, test(\002,i2,\002" ") = \002,g12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5, i__6; /* Builtin functions Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ static integer ldab, ioff, mode, koff, imat, info; static char path[3], dist[1]; static integer irhs, nrhs; static char uplo[1], type__[1]; static integer nrun, i__; extern /* Subroutine */ int alahd_(integer *, char *); static integer k, n; extern /* Subroutine */ int dget04_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); static integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); extern /* Subroutine */ int dpbt01_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dpbt02_(char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dpbt05_(char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *); static integer kdval[4]; static doublereal rcond; static integer nimat; static doublereal anorm; extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, doublereal *, integer *), dswap_(integer *, doublereal *, integer *, doublereal *, integer *); static integer iuplo, izero, i1, i2, nerrs; static logical zerot; static char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *); static integer kd, nb, in, kl; extern doublereal dlange_(char *, integer *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); static integer iw, ku; extern doublereal dlansb_(char *, char *, integer *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int dpbcon_(char *, integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *); static doublereal rcondc; static char packit[1]; extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *), dlaset_(char *, integer *, integer *, doublereal *, doublereal *, doublereal *, integer *), dpbrfs_(char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *), dpbtrf_(char *, integer *, integer *, doublereal *, integer *, integer *), alasum_(char *, integer *, integer *, integer *, integer *); static doublereal cndnum; extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *); static doublereal ainvnm; extern /* Subroutine */ int derrpo_(char *, integer *), dpbtrs_( char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *), xlaenv_(integer *, integer *); static doublereal result[7]; static integer lda, ikd, inb, nkd; /* Fortran I/O blocks */ static cilist io___40 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___46 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___48 = { 0, 0, 0, fmt_9997, 0 }; /* -- LAPACK test routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University December 7, 1999 Purpose ======= DCHKPB tests DPBTRF, -TRS, -RFS, and -CON. Arguments ========= DOTYPE (input) 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. NN (input) INTEGER The number of values of N contained in the vector NVAL. NVAL (input) INTEGER array, dimension (NN) The values of the matrix dimension N. NNB (input) INTEGER The number of values of NB contained in the vector NBVAL. NBVAL (input) INTEGER array, dimension (NBVAL) The values of the blocksize NB. NNS (input) INTEGER The number of values of NRHS contained in the vector NSVAL. NSVAL (input) INTEGER array, dimension (NNS) The values of the number of right hand sides NRHS. THRESH (input) 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. TSTERR (input) LOGICAL Flag that indicates whether error exits are to be tested. NMAX (input) INTEGER The maximum value permitted for N, used in dimensioning the work arrays. A (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) AFAC (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) AINV (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) B (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) where NSMAX is the largest entry in NSVAL. X (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) WORK (workspace) DOUBLE PRECISION array, dimension (NMAX*max(3,NSMAX)) RWORK (workspace) DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX)) IWORK (workspace) INTEGER array, dimension (NMAX) NOUT (input) INTEGER The unit number for output. ===================================================================== Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nsval; --nbval; --nval; --dotype; /* Function Body Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "PB", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { derrpo_(path, nout); } infoc_1.infot = 0; xlaenv_(&c__2, &c__2); kdval[0] = 0; /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; /* Set limits on the number of loop iterations. Computing MAX */ i__2 = 1, i__3 = min(n,4); nkd = max(i__2,i__3); nimat = 8; if (n == 0) { nimat = 1; } kdval[1] = n + (n + 1) / 4; kdval[2] = (n * 3 - 1) / 4; kdval[3] = (n + 1) / 4; i__2 = nkd; for (ikd = 1; ikd <= i__2; ++ikd) { /* Do for KD = 0, (5*N+1)/4, (3N-1)/4, and (N+1)/4. This order makes it easier to skip redundant values for small values of N. */ kd = kdval[ikd - 1]; ldab = kd + 1; /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { koff = 1; if (iuplo == 1) { *(unsigned char *)uplo = 'U'; /* Computing MAX */ i__3 = 1, i__4 = kd + 2 - n; koff = max(i__3,i__4); *(unsigned char *)packit = 'Q'; } else { *(unsigned char *)uplo = 'L'; *(unsigned char *)packit = 'B'; } i__3 = nimat; for (imat = 1; imat <= i__3; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L60; } /* Skip types 2, 3, or 4 if the matrix size is too small. */ zerot = imat >= 2 && imat <= 4; if (zerot && n < imat - 1) { goto L60; } if (! zerot || ! dotype[1]) { /* Set up parameters with DLATB4 and generate a test matrix with DLATMS. */ dlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)6, (ftnlen) 6); dlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cndnum, &anorm, &kd, &kd, packit, &a[koff], &ldab, &work[1], &info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, uplo, &n, & n, &kd, &kd, &c_n1, &imat, &nfail, &nerrs, nout); goto L60; } } else if (izero > 0) { /* Use the same matrix for types 3 and 4 as for type 2 by copying back the zeroed out column, */ iw = (lda << 1) + 1; if (iuplo == 1) { ioff = (izero - 1) * ldab + kd + 1; i__4 = izero - i1; dcopy_(&i__4, &work[iw], &c__1, &a[ioff - izero + i1], &c__1); iw = iw + izero - i1; i__4 = i2 - izero + 1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); dcopy_(&i__4, &work[iw], &c__1, &a[ioff], &i__5); } else { ioff = (i1 - 1) * ldab + 1; i__4 = izero - i1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); dcopy_(&i__4, &work[iw], &c__1, &a[ioff + izero - i1], &i__5); ioff = (izero - 1) * ldab + 1; iw = iw + izero - i1; i__4 = i2 - izero + 1; dcopy_(&i__4, &work[iw], &c__1, &a[ioff], &c__1); } } /* For types 2-4, zero one row and column of the matrix to test that INFO is returned correctly. */ izero = 0; if (zerot) { if (imat == 2) { izero = 1; } else if (imat == 3) { izero = n; } else { izero = n / 2 + 1; } /* Save the zeroed out row and column in WORK(*,3) */ iw = lda << 1; /* Computing MIN */ i__5 = (kd << 1) + 1; i__4 = min(i__5,n); for (i__ = 1; i__ <= i__4; ++i__) { work[iw + i__] = 0.; /* L20: */ } ++iw; /* Computing MAX */ i__4 = izero - kd; i1 = max(i__4,1); /* Computing MIN */ i__4 = izero + kd; i2 = min(i__4,n); if (iuplo == 1) { ioff = (izero - 1) * ldab + kd + 1; i__4 = izero - i1; dswap_(&i__4, &a[ioff - izero + i1], &c__1, &work[ iw], &c__1); iw = iw + izero - i1; i__4 = i2 - izero + 1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); dswap_(&i__4, &a[ioff], &i__5, &work[iw], &c__1); } else { ioff = (i1 - 1) * ldab + 1; i__4 = izero - i1; /* Computing MAX */ i__6 = ldab - 1; i__5 = max(i__6,1); dswap_(&i__4, &a[ioff + izero - i1], &i__5, &work[ iw], &c__1); ioff = (izero - 1) * ldab + 1; iw = iw + izero - i1; i__4 = i2 - izero + 1; dswap_(&i__4, &a[ioff], &c__1, &work[iw], &c__1); } } /* Do for each value of NB in NBVAL */ i__4 = *nnb; for (inb = 1; inb <= i__4; ++inb) { nb = nbval[inb]; xlaenv_(&c__1, &nb); /* Compute the L*L' or U'*U factorization of the band matrix. */ i__5 = kd + 1; dlacpy_("Full", &i__5, &n, &a[1], &ldab, &afac[1], & ldab); s_copy(srnamc_1.srnamt, "DPBTRF", (ftnlen)6, (ftnlen) 6); dpbtrf_(uplo, &n, &kd, &afac[1], &ldab, &info); /* Check error code from DPBTRF. */ if (info != izero) { alaerh_(path, "DPBTRF", &info, &izero, uplo, &n, & n, &kd, &kd, &nb, &imat, &nfail, &nerrs, nout); goto L50; } /* Skip the tests if INFO is not 0. */ if (info != 0) { goto L50; } /* + TEST 1 Reconstruct matrix from factors and compute residual. */ i__5 = kd + 1; dlacpy_("Full", &i__5, &n, &afac[1], &ldab, &ainv[1], &ldab); dpbt01_(uplo, &n, &kd, &a[1], &ldab, &ainv[1], &ldab, &rwork[1], result); /* Print the test ratio if it is .GE. THRESH. */ if (result[0] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___40.ciunit = *nout; s_wsfe(&io___40); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; /* Only do other tests if this is the first blocksize. */ if (inb > 1) { goto L50; } /* Form the inverse of A so we can get a good estimate of RCONDC = 1/(norm(A) * norm(inv(A))). */ dlaset_("Full", &n, &n, &c_b50, &c_b51, &ainv[1], & lda); s_copy(srnamc_1.srnamt, "DPBTRS", (ftnlen)6, (ftnlen) 6); dpbtrs_(uplo, &n, &kd, &n, &afac[1], &ldab, &ainv[1], &lda, &info); /* Compute RCONDC = 1/(norm(A) * norm(inv(A))). */ anorm = dlansb_("1", uplo, &n, &kd, &a[1], &ldab, & rwork[1]); ainvnm = dlange_("1", &n, &n, &ainv[1], &lda, &rwork[ 1]); if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } i__5 = *nns; for (irhs = 1; irhs <= i__5; ++irhs) { nrhs = nsval[irhs]; /* + TEST 2 Solve and compute residual for A * X = B. */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)6, ( ftnlen)6); dlarhs_(path, xtype, uplo, " ", &n, &n, &kd, &kd, &nrhs, &a[1], &ldab, &xact[1], &lda, &b[1] , &lda, iseed, &info); dlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], & lda); s_copy(srnamc_1.srnamt, "DPBTRS", (ftnlen)6, ( ftnlen)6); dpbtrs_(uplo, &n, &kd, &nrhs, &afac[1], &ldab, &x[ 1], &lda, &info); /* Check error code from DPBTRS. */ if (info != 0) { alaerh_(path, "DPBTRS", &info, &c__0, uplo, & n, &n, &kd, &kd, &nrhs, &imat, &nfail, &nerrs, nout); } dlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda); dpbt02_(uplo, &n, &kd, &nrhs, &a[1], &ldab, &x[1], &lda, &work[1], &lda, &rwork[1], &result[ 1]); /* + TEST 3 Check solution from generated exact solution. */ dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); /* + TESTS 4, 5, and 6 Use iterative refinement to improve the solution. */ s_copy(srnamc_1.srnamt, "DPBRFS", (ftnlen)6, ( ftnlen)6); dpbrfs_(uplo, &n, &kd, &nrhs, &a[1], &ldab, &afac[ 1], &ldab, &b[1], &lda, &x[1], &lda, & rwork[1], &rwork[nrhs + 1], &work[1], & iwork[1], &info); /* Check error code from DPBRFS. */ if (info != 0) { alaerh_(path, "DPBRFS", &info, &c__0, uplo, & n, &n, &kd, &kd, &nrhs, &imat, &nfail, &nerrs, nout); } dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[3]); dpbt05_(uplo, &n, &kd, &nrhs, &a[1], &ldab, &b[1], &lda, &x[1], &lda, &xact[1], &lda, & rwork[1], &rwork[nrhs + 1], &result[4]); /* Print information about the tests that did not pass the threshold. */ for (k = 2; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___46.ciunit = *nout; s_wsfe(&io___46); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&kd, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&nrhs, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } /* L30: */ } nrun += 5; /* L40: */ } /* + TEST 7 Get an estimate of RCOND = 1/CNDNUM. */ s_copy(srnamc_1.srnamt, "DPBCON", (ftnlen)6, (ftnlen) 6); dpbcon_(uplo, &n, &kd, &afac[1], &ldab, &anorm, & rcond, &work[1], &iwork[1], &info); /* Check error code from DPBCON. */ if (info != 0) { alaerh_(path, "DPBCON", &info, &c__0, uplo, &n, & n, &kd, &kd, &c_n1, &imat, &nfail, &nerrs, nout); } result[6] = dget06_(&rcond, &rcondc); /* Print the test ratio if it is .GE. THRESH. */ if (result[6] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___48.ciunit = *nout; s_wsfe(&io___48); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&kd, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[6], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; L50: ; } L60: ; } /* L70: */ } /* L80: */ } /* L90: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of DCHKPB */ } /* dchkpb_ */
/* Subroutine */ int dchkpo_(logical *dotype, integer *nn, integer *nval, integer *nnb, integer *nbval, integer *nns, integer *nsval, doublereal *thresh, logical *tsterr, integer *nmax, doublereal *a, doublereal *afac, doublereal *ainv, doublereal *b, doublereal *x, doublereal *xact, doublereal *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char uplos[1*2] = "U" "L"; /* Format strings */ static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "NB =\002,i4,\002, type \002,i2,\002, test \002,i2,\002, ratio " "=\002,g12.5)"; static char fmt_9998[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, " "NRHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g" "12.5)"; static char fmt_9997[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002" ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)" ; /* System generated locals */ integer i__1, i__2, i__3, i__4; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, k, n, nb, in, kl, ku, lda, inb, ioff, mode, imat, info; char path[3], dist[1]; integer irhs, nrhs; char uplo[1], type__[1]; integer nrun; extern /* Subroutine */ int alahd_(integer *, char *), dget04_( integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); doublereal rcond; extern /* Subroutine */ int dpot01_(char *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer nimat; extern /* Subroutine */ int dpot02_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dpot03_(char *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *), dpot05_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *); doublereal anorm; integer iuplo, izero, nerrs; logical zerot; char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); doublereal rcondc; extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *), alasum_(char *, integer *, integer *, integer *, integer *); doublereal cndnum; extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *), dpocon_(char *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *); extern doublereal dlansy_(char *, char *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int derrpo_(char *, integer *), dporfs_( char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *), dpotrf_(char *, integer *, doublereal *, integer *, integer *), xlaenv_(integer *, integer *), dpotri_(char *, integer *, doublereal *, integer *, integer *), dpotrs_( char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *); doublereal result[8]; /* Fortran I/O blocks */ static cilist io___33 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___36 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___38 = { 0, 0, 0, fmt_9997, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* DCHKPO tests DPOTRF, -TRI, -TRS, -RFS, and -CON */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NNB (input) INTEGER */ /* The number of values of NB contained in the vector NBVAL. */ /* NBVAL (input) INTEGER array, dimension (NBVAL) */ /* The values of the blocksize NB. */ /* NNS (input) INTEGER */ /* The number of values of NRHS contained in the vector NSVAL. */ /* NSVAL (input) INTEGER array, dimension (NNS) */ /* The values of the number of right hand sides NRHS. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for N, used in dimensioning the */ /* work arrays. */ /* A (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* AFAC (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* AINV (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* B (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* where NSMAX is the largest entry in NSVAL. */ /* X (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* WORK (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*max(3,NSMAX)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension */ /* (max(NMAX,2*NSMAX)) */ /* IWORK (workspace) INTEGER array, dimension (NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nsval; --nbval; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "PO", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { derrpo_(path, nout); } infoc_1.infot = 0; xlaenv_(&c__2, &c__2); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; nimat = 9; if (n <= 0) { nimat = 1; } izero = 0; i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L110; } /* Skip types 3, 4, or 5 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 5; if (zerot && n < imat - 2) { goto L110; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1]; /* Set up parameters with DLATB4 and generate a test matrix */ /* with DLATMS. */ dlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)6, (ftnlen)6); dlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1], &info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L100; } /* For types 3-5, zero one row and column of the matrix to */ /* test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } ioff = (izero - 1) * lda; /* Set row and column IZERO of A to 0. */ if (iuplo == 1) { i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff += lda; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff += lda; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L50: */ } } } else { izero = 0; } /* Do for each value of NB in NBVAL */ i__3 = *nnb; for (inb = 1; inb <= i__3; ++inb) { nb = nbval[inb]; xlaenv_(&c__1, &nb); /* Compute the L*L' or U'*U factorization of the matrix. */ dlacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda); s_copy(srnamc_1.srnamt, "DPOTRF", (ftnlen)6, (ftnlen)6); dpotrf_(uplo, &n, &afac[1], &lda, &info); /* Check error code from DPOTRF. */ if (info != izero) { alaerh_(path, "DPOTRF", &info, &izero, uplo, &n, &n, & c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout); goto L90; } /* Skip the tests if INFO is not 0. */ if (info != 0) { goto L90; } /* + TEST 1 */ /* Reconstruct matrix from factors and compute residual. */ dlacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda); dpot01_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &rwork[1], result); /* + TEST 2 */ /* Form the inverse and compute the residual. */ dlacpy_(uplo, &n, &n, &afac[1], &lda, &ainv[1], &lda); s_copy(srnamc_1.srnamt, "DPOTRI", (ftnlen)6, (ftnlen)6); dpotri_(uplo, &n, &ainv[1], &lda, &info); /* Check error code from DPOTRI. */ if (info != 0) { alaerh_(path, "DPOTRI", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } dpot03_(uplo, &n, &a[1], &lda, &ainv[1], &lda, &work[1], & lda, &rwork[1], &rcondc, &result[1]); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = 1; k <= 2; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___33.ciunit = *nout; s_wsfe(&io___33); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L60: */ } nrun += 2; /* Skip the rest of the tests unless this is the first */ /* blocksize. */ if (inb != 1) { goto L90; } i__4 = *nns; for (irhs = 1; irhs <= i__4; ++irhs) { nrhs = nsval[irhs]; /* + TEST 3 */ /* Solve and compute residual for A * X = B . */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)6, (ftnlen) 6); dlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, & nrhs, &a[1], &lda, &xact[1], &lda, &b[1], & lda, iseed, &info); dlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "DPOTRS", (ftnlen)6, (ftnlen) 6); dpotrs_(uplo, &n, &nrhs, &afac[1], &lda, &x[1], &lda, &info); /* Check error code from DPOTRS. */ if (info != 0) { alaerh_(path, "DPOTRS", &info, &c__0, uplo, &n, & n, &c_n1, &c_n1, &nrhs, &imat, &nfail, & nerrs, nout); } dlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], & lda); dpot02_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, & work[1], &lda, &rwork[1], &result[2]); /* + TEST 4 */ /* Check solution from generated exact solution. */ dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[3]); /* + TESTS 5, 6, and 7 */ /* Use iterative refinement to improve the solution. */ s_copy(srnamc_1.srnamt, "DPORFS", (ftnlen)6, (ftnlen) 6); dporfs_(uplo, &n, &nrhs, &a[1], &lda, &afac[1], &lda, &b[1], &lda, &x[1], &lda, &rwork[1], &rwork[ nrhs + 1], &work[1], &iwork[1], &info); /* Check error code from DPORFS. */ if (info != 0) { alaerh_(path, "DPORFS", &info, &c__0, uplo, &n, & n, &c_n1, &c_n1, &nrhs, &imat, &nfail, & nerrs, nout); } dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[4]); dpot05_(uplo, &n, &nrhs, &a[1], &lda, &b[1], &lda, &x[ 1], &lda, &xact[1], &lda, &rwork[1], &rwork[ nrhs + 1], &result[5]); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = 3; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___36.ciunit = *nout; s_wsfe(&io___36); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L70: */ } nrun += 5; /* L80: */ } /* + TEST 8 */ /* Get an estimate of RCOND = 1/CNDNUM. */ anorm = dlansy_("1", uplo, &n, &a[1], &lda, &rwork[1]); s_copy(srnamc_1.srnamt, "DPOCON", (ftnlen)6, (ftnlen)6); dpocon_(uplo, &n, &afac[1], &lda, &anorm, &rcond, &work[1] , &iwork[1], &info); /* Check error code from DPOCON. */ if (info != 0) { alaerh_(path, "DPOCON", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); } result[7] = dget06_(&rcond, &rcondc); /* Print the test ratio if it is .GE. THRESH. */ if (result[7] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___38.ciunit = *nout; s_wsfe(&io___38); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; L90: ; } L100: ; } L110: ; } /* L120: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of DCHKPO */ } /* dchkpo_ */
/* Subroutine */ int ddrvge_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, integer *nmax, doublereal *a, doublereal *afac, doublereal *asav, doublereal *b, doublereal *bsav, doublereal *x, doublereal *xact, doublereal *s, doublereal *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char transs[1*3] = "N" "T" "C"; static char facts[1*3] = "F" "N" "E"; static char equeds[1*4] = "N" "R" "C" "B"; /* Format strings */ static char fmt_9999[] = "(1x,a,\002, N =\002,i5,\002, type \002,i2,\002" ", test(\002,i2,\002) =\002,g12.5)"; static char fmt_9997[] = "(1x,a,\002, FACT='\002,a1,\002', TRANS='\002,a" "1,\002', N=\002,i5,\002, EQUED='\002,a1,\002', type \002,i2,\002" ", test(\002,i1,\002)=\002,g12.5)"; static char fmt_9998[] = "(1x,a,\002, FACT='\002,a1,\002', TRANS='\002,a" "1,\002', N=\002,i5,\002, type \002,i2,\002, test(\002,i1,\002)" "=\002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5[2]; doublereal d__1; char ch__1[2]; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ extern /* Subroutine */ int debchvxx_(doublereal *, char *); integer i__, k, n; doublereal *errbnds_c__, *errbnds_n__; integer k1, nb, in, kl, ku, nt, n_err_bnds__; extern doublereal dla_rpvgrw__(integer *, integer *, doublereal *, integer *, doublereal *, integer *); integer lda; char fact[1]; integer ioff, mode; doublereal amax; char path[3]; integer imat, info; doublereal *berr; char dist[1]; doublereal rpvgrw_svxx__; char type__[1]; integer nrun; extern /* Subroutine */ int dget01_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, doublereal *, doublereal *), dget02_(char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer ifact; extern /* Subroutine */ int dget04_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer nfail, iseed[4], nfact; extern doublereal dget06_(doublereal *, doublereal *); extern /* Subroutine */ int dget07_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, logical *, doublereal *, doublereal *); extern logical lsame_(char *, char *); char equed[1]; integer nbmin; doublereal rcond, roldc; integer nimat; doublereal roldi; extern /* Subroutine */ int dgesv_(integer *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *); doublereal anorm; integer itran; logical equil; doublereal roldo; char trans[1]; integer izero, nerrs, lwork; logical zerot; char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *); extern doublereal dlamch_(char *), dlange_(char *, integer *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *), dlaqge_(integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, doublereal *, doublereal *, char *); logical prefac; doublereal colcnd, rcondc; logical nofact; integer iequed; extern /* Subroutine */ int dgeequ_(integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, doublereal *, doublereal *, integer *); doublereal rcondi; extern /* Subroutine */ int dgetrf_(integer *, integer *, doublereal *, integer *, integer *, integer *), dgetri_(integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *), dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), alasvm_(char *, integer *, integer *, integer *, integer *); doublereal cndnum, anormi, rcondo, ainvnm; extern doublereal dlantr_(char *, char *, char *, integer *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *); logical trfcon; doublereal anormo, rowcnd; extern /* Subroutine */ int dlaset_(char *, integer *, integer *, doublereal *, doublereal *, doublereal *, integer *), dgesvx_(char *, char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, char *, doublereal *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, doublereal *, integer * , integer *), dlatms_(integer *, integer * , char *, integer *, char *, doublereal *, integer *, doublereal * , doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *), xlaenv_(integer *, integer *), derrvx_(char *, integer *); doublereal result[7], rpvgrw; extern /* Subroutine */ int dgesvxx_(char *, char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, char *, doublereal *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, doublereal *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *); /* Fortran I/O blocks */ static cilist io___55 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___61 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___62 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___63 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___64 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___65 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___66 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___67 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___68 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___74 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___75 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___76 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___77 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___78 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___79 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___80 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___81 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* DDRVGE tests the driver routines DGESV, -SVX, and -SVXX. */ /* Note that this file is used only when the XBLAS are available, */ /* otherwise ddrvge.f defines this subroutine. */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix column dimension N. */ /* NRHS (input) INTEGER */ /* The number of right hand side vectors to be generated for */ /* each linear system. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for N, used in dimensioning the */ /* work arrays. */ /* A (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* AFAC (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* ASAV (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* B (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* BSAV (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* X (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* S (workspace) DOUBLE PRECISION array, dimension (2*NMAX) */ /* WORK (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*max(3,NRHS)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (2*NRHS+NMAX) */ /* IWORK (workspace) INTEGER array, dimension (2*NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --s; --xact; --x; --bsav; --b; --asav; --afac; --a; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "GE", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { derrvx_(path, nout); } infoc_1.infot = 0; /* Set the block size and minimum block size for testing. */ nb = 1; nbmin = 2; xlaenv_(&c__1, &nb); xlaenv_(&c__2, &nbmin); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); *(unsigned char *)xtype = 'N'; nimat = 11; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L80; } /* Skip types 5, 6, or 7 if the matrix size is too small. */ zerot = imat >= 5 && imat <= 7; if (zerot && n < imat - 4) { goto L80; } /* Set up parameters with DLATB4 and generate a test matrix */ /* with DLATMS. */ dlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, & cndnum, dist); rcondc = 1. / cndnum; s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)32, (ftnlen)6); dlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cndnum, & anorm, &kl, &ku, "No packing", &a[1], &lda, &work[1], & info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, " ", &n, &n, &c_n1, & c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L80; } /* For types 5-7, zero one or more columns of the matrix to */ /* test that INFO is returned correctly. */ if (zerot) { if (imat == 5) { izero = 1; } else if (imat == 6) { izero = n; } else { izero = n / 2 + 1; } ioff = (izero - 1) * lda; if (imat < 7) { i__3 = n; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L20: */ } } else { i__3 = n - izero + 1; dlaset_("Full", &n, &i__3, &c_b20, &c_b20, &a[ioff + 1], & lda); } } else { izero = 0; } /* Save a copy of the matrix A in ASAV. */ dlacpy_("Full", &n, &n, &a[1], &lda, &asav[1], &lda); for (iequed = 1; iequed <= 4; ++iequed) { *(unsigned char *)equed = *(unsigned char *)&equeds[iequed - 1]; if (iequed == 1) { nfact = 3; } else { nfact = 1; } i__3 = nfact; for (ifact = 1; ifact <= i__3; ++ifact) { *(unsigned char *)fact = *(unsigned char *)&facts[ifact - 1]; prefac = lsame_(fact, "F"); nofact = lsame_(fact, "N"); equil = lsame_(fact, "E"); if (zerot) { if (prefac) { goto L60; } rcondo = 0.; rcondi = 0.; } else if (! nofact) { /* Compute the condition number for comparison with */ /* the value returned by DGESVX (FACT = 'N' reuses */ /* the condition number from the previous iteration */ /* with FACT = 'F'). */ dlacpy_("Full", &n, &n, &asav[1], &lda, &afac[1], & lda); if (equil || iequed > 1) { /* Compute row and column scale factors to */ /* equilibrate the matrix A. */ dgeequ_(&n, &n, &afac[1], &lda, &s[1], &s[n + 1], &rowcnd, &colcnd, &amax, &info); if (info == 0 && n > 0) { if (lsame_(equed, "R")) { rowcnd = 0.; colcnd = 1.; } else if (lsame_(equed, "C")) { rowcnd = 1.; colcnd = 0.; } else if (lsame_(equed, "B")) { rowcnd = 0.; colcnd = 0.; } /* Equilibrate the matrix. */ dlaqge_(&n, &n, &afac[1], &lda, &s[1], &s[n + 1], &rowcnd, &colcnd, &amax, equed); } } /* Save the condition number of the non-equilibrated */ /* system for use in DGET04. */ if (equil) { roldo = rcondo; roldi = rcondi; } /* Compute the 1-norm and infinity-norm of A. */ anormo = dlange_("1", &n, &n, &afac[1], &lda, &rwork[ 1]); anormi = dlange_("I", &n, &n, &afac[1], &lda, &rwork[ 1]); /* Factor the matrix A. */ dgetrf_(&n, &n, &afac[1], &lda, &iwork[1], &info); /* Form the inverse of A. */ dlacpy_("Full", &n, &n, &afac[1], &lda, &a[1], &lda); lwork = *nmax * max(3,*nrhs); dgetri_(&n, &a[1], &lda, &iwork[1], &work[1], &lwork, &info); /* Compute the 1-norm condition number of A. */ ainvnm = dlange_("1", &n, &n, &a[1], &lda, &rwork[1]); if (anormo <= 0. || ainvnm <= 0.) { rcondo = 1.; } else { rcondo = 1. / anormo / ainvnm; } /* Compute the infinity-norm condition number of A. */ ainvnm = dlange_("I", &n, &n, &a[1], &lda, &rwork[1]); if (anormi <= 0. || ainvnm <= 0.) { rcondi = 1.; } else { rcondi = 1. / anormi / ainvnm; } } for (itran = 1; itran <= 3; ++itran) { for (i__ = 1; i__ <= 7; ++i__) { result[i__ - 1] = 0.; } /* Do for each value of TRANS. */ *(unsigned char *)trans = *(unsigned char *)&transs[ itran - 1]; if (itran == 1) { rcondc = rcondo; } else { rcondc = rcondi; } /* Restore the matrix A. */ dlacpy_("Full", &n, &n, &asav[1], &lda, &a[1], &lda); /* Form an exact solution and set the right hand side. */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)32, (ftnlen) 6); dlarhs_(path, xtype, "Full", trans, &n, &n, &kl, &ku, nrhs, &a[1], &lda, &xact[1], &lda, &b[1], & lda, iseed, &info); *(unsigned char *)xtype = 'C'; dlacpy_("Full", &n, nrhs, &b[1], &lda, &bsav[1], &lda); if (nofact && itran == 1) { /* --- Test DGESV --- */ /* Compute the LU factorization of the matrix and */ /* solve the system. */ dlacpy_("Full", &n, &n, &a[1], &lda, &afac[1], & lda); dlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], & lda); s_copy(srnamc_1.srnamt, "DGESV ", (ftnlen)32, ( ftnlen)6); dgesv_(&n, nrhs, &afac[1], &lda, &iwork[1], &x[1], &lda, &info); /* Check error code from DGESV . */ if (info != izero) { alaerh_(path, "DGESV ", &info, &izero, " ", & n, &n, &c_n1, &c_n1, nrhs, &imat, & nfail, &nerrs, nout); goto L50; } /* Reconstruct matrix from factors and compute */ /* residual. */ dget01_(&n, &n, &a[1], &lda, &afac[1], &lda, & iwork[1], &rwork[1], result); nt = 1; if (izero == 0) { /* Compute residual of the computed solution. */ dlacpy_("Full", &n, nrhs, &b[1], &lda, &work[ 1], &lda); dget02_("No transpose", &n, &n, nrhs, &a[1], & lda, &x[1], &lda, &work[1], &lda, & rwork[1], &result[1]); /* Check solution from generated exact solution. */ dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &result[2]); nt = 3; } /* Print information about the tests that did not */ /* pass the threshold. */ i__4 = nt; for (k = 1; k <= i__4; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___55.ciunit = *nout; s_wsfe(&io___55); do_fio(&c__1, "DGESV ", (ftnlen)6); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } /* L30: */ } nrun += nt; } /* --- Test DGESVX --- */ if (! prefac) { dlaset_("Full", &n, &n, &c_b20, &c_b20, &afac[1], &lda); } dlaset_("Full", &n, nrhs, &c_b20, &c_b20, &x[1], &lda); if (iequed > 1 && n > 0) { /* Equilibrate the matrix if FACT = 'F' and */ /* EQUED = 'R', 'C', or 'B'. */ dlaqge_(&n, &n, &a[1], &lda, &s[1], &s[n + 1], & rowcnd, &colcnd, &amax, equed); } /* Solve the system and compute the condition number */ /* and error bounds using DGESVX. */ s_copy(srnamc_1.srnamt, "DGESVX", (ftnlen)32, (ftnlen) 6); dgesvx_(fact, trans, &n, nrhs, &a[1], &lda, &afac[1], &lda, &iwork[1], equed, &s[1], &s[n + 1], &b[ 1], &lda, &x[1], &lda, &rcond, &rwork[1], & rwork[*nrhs + 1], &work[1], &iwork[n + 1], & info); /* Check the error code from DGESVX. */ if (info == n + 1) { goto L50; } if (info != izero) { /* Writing concatenation */ i__5[0] = 1, a__1[0] = fact; i__5[1] = 1, a__1[1] = trans; s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2); alaerh_(path, "DGESVX", &info, &izero, ch__1, &n, &n, &c_n1, &c_n1, nrhs, &imat, &nfail, & nerrs, nout); goto L50; } /* Compare WORK(1) from DGESVX with the computed */ /* reciprocal pivot growth factor RPVGRW */ if (info != 0) { rpvgrw = dlantr_("M", "U", "N", &info, &info, & afac[1], &lda, &work[1]); if (rpvgrw == 0.) { rpvgrw = 1.; } else { rpvgrw = dlange_("M", &n, &info, &a[1], &lda, &work[1]) / rpvgrw; } } else { rpvgrw = dlantr_("M", "U", "N", &n, &n, &afac[1], &lda, &work[1]); if (rpvgrw == 0.) { rpvgrw = 1.; } else { rpvgrw = dlange_("M", &n, &n, &a[1], &lda, & work[1]) / rpvgrw; } } result[6] = (d__1 = rpvgrw - work[1], abs(d__1)) / max(work[1],rpvgrw) / dlamch_("E"); if (! prefac) { /* Reconstruct matrix from factors and compute */ /* residual. */ dget01_(&n, &n, &a[1], &lda, &afac[1], &lda, & iwork[1], &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } if (info == 0) { trfcon = FALSE_; /* Compute residual of the computed solution. */ dlacpy_("Full", &n, nrhs, &bsav[1], &lda, &work[1] , &lda); dget02_(trans, &n, &n, nrhs, &asav[1], &lda, &x[1] , &lda, &work[1], &lda, &rwork[(*nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ if (nofact || prefac && lsame_(equed, "N")) { dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &result[2]); } else { if (itran == 1) { roldc = roldo; } else { roldc = roldi; } dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &roldc, &result[2]); } /* Check the error bounds from iterative */ /* refinement. */ dget07_(trans, &n, nrhs, &asav[1], &lda, &b[1], & lda, &x[1], &lda, &xact[1], &lda, &rwork[ 1], &c_true, &rwork[*nrhs + 1], &result[3] ); } else { trfcon = TRUE_; } /* Compare RCOND from DGESVX with the computed value */ /* in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ if (! trfcon) { for (k = k1; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___61.ciunit = *nout; s_wsfe(&io___61); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } else { io___62.ciunit = *nout; s_wsfe(&io___62); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } ++nfail; } /* L40: */ } nrun = nrun + 7 - k1; } else { if (result[0] >= *thresh && ! prefac) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___63.ciunit = *nout; s_wsfe(&io___63); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__1, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[0], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___64.ciunit = *nout; s_wsfe(&io___64); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__1, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[0], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } if (result[5] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___65.ciunit = *nout; s_wsfe(&io___65); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__6, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[5], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___66.ciunit = *nout; s_wsfe(&io___66); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__6, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[5], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } if (result[6] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___67.ciunit = *nout; s_wsfe(&io___67); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___68.ciunit = *nout; s_wsfe(&io___68); do_fio(&c__1, "DGESVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } } /* --- Test DGESVXX --- */ /* Restore the matrices A and B. */ dlacpy_("Full", &n, &n, &asav[1], &lda, &a[1], &lda); dlacpy_("Full", &n, nrhs, &bsav[1], &lda, &b[1], &lda); if (! prefac) { dlaset_("Full", &n, &n, &c_b20, &c_b20, &afac[1], &lda); } dlaset_("Full", &n, nrhs, &c_b20, &c_b20, &x[1], &lda); if (iequed > 1 && n > 0) { /* Equilibrate the matrix if FACT = 'F' and */ /* EQUED = 'R', 'C', or 'B'. */ dlaqge_(&n, &n, &a[1], &lda, &s[1], &s[n + 1], & rowcnd, &colcnd, &amax, equed); } /* Solve the system and compute the condition number */ /* and error bounds using DGESVXX. */ s_copy(srnamc_1.srnamt, "DGESVXX", (ftnlen)32, ( ftnlen)7); n_err_bnds__ = 3; dalloc3(); dgesvxx_(fact, trans, &n, nrhs, &a[1], &lda, &afac[1], &lda, &iwork[1], equed, &s[1], &s[n + 1], &b[ 1], &lda, &x[1], &lda, &rcond, &rpvgrw_svxx__, berr, &n_err_bnds__, errbnds_n__, errbnds_c__, &c__0, &c_b20, &work[1], &iwork[ n + 1], &info); free3(); /* Check the error code from DGESVXX. */ if (info == n + 1) { goto L50; } if (info != izero) { /* Writing concatenation */ i__5[0] = 1, a__1[0] = fact; i__5[1] = 1, a__1[1] = trans; s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2); alaerh_(path, "DGESVXX", &info, &izero, ch__1, &n, &n, &c_n1, &c_n1, nrhs, &imat, &nfail, & nerrs, nout); goto L50; } /* Compare rpvgrw_svxx from DGESVXX with the computed */ /* reciprocal pivot growth factor RPVGRW */ if (info > 0 && info < n + 1) { rpvgrw = dla_rpvgrw__(&n, &info, &a[1], &lda, & afac[1], &lda); } else { rpvgrw = dla_rpvgrw__(&n, &n, &a[1], &lda, &afac[ 1], &lda); } result[6] = (d__1 = rpvgrw - rpvgrw_svxx__, abs(d__1)) / max(rpvgrw_svxx__,rpvgrw) / dlamch_("E"); if (! prefac) { /* Reconstruct matrix from factors and compute */ /* residual. */ dget01_(&n, &n, &a[1], &lda, &afac[1], &lda, & iwork[1], &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } if (info == 0) { trfcon = FALSE_; /* Compute residual of the computed solution. */ dlacpy_("Full", &n, nrhs, &bsav[1], &lda, &work[1] , &lda); dget02_(trans, &n, &n, nrhs, &asav[1], &lda, &x[1] , &lda, &work[1], &lda, &rwork[(*nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ if (nofact || prefac && lsame_(equed, "N")) { dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &rcondc, &result[2]); } else { if (itran == 1) { roldc = roldo; } else { roldc = roldi; } dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, &roldc, &result[2]); } } else { trfcon = TRUE_; } /* Compare RCOND from DGESVXX with the computed value */ /* in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ if (! trfcon) { for (k = k1; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___74.ciunit = *nout; s_wsfe(&io___74); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } else { io___75.ciunit = *nout; s_wsfe(&io___75); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); } ++nfail; } /* L45: */ } nrun = nrun + 7 - k1; } else { if (result[0] >= *thresh && ! prefac) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___76.ciunit = *nout; s_wsfe(&io___76); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__1, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[0], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___77.ciunit = *nout; s_wsfe(&io___77); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__1, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[0], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } if (result[5] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___78.ciunit = *nout; s_wsfe(&io___78); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__6, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[5], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___79.ciunit = *nout; s_wsfe(&io___79); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__6, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[5], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } if (result[6] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } if (prefac) { io___80.ciunit = *nout; s_wsfe(&io___80); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, equed, (ftnlen)1); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { io___81.ciunit = *nout; s_wsfe(&io___81); do_fio(&c__1, "DGESVXX", (ftnlen)7); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen) sizeof(doublereal)); e_wsfe(); } ++nfail; ++nrun; } } L50: ; } L60: ; } /* L70: */ } L80: ; } /* L90: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); /* Test Error Bounds from DGESVXX */ debchvxx_(thresh, path); return 0; /* End of DDRVGE */ } /* ddrvge_ */
/* Subroutine */ int zdrvgt_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, doublecomplex *a, doublecomplex *af, doublecomplex *b, doublecomplex *x, doublecomplex * xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 0,0,0,1 }; static char transs[1*3] = "N" "T" "C"; /* Format strings */ static char fmt_9999[] = "(1x,a6,\002, N =\002,i5,\002, type \002,i2," "\002, test \002,i2,\002, ratio = \002,g12.5)"; static char fmt_9998[] = "(1x,a6,\002, FACT='\002,a1,\002', TRANS='\002," "a1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002," " ratio = \002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5, i__6[2]; doublereal d__1, d__2; char ch__1[2]; /* Builtin functions Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ static char fact[1]; static doublereal cond; static integer mode, koff, imat, info; static char path[3], dist[1], type__[1]; static integer nrun, i__, j, k, m, n, ifact, nfail, iseed[4]; static doublereal z__[3]; extern doublereal dget06_(doublereal *, doublereal *); static doublereal rcond; static integer nimat; static doublereal anorm; static integer itran; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ); static char trans[1]; static integer izero, nerrs; extern /* Subroutine */ int zgtt01_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *); static integer k1; extern /* Subroutine */ int zgtt02_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , integer *, doublecomplex *, integer *, doublereal *, doublereal *), zgtt05_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); static logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zgtsv_(integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , integer *, integer *), zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *); static integer in, kl; extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); static integer ku, ix, nt; static doublereal rcondc, rcondi; extern /* Subroutine */ int zdscal_(integer *, doublereal *, doublecomplex *, integer *), alasvm_(char *, integer *, integer *, integer *, integer *); static doublereal rcondo, anormi, ainvnm; static logical trfcon; static doublereal anormo; extern /* Subroutine */ int zlagtm_(char *, integer *, integer *, doublereal *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublereal *, doublecomplex *, integer *); extern doublereal zlangt_(char *, integer *, doublecomplex *, doublecomplex *, doublecomplex *); extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); extern doublereal dzasum_(integer *, doublecomplex *, integer *); extern /* Subroutine */ int zlaset_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *), zlarnv_(integer *, integer *, integer *, doublecomplex *); static doublereal result[6]; extern /* Subroutine */ int zgttrf_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, integer *), zgttrs_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, integer *), zerrvx_(char *, integer *), zgtsvx_(char *, char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex * , doublecomplex *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *); static integer lda; /* Fortran I/O blocks */ static cilist io___42 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___46 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___47 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University September 30, 1994 Purpose ======= ZDRVGT tests ZGTSV and -SVX. Arguments ========= DOTYPE (input) 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. NN (input) INTEGER The number of values of N contained in the vector NVAL. NVAL (input) INTEGER array, dimension (NN) The values of the matrix dimension N. THRESH (input) 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. TSTERR (input) LOGICAL Flag that indicates whether error exits are to be tested. A (workspace) COMPLEX*16 array, dimension (NMAX*4) AF (workspace) COMPLEX*16 array, dimension (NMAX*4) B (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) X (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) XACT (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) WORK (workspace) COMPLEX*16 array, dimension (NMAX*max(3,NRHS)) RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) IWORK (workspace) INTEGER array, dimension (2*NMAX) NOUT (input) INTEGER The unit number for output. ===================================================================== Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --af; --a; --nval; --dotype; /* Function Body */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "GT", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrvx_(path, nout); } infoc_1.infot = 0; i__1 = *nn; for (in = 1; in <= i__1; ++in) { /* Do for each value of N in NVAL. */ n = nval[in]; /* Computing MAX */ i__2 = n - 1; m = max(i__2,0); lda = max(1,n); nimat = 12; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L130; } /* Set up parameters with ZLATB4. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, & cond, dist); zerot = imat >= 8 && imat <= 10; if (imat <= 6) { /* Types 1-6: generate matrices of known condition number. Computing MAX */ i__3 = 2 - ku, i__4 = 3 - max(1,n); koff = max(i__3,i__4); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &cond, &anorm, &kl, &ku, "Z", &af[koff], &c__3, &work[1], & info); /* Check the error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, " ", &n, &n, &kl, & ku, &c_n1, &imat, &nfail, &nerrs, nout); goto L130; } izero = 0; if (n > 1) { i__3 = n - 1; zcopy_(&i__3, &af[4], &c__3, &a[1], &c__1); i__3 = n - 1; zcopy_(&i__3, &af[3], &c__3, &a[n + m + 1], &c__1); } zcopy_(&n, &af[2], &c__3, &a[m + 1], &c__1); } else { /* Types 7-12: generate tridiagonal matrices with unknown condition numbers. */ if (! zerot || ! dotype[7]) { /* Generate a matrix with elements from [-1,1]. */ i__3 = n + (m << 1); zlarnv_(&c__2, iseed, &i__3, &a[1]); if (anorm != 1.) { i__3 = n + (m << 1); zdscal_(&i__3, &anorm, &a[1], &c__1); } } else if (izero > 0) { /* Reuse the last matrix by copying back the zeroed out elements. */ if (izero == 1) { i__3 = n; a[i__3].r = z__[1], a[i__3].i = 0.; if (n > 1) { a[1].r = z__[2], a[1].i = 0.; } } else if (izero == n) { i__3 = n * 3 - 2; a[i__3].r = z__[0], a[i__3].i = 0.; i__3 = (n << 1) - 1; a[i__3].r = z__[1], a[i__3].i = 0.; } else { i__3 = (n << 1) - 2 + izero; a[i__3].r = z__[0], a[i__3].i = 0.; i__3 = n - 1 + izero; a[i__3].r = z__[1], a[i__3].i = 0.; i__3 = izero; a[i__3].r = z__[2], a[i__3].i = 0.; } } /* If IMAT > 7, set one column of the matrix to 0. */ if (! zerot) { izero = 0; } else if (imat == 8) { izero = 1; i__3 = n; z__[1] = a[i__3].r; i__3 = n; a[i__3].r = 0., a[i__3].i = 0.; if (n > 1) { z__[2] = a[1].r; a[1].r = 0., a[1].i = 0.; } } else if (imat == 9) { izero = n; i__3 = n * 3 - 2; z__[0] = a[i__3].r; i__3 = (n << 1) - 1; z__[1] = a[i__3].r; i__3 = n * 3 - 2; a[i__3].r = 0., a[i__3].i = 0.; i__3 = (n << 1) - 1; a[i__3].r = 0., a[i__3].i = 0.; } else { izero = (n + 1) / 2; i__3 = n - 1; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = (n << 1) - 2 + i__; a[i__4].r = 0., a[i__4].i = 0.; i__4 = n - 1 + i__; a[i__4].r = 0., a[i__4].i = 0.; i__4 = i__; a[i__4].r = 0., a[i__4].i = 0.; /* L20: */ } i__3 = n * 3 - 2; a[i__3].r = 0., a[i__3].i = 0.; i__3 = (n << 1) - 1; a[i__3].r = 0., a[i__3].i = 0.; } } for (ifact = 1; ifact <= 2; ++ifact) { if (ifact == 1) { *(unsigned char *)fact = 'F'; } else { *(unsigned char *)fact = 'N'; } /* Compute the condition number for comparison with the value returned by ZGTSVX. */ if (zerot) { if (ifact == 1) { goto L120; } rcondo = 0.; rcondi = 0.; } else if (ifact == 1) { i__3 = n + (m << 1); zcopy_(&i__3, &a[1], &c__1, &af[1], &c__1); /* Compute the 1-norm and infinity-norm of A. */ anormo = zlangt_("1", &n, &a[1], &a[m + 1], &a[n + m + 1]); anormi = zlangt_("I", &n, &a[1], &a[m + 1], &a[n + m + 1]); /* Factor the matrix A. */ zgttrf_(&n, &af[1], &af[m + 1], &af[n + m + 1], &af[n + ( m << 1) + 1], &iwork[1], &info); /* Use ZGTTRS to solve for one column at a time of inv(A), computing the maximum column sum as we go. */ ainvnm = 0.; i__3 = n; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = n; for (j = 1; j <= i__4; ++j) { i__5 = j; x[i__5].r = 0., x[i__5].i = 0.; /* L30: */ } i__4 = i__; x[i__4].r = 1., x[i__4].i = 0.; zgttrs_("No transpose", &n, &c__1, &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], & iwork[1], &x[1], &lda, &info); /* Computing MAX */ d__1 = ainvnm, d__2 = dzasum_(&n, &x[1], &c__1); ainvnm = max(d__1,d__2); /* L40: */ } /* Compute the 1-norm condition number of A. */ if (anormo <= 0. || ainvnm <= 0.) { rcondo = 1.; } else { rcondo = 1. / anormo / ainvnm; } /* Use ZGTTRS to solve for one column at a time of inv(A'), computing the maximum column sum as we go. */ ainvnm = 0.; i__3 = n; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = n; for (j = 1; j <= i__4; ++j) { i__5 = j; x[i__5].r = 0., x[i__5].i = 0.; /* L50: */ } i__4 = i__; x[i__4].r = 1., x[i__4].i = 0.; zgttrs_("Conjugate transpose", &n, &c__1, &af[1], &af[ m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &x[1], &lda, &info); /* Computing MAX */ d__1 = ainvnm, d__2 = dzasum_(&n, &x[1], &c__1); ainvnm = max(d__1,d__2); /* L60: */ } /* Compute the infinity-norm condition number of A. */ if (anormi <= 0. || ainvnm <= 0.) { rcondi = 1.; } else { rcondi = 1. / anormi / ainvnm; } } for (itran = 1; itran <= 3; ++itran) { *(unsigned char *)trans = *(unsigned char *)&transs[itran - 1]; if (itran == 1) { rcondc = rcondo; } else { rcondc = rcondi; } /* Generate NRHS random solution vectors. */ ix = 1; i__3 = *nrhs; for (j = 1; j <= i__3; ++j) { zlarnv_(&c__2, iseed, &n, &xact[ix]); ix += lda; /* L70: */ } /* Set the right hand side. */ zlagtm_(trans, &n, nrhs, &c_b43, &a[1], &a[m + 1], &a[n + m + 1], &xact[1], &lda, &c_b44, &b[1], &lda); if (ifact == 2 && itran == 1) { /* --- Test ZGTSV --- Solve the system using Gaussian elimination with partial pivoting. */ i__3 = n + (m << 1); zcopy_(&i__3, &a[1], &c__1, &af[1], &c__1); zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda); s_copy(srnamc_1.srnamt, "ZGTSV ", (ftnlen)6, (ftnlen) 6); zgtsv_(&n, nrhs, &af[1], &af[m + 1], &af[n + m + 1], & x[1], &lda, &info); /* Check error code from ZGTSV . */ if (info != izero) { alaerh_(path, "ZGTSV ", &info, &izero, " ", &n, & n, &c__1, &c__1, nrhs, &imat, &nfail, & nerrs, nout); } nt = 1; if (izero == 0) { /* Check residual of computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], & lda); zgtt02_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m + 1], &x[1], &lda, &work[1], &lda, & rwork[1], &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); nt = 3; } /* Print information about the tests that did not pass the threshold. */ i__3 = nt; for (k = 2; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___42.ciunit = *nout; s_wsfe(&io___42); do_fio(&c__1, "ZGTSV ", (ftnlen)6); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L80: */ } nrun = nrun + nt - 1; } /* --- Test ZGTSVX --- */ if (ifact > 1) { /* Initialize AF to zero. */ i__3 = n * 3 - 2; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = i__; af[i__4].r = 0., af[i__4].i = 0.; /* L90: */ } } zlaset_("Full", &n, nrhs, &c_b65, &c_b65, &x[1], &lda); /* Solve the system and compute the condition number and error bounds using ZGTSVX. */ s_copy(srnamc_1.srnamt, "ZGTSVX", (ftnlen)6, (ftnlen)6); zgtsvx_(fact, trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m + 1], &af[1], &af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &b[1], &lda, &x[1], & lda, &rcond, &rwork[1], &rwork[*nrhs + 1], &work[ 1], &rwork[(*nrhs << 1) + 1], &info); /* Check the error code from ZGTSVX. */ if (info != izero) { /* Writing concatenation */ i__6[0] = 1, a__1[0] = fact; i__6[1] = 1, a__1[1] = trans; s_cat(ch__1, a__1, i__6, &c__2, (ftnlen)2); alaerh_(path, "ZGTSVX", &info, &izero, ch__1, &n, &n, &c__1, &c__1, nrhs, &imat, &nfail, &nerrs, nout); } if (ifact >= 2) { /* Reconstruct matrix from factors and compute residual. */ zgtt01_(&n, &a[1], &a[m + 1], &a[n + m + 1], &af[1], & af[m + 1], &af[n + m + 1], &af[n + (m << 1) + 1], &iwork[1], &work[1], &lda, &rwork[1], result); k1 = 1; } else { k1 = 2; } if (info == 0) { trfcon = FALSE_; /* Check residual of computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); zgtt02_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m + 1], &x[1], &lda, &work[1], &lda, &rwork[1], & result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); /* Check the error bounds from iterative refinement. */ zgtt05_(trans, &n, nrhs, &a[1], &a[m + 1], &a[n + m + 1], &b[1], &lda, &x[1], &lda, &xact[1], &lda, &rwork[1], &rwork[*nrhs + 1], &result[3]); nt = 5; } /* Print information about the tests that did not pass the threshold. */ i__3 = nt; for (k = k1; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___46.ciunit = *nout; s_wsfe(&io___46); do_fio(&c__1, "ZGTSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L100: */ } /* Check the reciprocal of the condition number. */ result[5] = dget06_(&rcond, &rcondc); if (result[5] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___47.ciunit = *nout; s_wsfe(&io___47); do_fio(&c__1, "ZGTSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } nrun = nrun + nt - k1 + 2; /* L110: */ } L120: ; } L130: ; } /* L140: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZDRVGT */ } /* zdrvgt_ */
/* Subroutine */ int zchkgb_(logical *dotype, integer *nm, integer *mval, integer *nn, integer *nval, integer *nnb, integer *nbval, integer * nns, integer *nsval, doublereal *thresh, logical *tsterr, doublecomplex *a, integer *la, doublecomplex *afac, integer *lafac, doublecomplex *b, doublecomplex *x, doublecomplex *xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char transs[1*3] = "N" "T" "C"; /* Format strings */ static char fmt_9999[] = "(\002 *** In ZCHKGB, LA=\002,i5,\002 is too sm" "all for M=\002,i5,\002, N=\002,i5,\002, KL=\002,i4,\002, KU=\002" ",i4,/\002 ==> Increase LA to at least \002,i5)"; static char fmt_9998[] = "(\002 *** In ZCHKGB, LAFAC=\002,i5,\002 is too" " small for M=\002,i5,\002, N=\002,i5,\002, KL=\002,i4,\002, KU" "=\002,i4,/\002 ==> Increase LAFAC to at least \002,i5)"; static char fmt_9997[] = "(\002 M =\002,i5,\002, N =\002,i5,\002, KL=" "\002,i5,\002, KU=\002,i5,\002, NB =\002,i4,\002, type \002,i1" ",\002, test(\002,i1,\002)=\002,g12.5)"; static char fmt_9996[] = "(\002 TRANS='\002,a1,\002', N=\002,i5,\002, " "KL=\002,i5,\002, KU=\002,i5,\002, NRHS=\002,i3,\002, type \002,i" "1,\002, test(\002,i1,\002)=\002,g12.5)"; static char fmt_9995[] = "(\002 NORM ='\002,a1,\002', N=\002,i5,\002, " "KL=\002,i5,\002, KU=\002,i5,\002,\002,10x,\002 type \002,i1,\002" ", test(\002,i1,\002)=\002,g12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8, i__9, i__10, i__11; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, j, k, m, n, i1, i2, nb, im, in, kl, ku, lda, ldb, inb, ikl, nkl, iku, nku, ioff, mode, koff, imat, info; char path[3], dist[1]; integer irhs, nrhs; char norm[1], type__[1]; integer nrun; extern /* Subroutine */ int alahd_(integer *, char *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); doublereal rcond; extern /* Subroutine */ int zgbt01_(integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, doublecomplex *, doublereal *); integer nimat, klval[4]; extern /* Subroutine */ int zgbt02_(char *, integer *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *), zgbt05_(char *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer * , doublereal *, doublereal *, doublereal *); doublereal anorm; integer itran; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ); integer kuval[4]; char trans[1]; integer izero, nerrs; logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *); char xtype[1]; extern /* Subroutine */ int zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *); integer ldafac; extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); doublereal rcondc; extern doublereal zlangb_(char *, integer *, integer *, integer *, doublecomplex *, integer *, doublereal *); doublereal rcondi; extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, integer *, doublereal *); extern /* Subroutine */ int alasum_(char *, integer *, integer *, integer *, integer *); doublereal cndnum, anormi, rcondo; extern /* Subroutine */ int zgbcon_(char *, integer *, integer *, integer *, doublecomplex *, integer *, integer *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *); doublereal ainvnm; logical trfcon; doublereal anormo; extern /* Subroutine */ int xlaenv_(integer *, integer *), zerrge_(char *, integer *), zgbrfs_(char *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, doublecomplex *, integer *, doublecomplex * , integer *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *), zgbtrf_(integer *, integer *, integer *, integer *, doublecomplex *, integer *, integer *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *), zlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer * , integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, integer *), zlaset_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *), zgbtrs_(char *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, integer *, doublecomplex *, integer *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *); doublereal result[7]; /* Fortran I/O blocks */ static cilist io___25 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___26 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___45 = { 0, 0, 0, fmt_9997, 0 }; static cilist io___59 = { 0, 0, 0, fmt_9996, 0 }; static cilist io___61 = { 0, 0, 0, fmt_9995, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZCHKGB tests ZGBTRF, -TRS, -RFS, and -CON */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NM (input) INTEGER */ /* The number of values of M contained in the vector MVAL. */ /* MVAL (input) INTEGER array, dimension (NM) */ /* The values of the matrix row dimension M. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix column dimension N. */ /* NNB (input) INTEGER */ /* The number of values of NB contained in the vector NBVAL. */ /* NBVAL (input) INTEGER array, dimension (NBVAL) */ /* The values of the blocksize NB. */ /* NNS (input) INTEGER */ /* The number of values of NRHS contained in the vector NSVAL. */ /* NSVAL (input) INTEGER array, dimension (NNS) */ /* The values of the number of right hand sides NRHS. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* A (workspace) COMPLEX*16 array, dimension (LA) */ /* LA (input) INTEGER */ /* The length of the array A. LA >= (KLMAX+KUMAX+1)*NMAX */ /* where KLMAX is the largest entry in the local array KLVAL, */ /* KUMAX is the largest entry in the local array KUVAL and */ /* NMAX is the largest entry in the input array NVAL. */ /* AFAC (workspace) COMPLEX*16 array, dimension (LAFAC) */ /* LAFAC (input) INTEGER */ /* The length of the array AFAC. LAFAC >= (2*KLMAX+KUMAX+1)*NMAX */ /* where KLMAX is the largest entry in the local array KLVAL, */ /* KUMAX is the largest entry in the local array KUVAL and */ /* NMAX is the largest entry in the input array NVAL. */ /* B (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* X (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */ /* WORK (workspace) COMPLEX*16 array, dimension */ /* (NMAX*max(3,NSMAX,NMAX)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension */ /* (max(NMAX,2*NSMAX)) */ /* IWORK (workspace) INTEGER array, dimension (NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --afac; --a; --nsval; --nbval; --nval; --mval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17); s_copy(path + 1, "GB", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrge_(path, nout); } infoc_1.infot = 0; /* Initialize the first value for the lower and upper bandwidths. */ klval[0] = 0; kuval[0] = 0; /* Do for each value of M in MVAL */ i__1 = *nm; for (im = 1; im <= i__1; ++im) { m = mval[im]; /* Set values to use for the lower bandwidth. */ klval[1] = m + (m + 1) / 4; /* KLVAL( 2 ) = MAX( M-1, 0 ) */ klval[2] = (m * 3 - 1) / 4; klval[3] = (m + 1) / 4; /* Do for each value of N in NVAL */ i__2 = *nn; for (in = 1; in <= i__2; ++in) { n = nval[in]; *(unsigned char *)xtype = 'N'; /* Set values to use for the upper bandwidth. */ kuval[1] = n + (n + 1) / 4; /* KUVAL( 2 ) = MAX( N-1, 0 ) */ kuval[2] = (n * 3 - 1) / 4; kuval[3] = (n + 1) / 4; /* Set limits on the number of loop iterations. */ /* Computing MIN */ i__3 = m + 1; nkl = min(i__3,4); if (n == 0) { nkl = 2; } /* Computing MIN */ i__3 = n + 1; nku = min(i__3,4); if (m == 0) { nku = 2; } nimat = 8; if (m <= 0 || n <= 0) { nimat = 1; } i__3 = nkl; for (ikl = 1; ikl <= i__3; ++ikl) { /* Do for KL = 0, (5*M+1)/4, (3M-1)/4, and (M+1)/4. This */ /* order makes it easier to skip redundant values for small */ /* values of M. */ kl = klval[ikl - 1]; i__4 = nku; for (iku = 1; iku <= i__4; ++iku) { /* Do for KU = 0, (5*N+1)/4, (3N-1)/4, and (N+1)/4. This */ /* order makes it easier to skip redundant values for */ /* small values of N. */ ku = kuval[iku - 1]; /* Check that A and AFAC are big enough to generate this */ /* matrix. */ lda = kl + ku + 1; ldafac = (kl << 1) + ku + 1; if (lda * n > *la || ldafac * n > *lafac) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } if (n * (kl + ku + 1) > *la) { io___25.ciunit = *nout; s_wsfe(&io___25); do_fio(&c__1, (char *)&(*la), (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&kl, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&ku, (ftnlen)sizeof(integer) ); i__5 = n * (kl + ku + 1); do_fio(&c__1, (char *)&i__5, (ftnlen)sizeof( integer)); e_wsfe(); ++nerrs; } if (n * ((kl << 1) + ku + 1) > *lafac) { io___26.ciunit = *nout; s_wsfe(&io___26); do_fio(&c__1, (char *)&(*lafac), (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&kl, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&ku, (ftnlen)sizeof(integer) ); i__5 = n * ((kl << 1) + ku + 1); do_fio(&c__1, (char *)&i__5, (ftnlen)sizeof( integer)); e_wsfe(); ++nerrs; } goto L130; } i__5 = nimat; for (imat = 1; imat <= i__5; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L120; } /* Skip types 2, 3, or 4 if the matrix size is too */ /* small. */ zerot = imat >= 2 && imat <= 4; if (zerot && n < imat - 1) { goto L120; } if (! zerot || ! dotype[1]) { /* Set up parameters with ZLATB4 and generate a */ /* test matrix with ZLATMS. */ zlatb4_(path, &imat, &m, &n, type__, &kl, &ku, & anorm, &mode, &cndnum, dist); /* Computing MAX */ i__6 = 1, i__7 = ku + 2 - n; koff = max(i__6,i__7); i__6 = koff - 1; for (i__ = 1; i__ <= i__6; ++i__) { i__7 = i__; a[i__7].r = 0., a[i__7].i = 0.; /* L20: */ } s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, ( ftnlen)6); zlatms_(&m, &n, dist, iseed, type__, &rwork[1], & mode, &cndnum, &anorm, &kl, &ku, "Z", &a[ koff], &lda, &work[1], &info); /* Check the error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, " ", &m, &n, &kl, &ku, &c_n1, &imat, &nfail, & nerrs, nout); goto L120; } } else if (izero > 0) { /* Use the same matrix for types 3 and 4 as for */ /* type 2 by copying back the zeroed out column. */ i__6 = i2 - i1 + 1; zcopy_(&i__6, &b[1], &c__1, &a[ioff + i1], &c__1); } /* For types 2, 3, and 4, zero one or more columns of */ /* the matrix to test that INFO is returned correctly. */ izero = 0; if (zerot) { if (imat == 2) { izero = 1; } else if (imat == 3) { izero = min(m,n); } else { izero = min(m,n) / 2 + 1; } ioff = (izero - 1) * lda; if (imat < 4) { /* Store the column to be zeroed out in B. */ /* Computing MAX */ i__6 = 1, i__7 = ku + 2 - izero; i1 = max(i__6,i__7); /* Computing MIN */ i__6 = kl + ku + 1, i__7 = ku + 1 + (m - izero); i2 = min(i__6,i__7); i__6 = i2 - i1 + 1; zcopy_(&i__6, &a[ioff + i1], &c__1, &b[1], & c__1); i__6 = i2; for (i__ = i1; i__ <= i__6; ++i__) { i__7 = ioff + i__; a[i__7].r = 0., a[i__7].i = 0.; /* L30: */ } } else { i__6 = n; for (j = izero; j <= i__6; ++j) { /* Computing MAX */ i__7 = 1, i__8 = ku + 2 - j; /* Computing MIN */ i__10 = kl + ku + 1, i__11 = ku + 1 + (m - j); i__9 = min(i__10,i__11); for (i__ = max(i__7,i__8); i__ <= i__9; ++i__) { i__7 = ioff + i__; a[i__7].r = 0., a[i__7].i = 0.; /* L40: */ } ioff += lda; /* L50: */ } } } /* These lines, if used in place of the calls in the */ /* loop over INB, cause the code to bomb on a Sun */ /* SPARCstation. */ /* ANORMO = ZLANGB( 'O', N, KL, KU, A, LDA, RWORK ) */ /* ANORMI = ZLANGB( 'I', N, KL, KU, A, LDA, RWORK ) */ /* Do for each blocksize in NBVAL */ i__6 = *nnb; for (inb = 1; inb <= i__6; ++inb) { nb = nbval[inb]; xlaenv_(&c__1, &nb); /* Compute the LU factorization of the band matrix. */ if (m > 0 && n > 0) { i__9 = kl + ku + 1; zlacpy_("Full", &i__9, &n, &a[1], &lda, &afac[ kl + 1], &ldafac); } s_copy(srnamc_1.srnamt, "ZGBTRF", (ftnlen)6, ( ftnlen)6); zgbtrf_(&m, &n, &kl, &ku, &afac[1], &ldafac, & iwork[1], &info); /* Check error code from ZGBTRF. */ if (info != izero) { alaerh_(path, "ZGBTRF", &info, &izero, " ", & m, &n, &kl, &ku, &nb, &imat, &nfail, & nerrs, nout); } trfcon = FALSE_; /* + TEST 1 */ /* Reconstruct matrix from factors and compute */ /* residual. */ zgbt01_(&m, &n, &kl, &ku, &a[1], &lda, &afac[1], & ldafac, &iwork[1], &work[1], result); /* Print information about the tests so far that */ /* did not pass the threshold. */ if (result[0] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___45.ciunit = *nout; s_wsfe(&io___45); do_fio(&c__1, (char *)&m, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&kl, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&ku, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&nb, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[0], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } ++nrun; /* Skip the remaining tests if this is not the */ /* first block size or if M .ne. N. */ if (inb > 1 || m != n) { goto L110; } anormo = zlangb_("O", &n, &kl, &ku, &a[1], &lda, & rwork[1]); anormi = zlangb_("I", &n, &kl, &ku, &a[1], &lda, & rwork[1]); if (info == 0) { /* Form the inverse of A so we can get a good */ /* estimate of CNDNUM = norm(A) * norm(inv(A)). */ ldb = max(1,n); zlaset_("Full", &n, &n, &c_b61, &c_b62, &work[ 1], &ldb); s_copy(srnamc_1.srnamt, "ZGBTRS", (ftnlen)6, ( ftnlen)6); zgbtrs_("No transpose", &n, &kl, &ku, &n, & afac[1], &ldafac, &iwork[1], &work[1], &ldb, &info); /* Compute the 1-norm condition number of A. */ ainvnm = zlange_("O", &n, &n, &work[1], &ldb, &rwork[1]); if (anormo <= 0. || ainvnm <= 0.) { rcondo = 1.; } else { rcondo = 1. / anormo / ainvnm; } /* Compute the infinity-norm condition number of */ /* A. */ ainvnm = zlange_("I", &n, &n, &work[1], &ldb, &rwork[1]); if (anormi <= 0. || ainvnm <= 0.) { rcondi = 1.; } else { rcondi = 1. / anormi / ainvnm; } } else { /* Do only the condition estimate if INFO.NE.0. */ trfcon = TRUE_; rcondo = 0.; rcondi = 0.; } /* Skip the solve tests if the matrix is singular. */ if (trfcon) { goto L90; } i__9 = *nns; for (irhs = 1; irhs <= i__9; ++irhs) { nrhs = nsval[irhs]; *(unsigned char *)xtype = 'N'; for (itran = 1; itran <= 3; ++itran) { *(unsigned char *)trans = *(unsigned char *)&transs[itran - 1]; if (itran == 1) { rcondc = rcondo; *(unsigned char *)norm = 'O'; } else { rcondc = rcondi; *(unsigned char *)norm = 'I'; } /* + TEST 2: */ /* Solve and compute residual for A * X = B. */ s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen) 6, (ftnlen)6); zlarhs_(path, xtype, " ", trans, &n, &n, & kl, &ku, &nrhs, &a[1], &lda, & xact[1], &ldb, &b[1], &ldb, iseed, &info); *(unsigned char *)xtype = 'C'; zlacpy_("Full", &n, &nrhs, &b[1], &ldb, & x[1], &ldb); s_copy(srnamc_1.srnamt, "ZGBTRS", (ftnlen) 6, (ftnlen)6); zgbtrs_(trans, &n, &kl, &ku, &nrhs, &afac[ 1], &ldafac, &iwork[1], &x[1], & ldb, &info); /* Check error code from ZGBTRS. */ if (info != 0) { alaerh_(path, "ZGBTRS", &info, &c__0, trans, &n, &n, &kl, &ku, & c_n1, &imat, &nfail, &nerrs, nout); } zlacpy_("Full", &n, &nrhs, &b[1], &ldb, & work[1], &ldb); zgbt02_(trans, &m, &n, &kl, &ku, &nrhs, & a[1], &lda, &x[1], &ldb, &work[1], &ldb, &result[1]); /* + TEST 3: */ /* Check solution from generated exact */ /* solution. */ zget04_(&n, &nrhs, &x[1], &ldb, &xact[1], &ldb, &rcondc, &result[2]); /* + TESTS 4, 5, 6: */ /* Use iterative refinement to improve the */ /* solution. */ s_copy(srnamc_1.srnamt, "ZGBRFS", (ftnlen) 6, (ftnlen)6); zgbrfs_(trans, &n, &kl, &ku, &nrhs, &a[1], &lda, &afac[1], &ldafac, &iwork[ 1], &b[1], &ldb, &x[1], &ldb, & rwork[1], &rwork[nrhs + 1], &work[ 1], &rwork[(nrhs << 1) + 1], & info); /* Check error code from ZGBRFS. */ if (info != 0) { alaerh_(path, "ZGBRFS", &info, &c__0, trans, &n, &n, &kl, &ku, & nrhs, &imat, &nfail, &nerrs, nout); } zget04_(&n, &nrhs, &x[1], &ldb, &xact[1], &ldb, &rcondc, &result[3]); zgbt05_(trans, &n, &kl, &ku, &nrhs, &a[1], &lda, &b[1], &ldb, &x[1], &ldb, & xact[1], &ldb, &rwork[1], &rwork[ nrhs + 1], &result[4]); /* Print information about the tests that did */ /* not pass the threshold. */ for (k = 2; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___59.ciunit = *nout; s_wsfe(&io___59); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&kl, ( ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&ku, ( ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&nrhs, ( ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&imat, ( ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } /* L60: */ } nrun += 5; /* L70: */ } /* L80: */ } /* + TEST 7: */ /* Get an estimate of RCOND = 1/CNDNUM. */ L90: for (itran = 1; itran <= 2; ++itran) { if (itran == 1) { anorm = anormo; rcondc = rcondo; *(unsigned char *)norm = 'O'; } else { anorm = anormi; rcondc = rcondi; *(unsigned char *)norm = 'I'; } s_copy(srnamc_1.srnamt, "ZGBCON", (ftnlen)6, ( ftnlen)6); zgbcon_(norm, &n, &kl, &ku, &afac[1], &ldafac, &iwork[1], &anorm, &rcond, &work[1], &rwork[1], &info); /* Check error code from ZGBCON. */ if (info != 0) { alaerh_(path, "ZGBCON", &info, &c__0, norm, &n, &n, &kl, &ku, &c_n1, & imat, &nfail, &nerrs, nout); } result[6] = dget06_(&rcond, &rcondc); /* Print information about the tests that did */ /* not pass the threshold. */ if (result[6] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___61.ciunit = *nout; s_wsfe(&io___61); do_fio(&c__1, norm, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&kl, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&ku, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&c__7, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&result[6], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } ++nrun; /* L100: */ } L110: ; } L120: ; } L130: ; } /* L140: */ } /* L150: */ } /* L160: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZCHKGB */ } /* zchkgb_ */
/* Subroutine */ int ddrvsp_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, integer *nmax, doublereal *a, doublereal *afac, doublereal *ainv, doublereal *b, doublereal *x, doublereal *xact, doublereal *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char facts[1*2] = "F" "N"; /* Format strings */ static char fmt_9999[] = "(1x,a6,\002, UPLO='\002,a1,\002', N =\002,i5" ",\002, type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)"; static char fmt_9998[] = "(1x,a6,\002, FACT='\002,a1,\002', UPLO='\002,a" "1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002, " "ratio =\002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5[2]; char ch__1[2]; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ integer i__, j, k, n, i1, i2, k1, in, kl, ku, nt, lda, npp; char fact[1]; integer ioff, mode, imat, info; char path[3], dist[1], uplo[1], type__[1]; integer nrun, ifact; extern /* Subroutine */ int dget04_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); doublereal rcond; integer nimat; extern /* Subroutine */ int dppt02_(char *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dspt01_(char *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); doublereal anorm; extern /* Subroutine */ int dppt05_(char *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *), dcopy_(integer *, doublereal *, integer *, doublereal *, integer *); integer iuplo, izero, nerrs, lwork; extern /* Subroutine */ int dspsv_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *); logical zerot; char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *), alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); doublereal rcondc; char packit[1]; extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *), dlaset_(char *, integer *, integer *, doublereal *, doublereal *, doublereal *, integer *); extern doublereal dlansp_(char *, char *, integer *, doublereal *, doublereal *); extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer *, integer *); doublereal cndnum; extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *); doublereal ainvnm; extern /* Subroutine */ int dsptrf_(char *, integer *, doublereal *, integer *, integer *), dsptri_(char *, integer *, doublereal *, integer *, doublereal *, integer *), derrvx_(char *, integer *); doublereal result[6]; extern /* Subroutine */ int dspsvx_(char *, char *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, doublereal *, integer *, integer *); /* Fortran I/O blocks */ static cilist io___41 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___44 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* DDRVSP tests the driver routines DSPSV and -SVX. */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix dimension N. */ /* NRHS (input) INTEGER */ /* The number of right hand side vectors to be generated for */ /* each linear system. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for N, used in dimensioning the */ /* work arrays. */ /* A (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* AFAC (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* AINV (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*(NMAX+1)/2) */ /* B (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* X (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NRHS) */ /* WORK (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*max(2,NRHS)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) */ /* IWORK (workspace) INTEGER array, dimension (2*NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "SP", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Computing MAX */ i__1 = *nmax << 1, i__2 = *nmax * *nrhs; lwork = max(i__1,i__2); /* Test the error exits */ if (*tsterr) { derrvx_(path, nout); } infoc_1.infot = 0; /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); npp = n * (n + 1) / 2; *(unsigned char *)xtype = 'N'; nimat = 10; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L170; } /* Skip types 3, 4, 5, or 6 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 6; if (zerot && n < imat - 2) { goto L170; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { if (iuplo == 1) { *(unsigned char *)uplo = 'U'; *(unsigned char *)packit = 'C'; } else { *(unsigned char *)uplo = 'L'; *(unsigned char *)packit = 'R'; } /* Set up parameters with DLATB4 and generate a test matrix */ /* with DLATMS. */ dlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)6, (ftnlen)6); dlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, packit, &a[1], &lda, &work[ 1], &info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L160; } /* For types 3-6, zero one or more rows and columns of the */ /* matrix to test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } if (imat < 6) { /* Set row and column IZERO to zero. */ if (iuplo == 1) { ioff = (izero - 1) * izero / 2; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff += i__; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { a[ioff] = 0.; ioff = ioff + n - i__; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { a[ioff + i__] = 0.; /* L50: */ } } } else { ioff = 0; if (iuplo == 1) { /* Set the first IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i2 = min(j,izero); i__4 = i2; for (i__ = 1; i__ <= i__4; ++i__) { a[ioff + i__] = 0.; /* L60: */ } ioff += j; /* L70: */ } } else { /* Set the last IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i1 = max(j,izero); i__4 = n; for (i__ = i1; i__ <= i__4; ++i__) { a[ioff + i__] = 0.; /* L80: */ } ioff = ioff + n - j; /* L90: */ } } } } else { izero = 0; } for (ifact = 1; ifact <= 2; ++ifact) { /* Do first for FACT = 'F', then for other values. */ *(unsigned char *)fact = *(unsigned char *)&facts[ifact - 1]; /* Compute the condition number for comparison with */ /* the value returned by DSPSVX. */ if (zerot) { if (ifact == 1) { goto L150; } rcondc = 0.; } else if (ifact == 1) { /* Compute the 1-norm of A. */ anorm = dlansp_("1", uplo, &n, &a[1], &rwork[1]); /* Factor the matrix A. */ dcopy_(&npp, &a[1], &c__1, &afac[1], &c__1); dsptrf_(uplo, &n, &afac[1], &iwork[1], &info); /* Compute inv(A) and take its norm. */ dcopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1); dsptri_(uplo, &n, &ainv[1], &iwork[1], &work[1], & info); ainvnm = dlansp_("1", uplo, &n, &ainv[1], &rwork[1]); /* Compute the 1-norm condition number of A. */ if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } } /* Form an exact solution and set the right hand side. */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)6, (ftnlen)6); dlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, nrhs, & a[1], &lda, &xact[1], &lda, &b[1], &lda, iseed, & info); *(unsigned char *)xtype = 'C'; /* --- Test DSPSV --- */ if (ifact == 2) { dcopy_(&npp, &a[1], &c__1, &afac[1], &c__1); dlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda); /* Factor the matrix and solve the system using DSPSV. */ s_copy(srnamc_1.srnamt, "DSPSV ", (ftnlen)6, (ftnlen) 6); dspsv_(uplo, &n, nrhs, &afac[1], &iwork[1], &x[1], & lda, &info); /* Adjust the expected value of INFO to account for */ /* pivoting. */ k = izero; if (k > 0) { L100: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L100; } } else if (iwork[k] != k) { k = iwork[k]; goto L100; } } /* Check error code from DSPSV . */ if (info != k) { alaerh_(path, "DSPSV ", &info, &k, uplo, &n, &n, & c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs, nout); goto L120; } else if (info != 0) { goto L120; } /* Reconstruct matrix from factors and compute */ /* residual. */ dspt01_(uplo, &n, &a[1], &afac[1], &iwork[1], &ainv[1] , &lda, &rwork[1], result); /* Compute residual of the computed solution. */ dlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); dppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1], &lda, &rwork[1], &result[1]); /* Check solution from generated exact solution. */ dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); nt = 3; /* Print information about the tests that did not pass */ /* the threshold. */ i__3 = nt; for (k = 1; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___41.ciunit = *nout; s_wsfe(&io___41); do_fio(&c__1, "DSPSV ", (ftnlen)6); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L110: */ } nrun += nt; L120: ; } /* --- Test DSPSVX --- */ if (ifact == 2 && npp > 0) { dlaset_("Full", &npp, &c__1, &c_b59, &c_b59, &afac[1], &npp); } dlaset_("Full", &n, nrhs, &c_b59, &c_b59, &x[1], &lda); /* Solve the system and compute the condition number and */ /* error bounds using DSPSVX. */ s_copy(srnamc_1.srnamt, "DSPSVX", (ftnlen)6, (ftnlen)6); dspsvx_(fact, uplo, &n, nrhs, &a[1], &afac[1], &iwork[1], &b[1], &lda, &x[1], &lda, &rcond, &rwork[1], & rwork[*nrhs + 1], &work[1], &iwork[n + 1], &info); /* Adjust the expected value of INFO to account for */ /* pivoting. */ k = izero; if (k > 0) { L130: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L130; } } else if (iwork[k] != k) { k = iwork[k]; goto L130; } } /* Check the error code from DSPSVX. */ if (info != k) { /* Writing concatenation */ i__5[0] = 1, a__1[0] = fact; i__5[1] = 1, a__1[1] = uplo; s_cat(ch__1, a__1, i__5, &c__2, (ftnlen)2); alaerh_(path, "DSPSVX", &info, &k, ch__1, &n, &n, & c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs, nout); goto L150; } if (info == 0) { if (ifact >= 2) { /* Reconstruct matrix from factors and compute */ /* residual. */ dspt01_(uplo, &n, &a[1], &afac[1], &iwork[1], & ainv[1], &lda, &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } /* Compute residual of the computed solution. */ dlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); dppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1], &lda, &rwork[(*nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ dget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); /* Check the error bounds from iterative refinement. */ dppt05_(uplo, &n, nrhs, &a[1], &b[1], &lda, &x[1], & lda, &xact[1], &lda, &rwork[1], &rwork[*nrhs + 1], &result[3]); } else { k1 = 6; } /* Compare RCOND from DSPSVX with the computed value */ /* in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ for (k = k1; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___44.ciunit = *nout; s_wsfe(&io___44); do_fio(&c__1, "DSPSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L140: */ } nrun = nrun + 7 - k1; L150: ; } L160: ; } L170: ; } /* L180: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of DDRVSP */ } /* ddrvsp_ */
/* Subroutine */ int dchkge_(logical *dotype, integer *nm, integer *mval, integer *nn, integer *nval, integer *nnb, integer *nbval, integer * nns, integer *nsval, doublereal *thresh, logical *tsterr, integer * nmax, doublereal *a, doublereal *afac, doublereal *ainv, doublereal * b, doublereal *x, doublereal *xact, doublereal *work, doublereal * rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char transs[1*3] = "N" "T" "C"; /* Format strings */ static char fmt_9999[] = "(\002 M = \002,i5,\002, N =\002,i5,\002, NB " "=\002,i4,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)" ; static char fmt_9998[] = "(\002 TRANS='\002,a1,\002', N =\002,i5,\002, N" "RHS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g1" "2.5)"; static char fmt_9997[] = "(\002 NORM ='\002,a1,\002', N =\002,i5,\002" ",\002,10x,\002 type \002,i2,\002, test(\002,i2,\002) =\002,g12.5)" ; /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ integer i__, k, m, n, nb, im, in, kl, ku, nt, lda, inb, ioff, mode, imat, info; char path[3], dist[1]; integer irhs, nrhs; char norm[1], type__[1]; integer nrun; extern /* Subroutine */ int alahd_(integer *, char *), dget01_( integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, doublereal *, doublereal *), dget02_(char *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *), dget03_(integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *), dget04_(integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *); integer nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); extern /* Subroutine */ int dget07_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, logical *, doublereal *, doublereal *); doublereal rcond; integer nimat; doublereal anorm; integer itran; char trans[1]; integer izero, nerrs; doublereal dummy; integer lwork; logical zerot; char xtype[1]; extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *); extern doublereal dlange_(char *, integer *, integer *, doublereal *, integer *, doublereal *); extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *), dgecon_(char *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *); doublereal rcondc; extern /* Subroutine */ int derrge_(char *, integer *), dgerfs_( char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *, integer *), dgetrf_(integer *, integer *, doublereal *, integer *, integer *, integer *), dlacpy_(char *, integer *, integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublereal *, integer *, doublereal *, integer *, doublereal *, integer *, integer *, integer *); doublereal rcondi; extern /* Subroutine */ int dgetri_(integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *), dlaset_(char *, integer *, integer *, doublereal *, doublereal *, doublereal *, integer *), alasum_(char *, integer *, integer *, integer *, integer *); doublereal cndnum, anormi, rcondo; extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublereal *, integer *, doublereal *, integer *); doublereal ainvnm; extern /* Subroutine */ int dgetrs_(char *, integer *, integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *); logical trfcon; doublereal anormo; extern /* Subroutine */ int xlaenv_(integer *, integer *); doublereal result[8]; /* Fortran I/O blocks */ static cilist io___41 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___46 = { 0, 0, 0, fmt_9998, 0 }; static cilist io___50 = { 0, 0, 0, fmt_9997, 0 }; /* -- LAPACK test routine (version 3.1.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* January 2007 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* DCHKGE tests DGETRF, -TRI, -TRS, -RFS, and -CON. */ /* Arguments */ /* ========= */ /* DOTYPE (input) 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. */ /* NM (input) INTEGER */ /* The number of values of M contained in the vector MVAL. */ /* MVAL (input) INTEGER array, dimension (NM) */ /* The values of the matrix row dimension M. */ /* NN (input) INTEGER */ /* The number of values of N contained in the vector NVAL. */ /* NVAL (input) INTEGER array, dimension (NN) */ /* The values of the matrix column dimension N. */ /* NNB (input) INTEGER */ /* The number of values of NB contained in the vector NBVAL. */ /* NBVAL (input) INTEGER array, dimension (NBVAL) */ /* The values of the blocksize NB. */ /* NNS (input) INTEGER */ /* The number of values of NRHS contained in the vector NSVAL. */ /* NSVAL (input) INTEGER array, dimension (NNS) */ /* The values of the number of right hand sides NRHS. */ /* THRESH (input) 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. */ /* TSTERR (input) LOGICAL */ /* Flag that indicates whether error exits are to be tested. */ /* NMAX (input) INTEGER */ /* The maximum value permitted for M or N, used in dimensioning */ /* the work arrays. */ /* A (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* AFAC (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* AINV (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */ /* B (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* where NSMAX is the largest entry in NSVAL. */ /* X (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* XACT (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */ /* WORK (workspace) DOUBLE PRECISION array, dimension */ /* (NMAX*max(3,NSMAX)) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension */ /* (max(2*NMAX,2*NSMAX+NWORK)) */ /* IWORK (workspace) INTEGER array, dimension (2*NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nsval; --nbval; --nval; --mval; --dotype; /* Function Body */ /* .. */ /* .. Executable Statements .. */ /* Initialize constants and the random number seed. */ s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16); s_copy(path + 1, "GE", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ xlaenv_(&c__1, &c__1); if (*tsterr) { derrge_(path, nout); } infoc_1.infot = 0; xlaenv_(&c__2, &c__2); /* Do for each value of M in MVAL */ i__1 = *nm; for (im = 1; im <= i__1; ++im) { m = mval[im]; lda = max(1,m); /* Do for each value of N in NVAL */ i__2 = *nn; for (in = 1; in <= i__2; ++in) { n = nval[in]; *(unsigned char *)xtype = 'N'; nimat = 11; if (m <= 0 || n <= 0) { nimat = 1; } i__3 = nimat; for (imat = 1; imat <= i__3; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L100; } /* Skip types 5, 6, or 7 if the matrix size is too small. */ zerot = imat >= 5 && imat <= 7; if (zerot && n < imat - 4) { goto L100; } /* Set up parameters with DLATB4 and generate a test matrix */ /* with DLATMS. */ dlatb4_(path, &imat, &m, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)32, (ftnlen)6); dlatms_(&m, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, "No packing", &a[1], &lda, & work[1], &info); /* Check error code from DLATMS. */ if (info != 0) { alaerh_(path, "DLATMS", &info, &c__0, " ", &m, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L100; } /* For types 5-7, zero one or more columns of the matrix to */ /* test that INFO is returned correctly. */ if (zerot) { if (imat == 5) { izero = 1; } else if (imat == 6) { izero = min(m,n); } else { izero = min(m,n) / 2 + 1; } ioff = (izero - 1) * lda; if (imat < 7) { i__4 = m; for (i__ = 1; i__ <= i__4; ++i__) { a[ioff + i__] = 0.; /* L20: */ } } else { i__4 = n - izero + 1; dlaset_("Full", &m, &i__4, &c_b23, &c_b23, &a[ioff + 1], &lda); } } else { izero = 0; } /* These lines, if used in place of the calls in the DO 60 */ /* loop, cause the code to bomb on a Sun SPARCstation. */ /* ANORMO = DLANGE( 'O', M, N, A, LDA, RWORK ) */ /* ANORMI = DLANGE( 'I', M, N, A, LDA, RWORK ) */ /* Do for each blocksize in NBVAL */ i__4 = *nnb; for (inb = 1; inb <= i__4; ++inb) { nb = nbval[inb]; xlaenv_(&c__1, &nb); /* Compute the LU factorization of the matrix. */ dlacpy_("Full", &m, &n, &a[1], &lda, &afac[1], &lda); s_copy(srnamc_1.srnamt, "DGETRF", (ftnlen)32, (ftnlen)6); dgetrf_(&m, &n, &afac[1], &lda, &iwork[1], &info); /* Check error code from DGETRF. */ if (info != izero) { alaerh_(path, "DGETRF", &info, &izero, " ", &m, &n, & c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout); } trfcon = FALSE_; /* + TEST 1 */ /* Reconstruct matrix from factors and compute residual. */ dlacpy_("Full", &m, &n, &afac[1], &lda, &ainv[1], &lda); dget01_(&m, &n, &a[1], &lda, &ainv[1], &lda, &iwork[1], & rwork[1], result); nt = 1; /* + TEST 2 */ /* Form the inverse if the factorization was successful */ /* and compute the residual. */ if (m == n && info == 0) { dlacpy_("Full", &n, &n, &afac[1], &lda, &ainv[1], & lda); s_copy(srnamc_1.srnamt, "DGETRI", (ftnlen)32, (ftnlen) 6); nrhs = nsval[1]; lwork = *nmax * max(3,nrhs); dgetri_(&n, &ainv[1], &lda, &iwork[1], &work[1], & lwork, &info); /* Check error code from DGETRI. */ if (info != 0) { alaerh_(path, "DGETRI", &info, &c__0, " ", &n, &n, &c_n1, &c_n1, &nb, &imat, &nfail, &nerrs, nout); } /* Compute the residual for the matrix times its */ /* inverse. Also compute the 1-norm condition number */ /* of A. */ dget03_(&n, &a[1], &lda, &ainv[1], &lda, &work[1], & lda, &rwork[1], &rcondo, &result[1]); anormo = dlange_("O", &m, &n, &a[1], &lda, &rwork[1]); /* Compute the infinity-norm condition number of A. */ anormi = dlange_("I", &m, &n, &a[1], &lda, &rwork[1]); ainvnm = dlange_("I", &n, &n, &ainv[1], &lda, &rwork[ 1]); if (anormi <= 0. || ainvnm <= 0.) { rcondi = 1.; } else { rcondi = 1. / anormi / ainvnm; } nt = 2; } else { /* Do only the condition estimate if INFO > 0. */ trfcon = TRUE_; anormo = dlange_("O", &m, &n, &a[1], &lda, &rwork[1]); anormi = dlange_("I", &m, &n, &a[1], &lda, &rwork[1]); rcondo = 0.; rcondi = 0.; } /* Print information about the tests so far that did not */ /* pass the threshold. */ i__5 = nt; for (k = 1; k <= i__5; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___41.ciunit = *nout; s_wsfe(&io___41); do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer) ); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L30: */ } nrun += nt; /* Skip the remaining tests if this is not the first */ /* block size or if M .ne. N. Skip the solve tests if */ /* the matrix is singular. */ if (inb > 1 || m != n) { goto L90; } if (trfcon) { goto L70; } i__5 = *nns; for (irhs = 1; irhs <= i__5; ++irhs) { nrhs = nsval[irhs]; *(unsigned char *)xtype = 'N'; for (itran = 1; itran <= 3; ++itran) { *(unsigned char *)trans = *(unsigned char *)& transs[itran - 1]; if (itran == 1) { rcondc = rcondo; } else { rcondc = rcondi; } /* + TEST 3 */ /* Solve and compute residual for A * X = B. */ s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)32, ( ftnlen)6); dlarhs_(path, xtype, " ", trans, &n, &n, &kl, &ku, &nrhs, &a[1], &lda, &xact[1], &lda, &b[1] , &lda, iseed, &info); *(unsigned char *)xtype = 'C'; dlacpy_("Full", &n, &nrhs, &b[1], &lda, &x[1], & lda); s_copy(srnamc_1.srnamt, "DGETRS", (ftnlen)32, ( ftnlen)6); dgetrs_(trans, &n, &nrhs, &afac[1], &lda, &iwork[ 1], &x[1], &lda, &info); /* Check error code from DGETRS. */ if (info != 0) { alaerh_(path, "DGETRS", &info, &c__0, trans, & n, &n, &c_n1, &c_n1, &nrhs, &imat, & nfail, &nerrs, nout); } dlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda); dget02_(trans, &n, &n, &nrhs, &a[1], &lda, &x[1], &lda, &work[1], &lda, &rwork[1], &result[ 2]); /* + TEST 4 */ /* Check solution from generated exact solution. */ dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[3]); /* + TESTS 5, 6, and 7 */ /* Use iterative refinement to improve the */ /* solution. */ s_copy(srnamc_1.srnamt, "DGERFS", (ftnlen)32, ( ftnlen)6); dgerfs_(trans, &n, &nrhs, &a[1], &lda, &afac[1], & lda, &iwork[1], &b[1], &lda, &x[1], &lda, &rwork[1], &rwork[nrhs + 1], &work[1], & iwork[n + 1], &info); /* Check error code from DGERFS. */ if (info != 0) { alaerh_(path, "DGERFS", &info, &c__0, trans, & n, &n, &c_n1, &c_n1, &nrhs, &imat, & nfail, &nerrs, nout); } dget04_(&n, &nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[4]); dget07_(trans, &n, &nrhs, &a[1], &lda, &b[1], & lda, &x[1], &lda, &xact[1], &lda, &rwork[ 1], &c_true, &rwork[nrhs + 1], &result[5]); /* Print information about the tests that did not */ /* pass the threshold. */ for (k = 3; k <= 7; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___46.ciunit = *nout; s_wsfe(&io___46); do_fio(&c__1, trans, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&nrhs, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&imat, (ftnlen) sizeof(integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], ( ftnlen)sizeof(doublereal)); e_wsfe(); ++nfail; } /* L40: */ } nrun += 5; /* L50: */ } /* L60: */ } /* + TEST 8 */ /* Get an estimate of RCOND = 1/CNDNUM. */ L70: for (itran = 1; itran <= 2; ++itran) { if (itran == 1) { anorm = anormo; rcondc = rcondo; *(unsigned char *)norm = 'O'; } else { anorm = anormi; rcondc = rcondi; *(unsigned char *)norm = 'I'; } s_copy(srnamc_1.srnamt, "DGECON", (ftnlen)32, (ftnlen) 6); dgecon_(norm, &n, &afac[1], &lda, &anorm, &rcond, & work[1], &iwork[n + 1], &info); /* Check error code from DGECON. */ if (info != 0) { alaerh_(path, "DGECON", &info, &c__0, norm, &n, & n, &c_n1, &c_n1, &c_n1, &imat, &nfail, & nerrs, nout); } /* This line is needed on a Sun SPARCstation. */ dummy = rcond; result[7] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass */ /* the threshold. */ if (result[7] >= *thresh) { if (nfail == 0 && nerrs == 0) { alahd_(nout, path); } io___50.ciunit = *nout; s_wsfe(&io___50); do_fio(&c__1, norm, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[7], (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; /* L80: */ } L90: ; } L100: ; } /* L110: */ } /* L120: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of DCHKGE */ } /* dchkge_ */
/* Subroutine */ int zdrvhp_(logical *dotype, integer *nn, integer *nval, integer *nrhs, doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, doublecomplex *afac, doublecomplex *ainv, doublecomplex *b, doublecomplex *x, doublecomplex *xact, doublecomplex *work, doublereal *rwork, integer *iwork, integer *nout) { /* Initialized data */ static integer iseedy[4] = { 1988,1989,1990,1991 }; static char facts[1*2] = "F" "N"; /* Format strings */ static char fmt_9999[] = "(1x,a6,\002, UPLO='\002,a1,\002', N =\002,i5" ",\002, type \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)"; static char fmt_9998[] = "(1x,a6,\002, FACT='\002,a1,\002', UPLO='\002,a" "1,\002', N =\002,i5,\002, type \002,i2,\002, test \002,i2,\002, " "ratio =\002,g12.5)"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3, i__4, i__5, i__6[2]; char ch__1[2]; /* Builtin functions Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); /* Local variables */ static char fact[1]; static integer ioff, mode, imat, info; static char path[3], dist[1], uplo[1], type__[1]; static integer nrun, i__, j, k, n, ifact, nfail, iseed[4]; extern doublereal dget06_(doublereal *, doublereal *); static integer nbmin; static doublereal rcond; static integer nimat; static doublereal anorm; extern /* Subroutine */ int zget04_(integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal * ), zhpt01_(char *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *); static integer iuplo, izero, i1, i2, k1, nerrs; extern /* Subroutine */ int zppt02_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *), zppt05_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *); static logical zerot; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *); static char xtype[1]; extern /* Subroutine */ int zhpsv_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *), zlatb4_(char *, integer *, integer *, integer *, char *, integer *, integer *, doublereal *, integer *, doublereal *, char *), aladhd_(integer *, char *); static integer nb, in, kl; extern /* Subroutine */ int alaerh_(char *, char *, integer *, integer *, char *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); static integer ku, nt; static doublereal rcondc; static char packit[1]; extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer *, integer *); static doublereal cndnum; extern /* Subroutine */ int zlaipd_(integer *, doublecomplex *, integer *, integer *); static doublereal ainvnm; extern doublereal zlanhp_(char *, char *, integer *, doublecomplex *, doublereal *); extern /* Subroutine */ int xlaenv_(integer *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, integer *, doublecomplex * , integer *), zlarhs_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, integer *), zlaset_(char *, integer *, integer *, doublecomplex *, doublecomplex *, doublecomplex *, integer *), zlatms_(integer *, integer *, char *, integer *, char *, doublereal *, integer *, doublereal *, doublereal *, integer *, integer *, char *, doublecomplex *, integer *, doublecomplex *, integer *); static doublereal result[6]; extern /* Subroutine */ int zhptrf_(char *, integer *, doublecomplex *, integer *, integer *), zhptri_(char *, integer *, doublecomplex *, integer *, doublecomplex *, integer *), zerrvx_(char *, integer *), zhpsvx_(char *, char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublereal *, doublereal *, doublereal *, doublecomplex *, doublereal *, integer *); static integer lda, npp; /* Fortran I/O blocks */ static cilist io___42 = { 0, 0, 0, fmt_9999, 0 }; static cilist io___45 = { 0, 0, 0, fmt_9998, 0 }; /* -- LAPACK test routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University September 30, 1994 Purpose ======= ZDRVHP tests the driver routines ZHPSV and -SVX. Arguments ========= DOTYPE (input) 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. NN (input) INTEGER The number of values of N contained in the vector NVAL. NVAL (input) INTEGER array, dimension (NN) The values of the matrix dimension N. NRHS (input) INTEGER The number of right hand side vectors to be generated for each linear system. THRESH (input) 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. TSTERR (input) LOGICAL Flag that indicates whether error exits are to be tested. NMAX (input) INTEGER The maximum value permitted for N, used in dimensioning the work arrays. A (workspace) COMPLEX*16 array, dimension (NMAX*(NMAX+1)/2) AFAC (workspace) COMPLEX*16 array, dimension (NMAX*(NMAX+1)/2) AINV (workspace) COMPLEX*16 array, dimension (NMAX*(NMAX+1)/2) B (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) X (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) XACT (workspace) COMPLEX*16 array, dimension (NMAX*NRHS) WORK (workspace) COMPLEX*16 array, dimension (NMAX*max(2,NRHS)) RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX+2*NRHS) IWORK (workspace) INTEGER array, dimension (NMAX) NOUT (input) INTEGER The unit number for output. ===================================================================== Parameter adjustments */ --iwork; --rwork; --work; --xact; --x; --b; --ainv; --afac; --a; --nval; --dotype; /* Function Body Initialize constants and the random number seed. */ *(unsigned char *)path = 'Z'; s_copy(path + 1, "HP", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L10: */ } /* Test the error exits */ if (*tsterr) { zerrvx_(path, nout); } infoc_1.infot = 0; /* Set the block size and minimum block size for testing. */ nb = 1; nbmin = 2; xlaenv_(&c__1, &nb); xlaenv_(&c__2, &nbmin); /* Do for each value of N in NVAL */ i__1 = *nn; for (in = 1; in <= i__1; ++in) { n = nval[in]; lda = max(n,1); npp = n * (n + 1) / 2; *(unsigned char *)xtype = 'N'; nimat = 10; if (n <= 0) { nimat = 1; } i__2 = nimat; for (imat = 1; imat <= i__2; ++imat) { /* Do the tests only if DOTYPE( IMAT ) is true. */ if (! dotype[imat]) { goto L170; } /* Skip types 3, 4, 5, or 6 if the matrix size is too small. */ zerot = imat >= 3 && imat <= 6; if (zerot && n < imat - 2) { goto L170; } /* Do first for UPLO = 'U', then for UPLO = 'L' */ for (iuplo = 1; iuplo <= 2; ++iuplo) { if (iuplo == 1) { *(unsigned char *)uplo = 'U'; *(unsigned char *)packit = 'C'; } else { *(unsigned char *)uplo = 'L'; *(unsigned char *)packit = 'R'; } /* Set up parameters with ZLATB4 and generate a test matrix with ZLATMS. */ zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)6, (ftnlen)6); zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &kl, &ku, packit, &a[1], &lda, &work[ 1], &info); /* Check error code from ZLATMS. */ if (info != 0) { alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, &n, &c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L160; } /* For types 3-6, zero one or more rows and columns of the matrix to test that INFO is returned correctly. */ if (zerot) { if (imat == 3) { izero = 1; } else if (imat == 4) { izero = n; } else { izero = n / 2 + 1; } if (imat < 6) { /* Set row and column IZERO to zero. */ if (iuplo == 1) { ioff = (izero - 1) * izero / 2; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L20: */ } ioff += izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff += i__; /* L30: */ } } else { ioff = izero; i__3 = izero - 1; for (i__ = 1; i__ <= i__3; ++i__) { i__4 = ioff; a[i__4].r = 0., a[i__4].i = 0.; ioff = ioff + n - i__; /* L40: */ } ioff -= izero; i__3 = n; for (i__ = izero; i__ <= i__3; ++i__) { i__4 = ioff + i__; a[i__4].r = 0., a[i__4].i = 0.; /* L50: */ } } } else { ioff = 0; if (iuplo == 1) { /* Set the first IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i2 = min(j,izero); i__4 = i2; for (i__ = 1; i__ <= i__4; ++i__) { i__5 = ioff + i__; a[i__5].r = 0., a[i__5].i = 0.; /* L60: */ } ioff += j; /* L70: */ } } else { /* Set the last IZERO rows and columns to zero. */ i__3 = n; for (j = 1; j <= i__3; ++j) { i1 = max(j,izero); i__4 = n; for (i__ = i1; i__ <= i__4; ++i__) { i__5 = ioff + i__; a[i__5].r = 0., a[i__5].i = 0.; /* L80: */ } ioff = ioff + n - j; /* L90: */ } } } } else { izero = 0; } /* Set the imaginary part of the diagonals. */ if (iuplo == 1) { zlaipd_(&n, &a[1], &c__2, &c__1); } else { zlaipd_(&n, &a[1], &n, &c_n1); } for (ifact = 1; ifact <= 2; ++ifact) { /* Do first for FACT = 'F', then for other values. */ *(unsigned char *)fact = *(unsigned char *)&facts[ifact - 1]; /* Compute the condition number for comparison with the value returned by ZHPSVX. */ if (zerot) { if (ifact == 1) { goto L150; } rcondc = 0.; } else if (ifact == 1) { /* Compute the 1-norm of A. */ anorm = zlanhp_("1", uplo, &n, &a[1], &rwork[1]); /* Factor the matrix A. */ zcopy_(&npp, &a[1], &c__1, &afac[1], &c__1); zhptrf_(uplo, &n, &afac[1], &iwork[1], &info); /* Compute inv(A) and take its norm. */ zcopy_(&npp, &afac[1], &c__1, &ainv[1], &c__1); zhptri_(uplo, &n, &ainv[1], &iwork[1], &work[1], & info); ainvnm = zlanhp_("1", uplo, &n, &ainv[1], &rwork[1]); /* Compute the 1-norm condition number of A. */ if (anorm <= 0. || ainvnm <= 0.) { rcondc = 1.; } else { rcondc = 1. / anorm / ainvnm; } } /* Form an exact solution and set the right hand side. */ s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)6, (ftnlen)6); zlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, nrhs, & a[1], &lda, &xact[1], &lda, &b[1], &lda, iseed, & info); *(unsigned char *)xtype = 'C'; /* --- Test ZHPSV --- */ if (ifact == 2) { zcopy_(&npp, &a[1], &c__1, &afac[1], &c__1); zlacpy_("Full", &n, nrhs, &b[1], &lda, &x[1], &lda); /* Factor the matrix and solve the system using ZHPSV. */ s_copy(srnamc_1.srnamt, "ZHPSV ", (ftnlen)6, (ftnlen) 6); zhpsv_(uplo, &n, nrhs, &afac[1], &iwork[1], &x[1], & lda, &info); /* Adjust the expected value of INFO to account for pivoting. */ k = izero; if (k > 0) { L100: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L100; } } else if (iwork[k] != k) { k = iwork[k]; goto L100; } } /* Check error code from ZHPSV . */ if (info != k) { alaerh_(path, "ZHPSV ", &info, &k, uplo, &n, &n, & c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs, nout); goto L120; } else if (info != 0) { goto L120; } /* Reconstruct matrix from factors and compute residual. */ zhpt01_(uplo, &n, &a[1], &afac[1], &iwork[1], &ainv[1] , &lda, &rwork[1], result); /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); zppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1], &lda, &rwork[1], &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); nt = 3; /* Print information about the tests that did not pass the threshold. */ i__3 = nt; for (k = 1; k <= i__3; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___42.ciunit = *nout; s_wsfe(&io___42); do_fio(&c__1, "ZHPSV ", (ftnlen)6); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L110: */ } nrun += nt; L120: ; } /* --- Test ZHPSVX --- */ if (ifact == 2 && npp > 0) { zlaset_("Full", &npp, &c__1, &c_b64, &c_b64, &afac[1], &npp); } zlaset_("Full", &n, nrhs, &c_b64, &c_b64, &x[1], &lda); /* Solve the system and compute the condition number and error bounds using ZHPSVX. */ s_copy(srnamc_1.srnamt, "ZHPSVX", (ftnlen)6, (ftnlen)6); zhpsvx_(fact, uplo, &n, nrhs, &a[1], &afac[1], &iwork[1], &b[1], &lda, &x[1], &lda, &rcond, &rwork[1], & rwork[*nrhs + 1], &work[1], &rwork[(*nrhs << 1) + 1], &info); /* Adjust the expected value of INFO to account for pivoting. */ k = izero; if (k > 0) { L130: if (iwork[k] < 0) { if (iwork[k] != -k) { k = -iwork[k]; goto L130; } } else if (iwork[k] != k) { k = iwork[k]; goto L130; } } /* Check the error code from ZHPSVX. */ if (info != k) { /* Writing concatenation */ i__6[0] = 1, a__1[0] = fact; i__6[1] = 1, a__1[1] = uplo; s_cat(ch__1, a__1, i__6, &c__2, (ftnlen)2); alaerh_(path, "ZHPSVX", &info, &k, ch__1, &n, &n, & c_n1, &c_n1, nrhs, &imat, &nfail, &nerrs, nout); goto L150; } if (info == 0) { if (ifact >= 2) { /* Reconstruct matrix from factors and compute residual. */ zhpt01_(uplo, &n, &a[1], &afac[1], &iwork[1], & ainv[1], &lda, &rwork[(*nrhs << 1) + 1], result); k1 = 1; } else { k1 = 2; } /* Compute residual of the computed solution. */ zlacpy_("Full", &n, nrhs, &b[1], &lda, &work[1], &lda); zppt02_(uplo, &n, nrhs, &a[1], &x[1], &lda, &work[1], &lda, &rwork[(*nrhs << 1) + 1], &result[1]); /* Check solution from generated exact solution. */ zget04_(&n, nrhs, &x[1], &lda, &xact[1], &lda, & rcondc, &result[2]); /* Check the error bounds from iterative refinement. */ zppt05_(uplo, &n, nrhs, &a[1], &b[1], &lda, &x[1], & lda, &xact[1], &lda, &rwork[1], &rwork[*nrhs + 1], &result[3]); } else { k1 = 6; } /* Compare RCOND from ZHPSVX with the computed value in RCONDC. */ result[5] = dget06_(&rcond, &rcondc); /* Print information about the tests that did not pass the threshold. */ for (k = k1; k <= 6; ++k) { if (result[k - 1] >= *thresh) { if (nfail == 0 && nerrs == 0) { aladhd_(nout, path); } io___45.ciunit = *nout; s_wsfe(&io___45); do_fio(&c__1, "ZHPSVX", (ftnlen)6); do_fio(&c__1, fact, (ftnlen)1); do_fio(&c__1, uplo, (ftnlen)1); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&imat, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer)) ; do_fio(&c__1, (char *)&result[k - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); ++nfail; } /* L140: */ } nrun = nrun + 7 - k1; L150: ; } L160: ; } L170: ; } /* L180: */ } /* Print a summary of the results. */ alasvm_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZDRVHP */ } /* zdrvhp_ */