dsycon.c
Go to the documentation of this file.
00001 /* dsycon.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 dsycon_(char *uplo, integer *n, doublereal *a, integer *
00021         lda, integer *ipiv, doublereal *anorm, doublereal *rcond, doublereal *
00022         work, integer *iwork, integer *info)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, i__1;
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 dlacn2_(integer *, doublereal *, doublereal *, 
00033              integer *, doublereal *, integer *, integer *), xerbla_(char *, 
00034             integer *);
00035     doublereal ainvnm;
00036     extern /* Subroutine */ int dsytrs_(char *, integer *, integer *, 
00037             doublereal *, integer *, integer *, doublereal *, 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 DLACN2 in place of DLACON, 5 Feb 03, SJH. */
00046 
00047 /*     .. Scalar Arguments .. */
00048 /*     .. */
00049 /*     .. Array Arguments .. */
00050 /*     .. */
00051 
00052 /*  Purpose */
00053 /*  ======= */
00054 
00055 /*  DSYCON estimates the reciprocal of the condition number (in the */
00056 /*  1-norm) of a real symmetric matrix A using the factorization */
00057 /*  A = U*D*U**T or A = L*D*L**T computed by DSYTRF. */
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) DOUBLE PRECISION 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 DSYTRF. */
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 DSYTRF. */
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) DOUBLE PRECISION array, dimension (2*N) */
00094 
00095 /*  IWORK    (workspace) INTEGER array, dimension (N) */
00096 
00097 /*  INFO    (output) INTEGER */
00098 /*          = 0:  successful exit */
00099 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00100 
00101 /*  ===================================================================== */
00102 
00103 /*     .. Parameters .. */
00104 /*     .. */
00105 /*     .. Local Scalars .. */
00106 /*     .. */
00107 /*     .. Local Arrays .. */
00108 /*     .. */
00109 /*     .. External Functions .. */
00110 /*     .. */
00111 /*     .. External Subroutines .. */
00112 /*     .. */
00113 /*     .. Intrinsic Functions .. */
00114 /*     .. */
00115 /*     .. Executable Statements .. */
00116 
00117 /*     Test the input parameters. */
00118 
00119     /* Parameter adjustments */
00120     a_dim1 = *lda;
00121     a_offset = 1 + a_dim1;
00122     a -= a_offset;
00123     --ipiv;
00124     --work;
00125     --iwork;
00126 
00127     /* Function Body */
00128     *info = 0;
00129     upper = lsame_(uplo, "U");
00130     if (! upper && ! lsame_(uplo, "L")) {
00131         *info = -1;
00132     } else if (*n < 0) {
00133         *info = -2;
00134     } else if (*lda < max(1,*n)) {
00135         *info = -4;
00136     } else if (*anorm < 0.) {
00137         *info = -6;
00138     }
00139     if (*info != 0) {
00140         i__1 = -(*info);
00141         xerbla_("DSYCON", &i__1);
00142         return 0;
00143     }
00144 
00145 /*     Quick return if possible */
00146 
00147     *rcond = 0.;
00148     if (*n == 0) {
00149         *rcond = 1.;
00150         return 0;
00151     } else if (*anorm <= 0.) {
00152         return 0;
00153     }
00154 
00155 /*     Check that the diagonal matrix D is nonsingular. */
00156 
00157     if (upper) {
00158 
00159 /*        Upper triangular storage: examine D from bottom to top */
00160 
00161         for (i__ = *n; i__ >= 1; --i__) {
00162             if (ipiv[i__] > 0 && a[i__ + i__ * a_dim1] == 0.) {
00163                 return 0;
00164             }
00165 /* L10: */
00166         }
00167     } else {
00168 
00169 /*        Lower triangular storage: examine D from top to bottom. */
00170 
00171         i__1 = *n;
00172         for (i__ = 1; i__ <= i__1; ++i__) {
00173             if (ipiv[i__] > 0 && a[i__ + i__ * a_dim1] == 0.) {
00174                 return 0;
00175             }
00176 /* L20: */
00177         }
00178     }
00179 
00180 /*     Estimate the 1-norm of the inverse. */
00181 
00182     kase = 0;
00183 L30:
00184     dlacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
00185     if (kase != 0) {
00186 
00187 /*        Multiply by inv(L*D*L') or inv(U*D*U'). */
00188 
00189         dsytrs_(uplo, n, &c__1, &a[a_offset], lda, &ipiv[1], &work[1], n, 
00190                 info);
00191         goto L30;
00192     }
00193 
00194 /*     Compute the estimate of the reciprocal condition number. */
00195 
00196     if (ainvnm != 0.) {
00197         *rcond = 1. / ainvnm / *anorm;
00198     }
00199 
00200     return 0;
00201 
00202 /*     End of DSYCON */
00203 
00204 } /* dsycon_ */


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