/* Subroutine */ int zchkps_(logical *dotype, integer *nn, integer *nval, integer *nnb, integer *nbval, integer *nrank, integer *rankval, doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, doublecomplex *afac, doublecomplex *perm, integer *piv, doublecomplex *work, doublereal *rwork, 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, " "RANK =\002,i3,\002, Diff =\002,i5,\002, NB =\002,i4,\002, type" " \002,i2,\002, Ratio =\002,g12.5)"; /* System generated locals */ integer i__1, i__2, i__3, i__4; doublereal d__1; /* Local variables */ integer rankdiff, comprank, i__, n, nb, in, kl, ku, lda, inb; doublereal tol; integer mode, imat, info, rank; char path[3], dist[1], uplo[1], type__[1]; integer nrun; integer nfail, iseed[4], irank, nimat; doublereal anorm; integer iuplo, izero, nerrs; doublereal cndnum; doublereal result; /* Fortran I/O blocks */ static cilist io___33 = { 0, 0, 0, fmt_9999, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Craig Lucas, University of Manchester / NAG Ltd. */ /* October, 2008 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZCHKPS tests ZPSTRF. */ /* 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 block size NB. */ /* NRANK (input) INTEGER */ /* The number of values of RANK contained in the vector RANKVAL. */ /* RANKVAL (input) INTEGER array, dimension (NBVAL) */ /* The values of the block size NB. */ /* 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) */ /* PERM (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */ /* PIV (workspace) INTEGER array, dimension (NMAX) */ /* WORK (workspace) COMPLEX*16 array, dimension (NMAX*3) */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (NMAX) */ /* NOUT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Data statements .. */ /* Parameter adjustments */ --rwork; --work; --piv; --perm; --afac; --a; --rankval; --nbval; --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, "PS", (ftnlen)2, (ftnlen)2); nrun = 0; nfail = 0; nerrs = 0; for (i__ = 1; i__ <= 4; ++i__) { iseed[i__ - 1] = iseedy[i__ - 1]; /* L100: */ } /* Test the error exits */ if (*tsterr) { zerrps_(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); 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 L140; } /* Do for each value of RANK in RANKVAL */ i__3 = *nrank; for (irank = 1; irank <= i__3; ++irank) { /* Only repeat test 3 to 5 for different ranks */ /* Other tests use full rank */ if ((imat < 3 || imat > 5) && irank > 1) { goto L130; } d__1 = n * (doublereal) rankval[irank] / 100.f; rank = i_dceiling(&d__1); /* 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 ZLATB5 and generate a test matrix */ /* with ZLATMT. */ zlatb5_(path, &imat, &n, type__, &kl, &ku, &anorm, &mode, &cndnum, dist); s_copy(srnamc_1.srnamt, "ZLATMT", (ftnlen)32, (ftnlen)6); zlatmt_(&n, &n, dist, iseed, type__, &rwork[1], &mode, & cndnum, &anorm, &rank, &kl, &ku, uplo, &a[1], & lda, &work[1], &info); /* Check error code from ZLATMT. */ if (info != 0) { alaerh_(path, "ZLATMT", &info, &c__0, uplo, &n, &n, & c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, nout); goto L120; } /* 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 pivoted L*L' or U'*U factorization */ /* of the matrix. */ zlacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda); s_copy(srnamc_1.srnamt, "ZPSTRF", (ftnlen)32, (ftnlen) 6); /* Use default tolerance */ tol = -1.; zpstrf_(uplo, &n, &afac[1], &lda, &piv[1], &comprank, &tol, &rwork[1], &info); /* Check error code from ZPSTRF. */ if (info < izero || info != izero && rank == n || info <= izero && rank < n) { alaerh_(path, "ZPSTRF", &info, &izero, uplo, &n, & n, &c_n1, &c_n1, &nb, &imat, &nfail, & nerrs, nout); goto L110; } /* Skip the test if INFO is not 0. */ if (info != 0) { goto L110; } /* Reconstruct matrix from factors and compute residual. */ /* PERM holds permuted L*L^T or U^T*U */ zpst01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &perm[ 1], &lda, &piv[1], &rwork[1], &result, & comprank); /* Print information about the tests that did not pass */ /* the threshold or where computed rank was not RANK. */ if (n == 0) { comprank = 0; } rankdiff = rank - comprank; if (result >= *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 *)&rank, (ftnlen)sizeof( integer)); do_fio(&c__1, (char *)&rankdiff, (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 *)&result, (ftnlen)sizeof( doublereal)); e_wsfe(); ++nfail; } ++nrun; L110: ; } L120: ; } L130: ; } L140: ; } /* L150: */ } /* Print a summary of the results. */ alasum_(path, nout, &nfail, &nrun, &nerrs); return 0; /* End of ZCHKPS */ } /* zchkps_ */
/* Subroutine */ int zerrps_(char *path, integer *nunit) { /* System generated locals */ integer i__1; doublereal d__1; /* Builtin functions */ integer s_wsle(cilist *), e_wsle(void); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); /* Local variables */ doublecomplex a[16] /* was [4][4] */; integer i__, j, piv[4], info; doublereal rwork[8]; extern /* Subroutine */ int zpstf2_(char *, integer *, doublecomplex *, integer *, integer *, integer *, doublereal *, doublereal *, integer *), alaesm_(char *, logical *, integer *), chkxer_(char *, integer *, integer *, logical *, logical *), zpstrf_(char *, integer *, doublecomplex *, integer *, integer *, integer *, doublereal *, doublereal *, integer *); /* Fortran I/O blocks */ static cilist io___1 = { 0, 0, 0, 0, 0 }; /* -- LAPACK test routine (version 3.1) -- */ /* Craig Lucas, University of Manchester / NAG Ltd. */ /* October, 2008 */ /* .. Scalar Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZERRPS tests the error exits for the COMPLEX routines */ /* for ZPSTRF. */ /* Arguments */ /* ========= */ /* PATH (input) CHARACTER*3 */ /* The LAPACK path name for the routines to be tested. */ /* NUNIT (input) INTEGER */ /* The unit number for output. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. Local Arrays .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Scalars in Common .. */ /* .. */ /* .. Common blocks .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Executable Statements .. */ infoc_1.nout = *nunit; io___1.ciunit = infoc_1.nout; s_wsle(&io___1); e_wsle(); /* Set the variables to innocuous values. */ for (j = 1; j <= 4; ++j) { for (i__ = 1; i__ <= 4; ++i__) { i__1 = i__ + (j << 2) - 5; d__1 = 1. / (doublereal) (i__ + j); a[i__1].r = d__1, a[i__1].i = 0.; /* L100: */ } piv[j - 1] = j; rwork[j - 1] = 0.; rwork[j + 3] = 0.; /* L110: */ } infoc_1.ok = TRUE_; /* Test error exits of the routines that use the Cholesky */ /* decomposition of an Hermitian positive semidefinite matrix. */ /* ZPSTRF */ s_copy(srnamc_1.srnamt, "ZPSTRF", (ftnlen)32, (ftnlen)6); infoc_1.infot = 1; zpstrf_("/", &c__0, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTRF", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); infoc_1.infot = 2; zpstrf_("U", &c_n1, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTRF", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); infoc_1.infot = 4; zpstrf_("U", &c__2, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTRF", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); /* ZPSTF2 */ s_copy(srnamc_1.srnamt, "ZPSTF2", (ftnlen)32, (ftnlen)6); infoc_1.infot = 1; zpstf2_("/", &c__0, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTF2", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); infoc_1.infot = 2; zpstf2_("U", &c_n1, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTF2", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); infoc_1.infot = 4; zpstf2_("U", &c__2, a, &c__1, piv, &c__1, &c_b9, rwork, &info); chkxer_("ZPSTF2", &infoc_1.infot, &infoc_1.nout, &infoc_1.lerr, & infoc_1.ok); /* Print a summary line. */ alaesm_(path, &infoc_1.ok, &infoc_1.nout); return 0; /* End of ZERRPS */ } /* zerrps_ */