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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:47