zpbt02.c
Go to the documentation of this file.
00001 /* zpbt02.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
00017 
00018 static doublecomplex c_b1 = {1.,0.};
00019 static integer c__1 = 1;
00020 
00021 /* Subroutine */ int zpbt02_(char *uplo, integer *n, integer *kd, integer *
00022         nrhs, doublecomplex *a, integer *lda, doublecomplex *x, integer *ldx, 
00023         doublecomplex *b, integer *ldb, doublereal *rwork, doublereal *resid)
00024 {
00025     /* System generated locals */
00026     integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset, i__1;
00027     doublereal d__1, d__2;
00028     doublecomplex z__1;
00029 
00030     /* Local variables */
00031     integer j;
00032     doublereal eps, anorm, bnorm;
00033     extern /* Subroutine */ int zhbmv_(char *, integer *, integer *, 
00034             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00035             integer *, doublecomplex *, doublecomplex *, integer *);
00036     doublereal xnorm;
00037     extern doublereal dlamch_(char *), zlanhb_(char *, char *, 
00038             integer *, integer *, doublecomplex *, integer *, doublereal *), dzasum_(integer *, doublecomplex *, integer *);
00039 
00040 
00041 /*  -- LAPACK test routine (version 3.1) -- */
00042 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00043 /*     November 2006 */
00044 
00045 /*     .. Scalar Arguments .. */
00046 /*     .. */
00047 /*     .. Array Arguments .. */
00048 /*     .. */
00049 
00050 /*  Purpose */
00051 /*  ======= */
00052 
00053 /*  ZPBT02 computes the residual for a solution of a Hermitian banded */
00054 /*  system of equations  A*x = b: */
00055 /*     RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS) */
00056 /*  where EPS is the machine precision. */
00057 
00058 /*  Arguments */
00059 /*  ========= */
00060 
00061 /*  UPLO    (input) CHARACTER*1 */
00062 /*          Specifies whether the upper or lower triangular part of the */
00063 /*          Hermitian matrix A is stored: */
00064 /*          = 'U':  Upper triangular */
00065 /*          = 'L':  Lower triangular */
00066 
00067 /*  N       (input) INTEGER */
00068 /*          The number of rows and columns of the matrix A.  N >= 0. */
00069 
00070 /*  KD      (input) INTEGER */
00071 /*          The number of super-diagonals of the matrix A if UPLO = 'U', */
00072 /*          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0. */
00073 
00074 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00075 /*          The original Hermitian band matrix A.  If UPLO = 'U', the */
00076 /*          upper triangular part of A is stored as a band matrix; if */
00077 /*          UPLO = 'L', the lower triangular part of A is stored.  The */
00078 /*          columns of the appropriate triangle are stored in the columns */
00079 /*          of A and the diagonals of the triangle are stored in the rows */
00080 /*          of A.  See ZPBTRF for further details. */
00081 
00082 /*  LDA     (input) INTEGER. */
00083 /*          The leading dimension of the array A.  LDA >= max(1,KD+1). */
00084 
00085 /*  X       (input) COMPLEX*16 array, dimension (LDX,NRHS) */
00086 /*          The computed solution vectors for the system of linear */
00087 /*          equations. */
00088 
00089 /*  LDX     (input) INTEGER */
00090 /*          The leading dimension of the array X.   LDX >= max(1,N). */
00091 
00092 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00093 /*          On entry, the right hand side vectors for the system of */
00094 /*          linear equations. */
00095 /*          On exit, B is overwritten with the difference B - A*X. */
00096 
00097 /*  LDB     (input) INTEGER */
00098 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00099 
00100 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N) */
00101 
00102 /*  RESID   (output) DOUBLE PRECISION */
00103 /*          The maximum over the number of right hand sides of */
00104 /*          norm(B - A*X) / ( norm(A) * norm(X) * EPS ). */
00105 
00106 /*  ===================================================================== */
00107 
00108 /*     .. Parameters .. */
00109 /*     .. */
00110 /*     .. Local Scalars .. */
00111 /*     .. */
00112 /*     .. External Functions .. */
00113 /*     .. */
00114 /*     .. External Subroutines .. */
00115 /*     .. */
00116 /*     .. Intrinsic Functions .. */
00117 /*     .. */
00118 /*     .. Executable Statements .. */
00119 
00120 /*     Quick exit if N = 0 or NRHS = 0. */
00121 
00122     /* Parameter adjustments */
00123     a_dim1 = *lda;
00124     a_offset = 1 + a_dim1;
00125     a -= a_offset;
00126     x_dim1 = *ldx;
00127     x_offset = 1 + x_dim1;
00128     x -= x_offset;
00129     b_dim1 = *ldb;
00130     b_offset = 1 + b_dim1;
00131     b -= b_offset;
00132     --rwork;
00133 
00134     /* Function Body */
00135     if (*n <= 0 || *nrhs <= 0) {
00136         *resid = 0.;
00137         return 0;
00138     }
00139 
00140 /*     Exit with RESID = 1/EPS if ANORM = 0. */
00141 
00142     eps = dlamch_("Epsilon");
00143     anorm = zlanhb_("1", uplo, n, kd, &a[a_offset], lda, &rwork[1]);
00144     if (anorm <= 0.) {
00145         *resid = 1. / eps;
00146         return 0;
00147     }
00148 
00149 /*     Compute  B - A*X */
00150 
00151     i__1 = *nrhs;
00152     for (j = 1; j <= i__1; ++j) {
00153         z__1.r = -1., z__1.i = -0.;
00154         zhbmv_(uplo, n, kd, &z__1, &a[a_offset], lda, &x[j * x_dim1 + 1], &
00155                 c__1, &c_b1, &b[j * b_dim1 + 1], &c__1);
00156 /* L10: */
00157     }
00158 
00159 /*     Compute the maximum over the number of right hand sides of */
00160 /*          norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) */
00161 
00162     *resid = 0.;
00163     i__1 = *nrhs;
00164     for (j = 1; j <= i__1; ++j) {
00165         bnorm = dzasum_(n, &b[j * b_dim1 + 1], &c__1);
00166         xnorm = dzasum_(n, &x[j * x_dim1 + 1], &c__1);
00167         if (xnorm <= 0.) {
00168             *resid = 1. / eps;
00169         } else {
00170 /* Computing MAX */
00171             d__1 = *resid, d__2 = bnorm / anorm / xnorm / eps;
00172             *resid = max(d__1,d__2);
00173         }
00174 /* L20: */
00175     }
00176 
00177     return 0;
00178 
00179 /*     End of ZPBT02 */
00180 
00181 } /* zpbt02_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:42