ssycon.c
Go to the documentation of this file.
00001 /* ssycon.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 ssycon_(char *uplo, integer *n, real *a, integer *lda, 
00021         integer *ipiv, real *anorm, real *rcond, real *work, integer *iwork, 
00022         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 slacn2_(integer *, real *, real *, integer *, 
00033             real *, integer *, integer *), xerbla_(char *, integer *);
00034     real ainvnm;
00035     extern /* Subroutine */ int ssytrs_(char *, integer *, integer *, real *, 
00036             integer *, integer *, real *, integer *, integer *);
00037 
00038 
00039 /*  -- LAPACK routine (version 3.2) -- */
00040 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00041 /*     November 2006 */
00042 
00043 /*     Modified to call SLACN2 in place of SLACON, 7 Feb 03, SJH. */
00044 
00045 /*     .. Scalar Arguments .. */
00046 /*     .. */
00047 /*     .. Array Arguments .. */
00048 /*     .. */
00049 
00050 /*  Purpose */
00051 /*  ======= */
00052 
00053 /*  SSYCON estimates the reciprocal of the condition number (in the */
00054 /*  1-norm) of a real symmetric matrix A using the factorization */
00055 /*  A = U*D*U**T or A = L*D*L**T computed by SSYTRF. */
00056 
00057 /*  An estimate is obtained for norm(inv(A)), and the reciprocal of the */
00058 /*  condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))). */
00059 
00060 /*  Arguments */
00061 /*  ========= */
00062 
00063 /*  UPLO    (input) CHARACTER*1 */
00064 /*          Specifies whether the details of the factorization are stored */
00065 /*          as an upper or lower triangular matrix. */
00066 /*          = 'U':  Upper triangular, form is A = U*D*U**T; */
00067 /*          = 'L':  Lower triangular, form is A = L*D*L**T. */
00068 
00069 /*  N       (input) INTEGER */
00070 /*          The order of the matrix A.  N >= 0. */
00071 
00072 /*  A       (input) REAL array, dimension (LDA,N) */
00073 /*          The block diagonal matrix D and the multipliers used to */
00074 /*          obtain the factor U or L as computed by SSYTRF. */
00075 
00076 /*  LDA     (input) INTEGER */
00077 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00078 
00079 /*  IPIV    (input) INTEGER array, dimension (N) */
00080 /*          Details of the interchanges and the block structure of D */
00081 /*          as determined by SSYTRF. */
00082 
00083 /*  ANORM   (input) REAL */
00084 /*          The 1-norm of the original matrix A. */
00085 
00086 /*  RCOND   (output) REAL */
00087 /*          The reciprocal of the condition number of the matrix A, */
00088 /*          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an */
00089 /*          estimate of the 1-norm of inv(A) computed in this routine. */
00090 
00091 /*  WORK    (workspace) REAL array, dimension (2*N) */
00092 
00093 /*  IWORK    (workspace) INTEGER array, dimension (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     --iwork;
00124 
00125     /* Function Body */
00126     *info = 0;
00127     upper = lsame_(uplo, "U");
00128     if (! upper && ! lsame_(uplo, "L")) {
00129         *info = -1;
00130     } else if (*n < 0) {
00131         *info = -2;
00132     } else if (*lda < max(1,*n)) {
00133         *info = -4;
00134     } else if (*anorm < 0.f) {
00135         *info = -6;
00136     }
00137     if (*info != 0) {
00138         i__1 = -(*info);
00139         xerbla_("SSYCON", &i__1);
00140         return 0;
00141     }
00142 
00143 /*     Quick return if possible */
00144 
00145     *rcond = 0.f;
00146     if (*n == 0) {
00147         *rcond = 1.f;
00148         return 0;
00149     } else if (*anorm <= 0.f) {
00150         return 0;
00151     }
00152 
00153 /*     Check that the diagonal matrix D is nonsingular. */
00154 
00155     if (upper) {
00156 
00157 /*        Upper triangular storage: examine D from bottom to top */
00158 
00159         for (i__ = *n; i__ >= 1; --i__) {
00160             if (ipiv[i__] > 0 && a[i__ + i__ * a_dim1] == 0.f) {
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             if (ipiv[i__] > 0 && a[i__ + i__ * a_dim1] == 0.f) {
00172                 return 0;
00173             }
00174 /* L20: */
00175         }
00176     }
00177 
00178 /*     Estimate the 1-norm of the inverse. */
00179 
00180     kase = 0;
00181 L30:
00182     slacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
00183     if (kase != 0) {
00184 
00185 /*        Multiply by inv(L*D*L') or inv(U*D*U'). */
00186 
00187         ssytrs_(uplo, n, &c__1, &a[a_offset], lda, &ipiv[1], &work[1], n, 
00188                 info);
00189         goto L30;
00190     }
00191 
00192 /*     Compute the estimate of the reciprocal condition number. */
00193 
00194     if (ainvnm != 0.f) {
00195         *rcond = 1.f / ainvnm / *anorm;
00196     }
00197 
00198     return 0;
00199 
00200 /*     End of SSYCON */
00201 
00202 } /* ssycon_ */


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