zpbcon.c
Go to the documentation of this file.
00001 /* zpbcon.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 integer c__1 = 1;
00019 
00020 /* Subroutine */ int zpbcon_(char *uplo, integer *n, integer *kd, 
00021         doublecomplex *ab, integer *ldab, doublereal *anorm, doublereal *
00022         rcond, doublecomplex *work, doublereal *rwork, integer *info)
00023 {
00024     /* System generated locals */
00025     integer ab_dim1, ab_offset, i__1;
00026     doublereal d__1, d__2;
00027 
00028     /* Builtin functions */
00029     double d_imag(doublecomplex *);
00030 
00031     /* Local variables */
00032     integer ix, kase;
00033     doublereal scale;
00034     extern logical lsame_(char *, char *);
00035     integer isave[3];
00036     logical upper;
00037     extern /* Subroutine */ int zlacn2_(integer *, doublecomplex *, 
00038             doublecomplex *, doublereal *, integer *, integer *);
00039     extern doublereal dlamch_(char *);
00040     doublereal scalel, scaleu;
00041     extern /* Subroutine */ int xerbla_(char *, integer *);
00042     doublereal ainvnm;
00043     extern integer izamax_(integer *, doublecomplex *, integer *);
00044     extern /* Subroutine */ int zlatbs_(char *, char *, char *, char *, 
00045             integer *, integer *, doublecomplex *, integer *, doublecomplex *, 
00046              doublereal *, doublereal *, integer *), zdrscl_(integer *, doublereal *, doublecomplex *, 
00047             integer *);
00048     char normin[1];
00049     doublereal smlnum;
00050 
00051 
00052 /*  -- LAPACK routine (version 3.2) -- */
00053 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00054 /*     November 2006 */
00055 
00056 /*     Modified to call ZLACN2 in place of ZLACON, 10 Feb 03, SJH. */
00057 
00058 /*     .. Scalar Arguments .. */
00059 /*     .. */
00060 /*     .. Array Arguments .. */
00061 /*     .. */
00062 
00063 /*  Purpose */
00064 /*  ======= */
00065 
00066 /*  ZPBCON estimates the reciprocal of the condition number (in the */
00067 /*  1-norm) of a complex Hermitian positive definite band matrix using */
00068 /*  the Cholesky factorization A = U**H*U or A = L*L**H computed by */
00069 /*  ZPBTRF. */
00070 
00071 /*  An estimate is obtained for norm(inv(A)), and the reciprocal of the */
00072 /*  condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))). */
00073 
00074 /*  Arguments */
00075 /*  ========= */
00076 
00077 /*  UPLO    (input) CHARACTER*1 */
00078 /*          = 'U':  Upper triangular factor stored in AB; */
00079 /*          = 'L':  Lower triangular factor stored in AB. */
00080 
00081 /*  N       (input) INTEGER */
00082 /*          The order of the matrix A.  N >= 0. */
00083 
00084 /*  KD      (input) INTEGER */
00085 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
00086 /*          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0. */
00087 
00088 /*  AB      (input) COMPLEX*16 array, dimension (LDAB,N) */
00089 /*          The triangular factor U or L from the Cholesky factorization */
00090 /*          A = U**H*U or A = L*L**H of the band matrix A, stored in the */
00091 /*          first KD+1 rows of the array.  The j-th column of U or L is */
00092 /*          stored in the j-th column of the array AB as follows: */
00093 /*          if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j; */
00094 /*          if UPLO ='L', AB(1+i-j,j)    = L(i,j) for j<=i<=min(n,j+kd). */
00095 
00096 /*  LDAB    (input) INTEGER */
00097 /*          The leading dimension of the array AB.  LDAB >= KD+1. */
00098 
00099 /*  ANORM   (input) DOUBLE PRECISION */
00100 /*          The 1-norm (or infinity-norm) of the Hermitian band matrix A. */
00101 
00102 /*  RCOND   (output) DOUBLE PRECISION */
00103 /*          The reciprocal of the condition number of the matrix A, */
00104 /*          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an */
00105 /*          estimate of the 1-norm of inv(A) computed in this routine. */
00106 
00107 /*  WORK    (workspace) COMPLEX*16 array, dimension (2*N) */
00108 
00109 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N) */
00110 
00111 /*  INFO    (output) INTEGER */
00112 /*          = 0:  successful exit */
00113 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00114 
00115 /*  ===================================================================== */
00116 
00117 /*     .. Parameters .. */
00118 /*     .. */
00119 /*     .. Local Scalars .. */
00120 /*     .. */
00121 /*     .. Local Arrays .. */
00122 /*     .. */
00123 /*     .. External Functions .. */
00124 /*     .. */
00125 /*     .. External Subroutines .. */
00126 /*     .. */
00127 /*     .. Intrinsic Functions .. */
00128 /*     .. */
00129 /*     .. Statement Functions .. */
00130 /*     .. */
00131 /*     .. Statement Function definitions .. */
00132 /*     .. */
00133 /*     .. Executable Statements .. */
00134 
00135 /*     Test the input parameters. */
00136 
00137     /* Parameter adjustments */
00138     ab_dim1 = *ldab;
00139     ab_offset = 1 + ab_dim1;
00140     ab -= ab_offset;
00141     --work;
00142     --rwork;
00143 
00144     /* Function Body */
00145     *info = 0;
00146     upper = lsame_(uplo, "U");
00147     if (! upper && ! lsame_(uplo, "L")) {
00148         *info = -1;
00149     } else if (*n < 0) {
00150         *info = -2;
00151     } else if (*kd < 0) {
00152         *info = -3;
00153     } else if (*ldab < *kd + 1) {
00154         *info = -5;
00155     } else if (*anorm < 0.) {
00156         *info = -6;
00157     }
00158     if (*info != 0) {
00159         i__1 = -(*info);
00160         xerbla_("ZPBCON", &i__1);
00161         return 0;
00162     }
00163 
00164 /*     Quick return if possible */
00165 
00166     *rcond = 0.;
00167     if (*n == 0) {
00168         *rcond = 1.;
00169         return 0;
00170     } else if (*anorm == 0.) {
00171         return 0;
00172     }
00173 
00174     smlnum = dlamch_("Safe minimum");
00175 
00176 /*     Estimate the 1-norm of the inverse. */
00177 
00178     kase = 0;
00179     *(unsigned char *)normin = 'N';
00180 L10:
00181     zlacn2_(n, &work[*n + 1], &work[1], &ainvnm, &kase, isave);
00182     if (kase != 0) {
00183         if (upper) {
00184 
00185 /*           Multiply by inv(U'). */
00186 
00187             zlatbs_("Upper", "Conjugate transpose", "Non-unit", normin, n, kd, 
00188                      &ab[ab_offset], ldab, &work[1], &scalel, &rwork[1], info);
00189             *(unsigned char *)normin = 'Y';
00190 
00191 /*           Multiply by inv(U). */
00192 
00193             zlatbs_("Upper", "No transpose", "Non-unit", normin, n, kd, &ab[
00194                     ab_offset], ldab, &work[1], &scaleu, &rwork[1], info);
00195         } else {
00196 
00197 /*           Multiply by inv(L). */
00198 
00199             zlatbs_("Lower", "No transpose", "Non-unit", normin, n, kd, &ab[
00200                     ab_offset], ldab, &work[1], &scalel, &rwork[1], info);
00201             *(unsigned char *)normin = 'Y';
00202 
00203 /*           Multiply by inv(L'). */
00204 
00205             zlatbs_("Lower", "Conjugate transpose", "Non-unit", normin, n, kd, 
00206                      &ab[ab_offset], ldab, &work[1], &scaleu, &rwork[1], info);
00207         }
00208 
00209 /*        Multiply by 1/SCALE if doing so will not cause overflow. */
00210 
00211         scale = scalel * scaleu;
00212         if (scale != 1.) {
00213             ix = izamax_(n, &work[1], &c__1);
00214             i__1 = ix;
00215             if (scale < ((d__1 = work[i__1].r, abs(d__1)) + (d__2 = d_imag(&
00216                     work[ix]), abs(d__2))) * smlnum || scale == 0.) {
00217                 goto L20;
00218             }
00219             zdrscl_(n, &scale, &work[1], &c__1);
00220         }
00221         goto L10;
00222     }
00223 
00224 /*     Compute the estimate of the reciprocal condition number. */
00225 
00226     if (ainvnm != 0.) {
00227         *rcond = 1. / ainvnm / *anorm;
00228     }
00229 
00230 L20:
00231 
00232     return 0;
00233 
00234 /*     End of ZPBCON */
00235 
00236 } /* zpbcon_ */


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