zsycon.c
Go to the documentation of this file.
00001 /* zsycon.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 zsycon_(char *uplo, integer *n, doublecomplex *a, 
00021         integer *lda, integer *ipiv, doublereal *anorm, doublereal *rcond, 
00022         doublecomplex *work, integer *info)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, i__1, i__2;
00026 
00027     /* Local variables */
00028     integer i__, kase;
00029     extern logical lsame_(char *, char *);
00030     integer isave[3];
00031     logical upper;
00032     extern /* Subroutine */ int zlacn2_(integer *, doublecomplex *, 
00033             doublecomplex *, doublereal *, integer *, integer *), xerbla_(
00034             char *, integer *);
00035     doublereal ainvnm;
00036     extern /* Subroutine */ int zsytrs_(char *, integer *, integer *, 
00037             doublecomplex *, integer *, integer *, doublecomplex *, integer *, 
00038              integer *);
00039 
00040 
00041 /*  -- LAPACK routine (version 3.2) -- */
00042 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00043 /*     November 2006 */
00044 
00045 /*     Modified to call ZLACN2 in place of ZLACON, 10 Feb 03, SJH. */
00046 
00047 /*     .. Scalar Arguments .. */
00048 /*     .. */
00049 /*     .. Array Arguments .. */
00050 /*     .. */
00051 
00052 /*  Purpose */
00053 /*  ======= */
00054 
00055 /*  ZSYCON estimates the reciprocal of the condition number (in the */
00056 /*  1-norm) of a complex symmetric matrix A using the factorization */
00057 /*  A = U*D*U**T or A = L*D*L**T computed by ZSYTRF. */
00058 
00059 /*  An estimate is obtained for norm(inv(A)), and the reciprocal of the */
00060 /*  condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))). */
00061 
00062 /*  Arguments */
00063 /*  ========= */
00064 
00065 /*  UPLO    (input) CHARACTER*1 */
00066 /*          Specifies whether the details of the factorization are stored */
00067 /*          as an upper or lower triangular matrix. */
00068 /*          = 'U':  Upper triangular, form is A = U*D*U**T; */
00069 /*          = 'L':  Lower triangular, form is A = L*D*L**T. */
00070 
00071 /*  N       (input) INTEGER */
00072 /*          The order of the matrix A.  N >= 0. */
00073 
00074 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00075 /*          The block diagonal matrix D and the multipliers used to */
00076 /*          obtain the factor U or L as computed by ZSYTRF. */
00077 
00078 /*  LDA     (input) INTEGER */
00079 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00080 
00081 /*  IPIV    (input) INTEGER array, dimension (N) */
00082 /*          Details of the interchanges and the block structure of D */
00083 /*          as determined by ZSYTRF. */
00084 
00085 /*  ANORM   (input) DOUBLE PRECISION */
00086 /*          The 1-norm of the original matrix A. */
00087 
00088 /*  RCOND   (output) DOUBLE PRECISION */
00089 /*          The reciprocal of the condition number of the matrix A, */
00090 /*          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an */
00091 /*          estimate of the 1-norm of inv(A) computed in this routine. */
00092 
00093 /*  WORK    (workspace) COMPLEX*16 array, dimension (2*N) */
00094 
00095 /*  INFO    (output) INTEGER */
00096 /*          = 0:  successful exit */
00097 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00098 
00099 /*  ===================================================================== */
00100 
00101 /*     .. Parameters .. */
00102 /*     .. */
00103 /*     .. Local Scalars .. */
00104 /*     .. */
00105 /*     .. Local Arrays .. */
00106 /*     .. */
00107 /*     .. External Functions .. */
00108 /*     .. */
00109 /*     .. External Subroutines .. */
00110 /*     .. */
00111 /*     .. Intrinsic Functions .. */
00112 /*     .. */
00113 /*     .. Executable Statements .. */
00114 
00115 /*     Test the input parameters. */
00116 
00117     /* Parameter adjustments */
00118     a_dim1 = *lda;
00119     a_offset = 1 + a_dim1;
00120     a -= a_offset;
00121     --ipiv;
00122     --work;
00123 
00124     /* Function Body */
00125     *info = 0;
00126     upper = lsame_(uplo, "U");
00127     if (! upper && ! lsame_(uplo, "L")) {
00128         *info = -1;
00129     } else if (*n < 0) {
00130         *info = -2;
00131     } else if (*lda < max(1,*n)) {
00132         *info = -4;
00133     } else if (*anorm < 0.) {
00134         *info = -6;
00135     }
00136     if (*info != 0) {
00137         i__1 = -(*info);
00138         xerbla_("ZSYCON", &i__1);
00139         return 0;
00140     }
00141 
00142 /*     Quick return if possible */
00143 
00144     *rcond = 0.;
00145     if (*n == 0) {
00146         *rcond = 1.;
00147         return 0;
00148     } else if (*anorm <= 0.) {
00149         return 0;
00150     }
00151 
00152 /*     Check that the diagonal matrix D is nonsingular. */
00153 
00154     if (upper) {
00155 
00156 /*        Upper triangular storage: examine D from bottom to top */
00157 
00158         for (i__ = *n; i__ >= 1; --i__) {
00159             i__1 = i__ + i__ * a_dim1;
00160             if (ipiv[i__] > 0 && (a[i__1].r == 0. && a[i__1].i == 0.)) {
00161                 return 0;
00162             }
00163 /* L10: */
00164         }
00165     } else {
00166 
00167 /*        Lower triangular storage: examine D from top to bottom. */
00168 
00169         i__1 = *n;
00170         for (i__ = 1; i__ <= i__1; ++i__) {
00171             i__2 = i__ + i__ * a_dim1;
00172             if (ipiv[i__] > 0 && (a[i__2].r == 0. && a[i__2].i == 0.)) {
00173                 return 0;
00174             }
00175 /* L20: */
00176         }
00177     }
00178 
00179 /*     Estimate the 1-norm of the inverse. */
00180 
00181     kase = 0;
00182 L30:
00183     zlacn2_(n, &work[*n + 1], &work[1], &ainvnm, &kase, isave);
00184     if (kase != 0) {
00185 
00186 /*        Multiply by inv(L*D*L') or inv(U*D*U'). */
00187 
00188         zsytrs_(uplo, n, &c__1, &a[a_offset], lda, &ipiv[1], &work[1], n, 
00189                 info);
00190         goto L30;
00191     }
00192 
00193 /*     Compute the estimate of the reciprocal condition number. */
00194 
00195     if (ainvnm != 0.) {
00196         *rcond = 1. / ainvnm / *anorm;
00197     }
00198 
00199     return 0;
00200 
00201 /*     End of ZSYCON */
00202 
00203 } /* zsycon_ */


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