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


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