zsyt03.c
Go to the documentation of this file.
00001 /* zsyt03.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 doublecomplex c_b1 = {0.,0.};
00019 
00020 /* Subroutine */ int zsyt03_(char *uplo, integer *n, doublecomplex *a, 
00021         integer *lda, doublecomplex *ainv, integer *ldainv, doublecomplex *
00022         work, integer *ldwork, doublereal *rwork, doublereal *rcond, 
00023         doublereal *resid)
00024 {
00025     /* System generated locals */
00026     integer a_dim1, a_offset, ainv_dim1, ainv_offset, work_dim1, work_offset, 
00027             i__1, i__2, i__3, i__4;
00028     doublecomplex z__1;
00029 
00030     /* Local variables */
00031     integer i__, j;
00032     doublereal eps;
00033     extern logical lsame_(char *, char *);
00034     doublereal anorm;
00035     extern /* Subroutine */ int zsymm_(char *, char *, integer *, integer *, 
00036             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00037             integer *, doublecomplex *, doublecomplex *, integer *);
00038     extern doublereal dlamch_(char *), zlange_(char *, integer *, 
00039             integer *, doublecomplex *, integer *, doublereal *);
00040     doublereal ainvnm;
00041     extern doublereal zlansy_(char *, char *, integer *, doublecomplex *, 
00042             integer *, doublereal *);
00043 
00044 
00045 /*  -- LAPACK test routine (version 3.1) -- */
00046 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00047 /*     November 2006 */
00048 
00049 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  ZSYT03 computes the residual for a complex symmetric matrix times */
00058 /*  its inverse: */
00059 /*     norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS ) */
00060 /*  where EPS is the machine epsilon. */
00061 
00062 /*  Arguments */
00063 /*  ========== */
00064 
00065 /*  UPLO    (input) CHARACTER*1 */
00066 /*          Specifies whether the upper or lower triangular part of the */
00067 /*          complex symmetric matrix A is stored: */
00068 /*          = 'U':  Upper triangular */
00069 /*          = 'L':  Lower triangular */
00070 
00071 /*  N       (input) INTEGER */
00072 /*          The number of rows and columns of the matrix A.  N >= 0. */
00073 
00074 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00075 /*          The original complex symmetric matrix A. */
00076 
00077 /*  LDA     (input) INTEGER */
00078 /*          The leading dimension of the array A.  LDA >= max(1,N) */
00079 
00080 /*  AINV    (input/output) COMPLEX*16 array, dimension (LDAINV,N) */
00081 /*          On entry, the inverse of the matrix A, stored as a symmetric */
00082 /*          matrix in the same format as A. */
00083 /*          In this version, AINV is expanded into a full matrix and */
00084 /*          multiplied by A, so the opposing triangle of AINV will be */
00085 /*          changed; i.e., if the upper triangular part of AINV is */
00086 /*          stored, the lower triangular part will be used as work space. */
00087 
00088 /*  LDAINV  (input) INTEGER */
00089 /*          The leading dimension of the array AINV.  LDAINV >= max(1,N). */
00090 
00091 /*  WORK    (workspace) COMPLEX*16 array, dimension (LDWORK,N) */
00092 
00093 /*  LDWORK  (input) INTEGER */
00094 /*          The leading dimension of the array WORK.  LDWORK >= max(1,N). */
00095 
00096 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N) */
00097 
00098 /*  RCOND   (output) DOUBLE PRECISION */
00099 /*          The reciprocal of the condition number of A, computed as */
00100 /*          RCOND = 1/ (norm(A) * norm(AINV)). */
00101 
00102 /*  RESID   (output) DOUBLE PRECISION */
00103 /*          norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS ) */
00104 
00105 /*  ===================================================================== */
00106 
00107 
00108 /*     .. Parameters .. */
00109 /*     .. */
00110 /*     .. Local Scalars .. */
00111 /*     .. */
00112 /*     .. External Functions .. */
00113 /*     .. */
00114 /*     .. External Subroutines .. */
00115 /*     .. */
00116 /*     .. Intrinsic Functions .. */
00117 /*     .. */
00118 /*     .. Executable Statements .. */
00119 
00120 /*     Quick exit if N = 0 */
00121 
00122     /* Parameter adjustments */
00123     a_dim1 = *lda;
00124     a_offset = 1 + a_dim1;
00125     a -= a_offset;
00126     ainv_dim1 = *ldainv;
00127     ainv_offset = 1 + ainv_dim1;
00128     ainv -= ainv_offset;
00129     work_dim1 = *ldwork;
00130     work_offset = 1 + work_dim1;
00131     work -= work_offset;
00132     --rwork;
00133 
00134     /* Function Body */
00135     if (*n <= 0) {
00136         *rcond = 1.;
00137         *resid = 0.;
00138         return 0;
00139     }
00140 
00141 /*     Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0. */
00142 
00143     eps = dlamch_("Epsilon");
00144     anorm = zlansy_("1", uplo, n, &a[a_offset], lda, &rwork[1]);
00145     ainvnm = zlansy_("1", uplo, n, &ainv[ainv_offset], ldainv, &rwork[1]);
00146     if (anorm <= 0. || ainvnm <= 0.) {
00147         *rcond = 0.;
00148         *resid = 1. / eps;
00149         return 0;
00150     }
00151     *rcond = 1. / anorm / ainvnm;
00152 
00153 /*     Expand AINV into a full matrix and call ZSYMM to multiply */
00154 /*     AINV on the left by A (store the result in WORK). */
00155 
00156     if (lsame_(uplo, "U")) {
00157         i__1 = *n;
00158         for (j = 1; j <= i__1; ++j) {
00159             i__2 = j - 1;
00160             for (i__ = 1; i__ <= i__2; ++i__) {
00161                 i__3 = j + i__ * ainv_dim1;
00162                 i__4 = i__ + j * ainv_dim1;
00163                 ainv[i__3].r = ainv[i__4].r, ainv[i__3].i = ainv[i__4].i;
00164 /* L10: */
00165             }
00166 /* L20: */
00167         }
00168     } else {
00169         i__1 = *n;
00170         for (j = 1; j <= i__1; ++j) {
00171             i__2 = *n;
00172             for (i__ = j + 1; i__ <= i__2; ++i__) {
00173                 i__3 = j + i__ * ainv_dim1;
00174                 i__4 = i__ + j * ainv_dim1;
00175                 ainv[i__3].r = ainv[i__4].r, ainv[i__3].i = ainv[i__4].i;
00176 /* L30: */
00177             }
00178 /* L40: */
00179         }
00180     }
00181     z__1.r = -1., z__1.i = -0.;
00182     zsymm_("Left", uplo, n, n, &z__1, &a[a_offset], lda, &ainv[ainv_offset], 
00183             ldainv, &c_b1, &work[work_offset], ldwork);
00184 
00185 /*     Add the identity matrix to WORK . */
00186 
00187     i__1 = *n;
00188     for (i__ = 1; i__ <= i__1; ++i__) {
00189         i__2 = i__ + i__ * work_dim1;
00190         i__3 = i__ + i__ * work_dim1;
00191         z__1.r = work[i__3].r + 1., z__1.i = work[i__3].i + 0.;
00192         work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00193 /* L50: */
00194     }
00195 
00196 /*     Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS) */
00197 
00198     *resid = zlange_("1", n, n, &work[work_offset], ldwork, &rwork[1]);
00199 
00200     *resid = *resid * *rcond / eps / (doublereal) (*n);
00201 
00202     return 0;
00203 
00204 /*     End of ZSYT03 */
00205 
00206 } /* zsyt03_ */


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