zqrt13.c
Go to the documentation of this file.
00001 /* zqrt13.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__2 = 2;
00019 static integer c__1 = 1;
00020 static integer c__0 = 0;
00021 
00022 /* Subroutine */ int zqrt13_(integer *scale, integer *m, integer *n, 
00023         doublecomplex *a, integer *lda, doublereal *norma, integer *iseed)
00024 {
00025     /* System generated locals */
00026     integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00027     doublereal d__1, d__2, d__3;
00028     doublecomplex z__1, z__2;
00029 
00030     /* Builtin functions */
00031     double d_sign(doublereal *, doublereal *);
00032 
00033     /* Local variables */
00034     integer j, info;
00035     doublereal dummy[1];
00036     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00037     extern doublereal dlamch_(char *), zlange_(char *, integer *, 
00038             integer *, doublecomplex *, integer *, doublereal *);
00039     doublereal bignum;
00040     extern /* Subroutine */ int zlascl_(char *, integer *, integer *, 
00041             doublereal *, doublereal *, integer *, integer *, doublecomplex *, 
00042              integer *, integer *);
00043     extern doublereal dzasum_(integer *, doublecomplex *, integer *);
00044     doublereal smlnum;
00045     extern /* Subroutine */ int zlarnv_(integer *, integer *, integer *, 
00046             doublecomplex *);
00047 
00048 
00049 /*  -- LAPACK test routine (version 3.1) -- */
00050 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00051 /*     November 2006 */
00052 
00053 /*     .. Scalar Arguments .. */
00054 /*     .. */
00055 /*     .. Array Arguments .. */
00056 /*     .. */
00057 
00058 /*  Purpose */
00059 /*  ======= */
00060 
00061 /*  ZQRT13 generates a full-rank matrix that may be scaled to have large */
00062 /*  or small norm. */
00063 
00064 /*  Arguments */
00065 /*  ========= */
00066 
00067 /*  SCALE   (input) INTEGER */
00068 /*          SCALE = 1: normally scaled matrix */
00069 /*          SCALE = 2: matrix scaled up */
00070 /*          SCALE = 3: matrix scaled down */
00071 
00072 /*  M       (input) INTEGER */
00073 /*          The number of rows of the matrix A. */
00074 
00075 /*  N       (input) INTEGER */
00076 /*          The number of columns of A. */
00077 
00078 /*  A       (output) COMPLEX*16 array, dimension (LDA,N) */
00079 /*          The M-by-N matrix A. */
00080 
00081 /*  LDA     (input) INTEGER */
00082 /*          The leading dimension of the array A. */
00083 
00084 /*  NORMA   (output) DOUBLE PRECISION */
00085 /*          The one-norm of A. */
00086 
00087 /*  ISEED   (input/output) integer array, dimension (4) */
00088 /*          Seed for random number generator */
00089 
00090 /*  ===================================================================== */
00091 
00092 /*     .. Parameters .. */
00093 /*     .. */
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. External Functions .. */
00097 /*     .. */
00098 /*     .. External Subroutines .. */
00099 /*     .. */
00100 /*     .. Intrinsic Functions .. */
00101 /*     .. */
00102 /*     .. Local Arrays .. */
00103 /*     .. */
00104 /*     .. Executable Statements .. */
00105 
00106     /* Parameter adjustments */
00107     a_dim1 = *lda;
00108     a_offset = 1 + a_dim1;
00109     a -= a_offset;
00110     --iseed;
00111 
00112     /* Function Body */
00113     if (*m <= 0 || *n <= 0) {
00114         return 0;
00115     }
00116 
00117 /*     benign matrix */
00118 
00119     i__1 = *n;
00120     for (j = 1; j <= i__1; ++j) {
00121         zlarnv_(&c__2, &iseed[1], m, &a[j * a_dim1 + 1]);
00122         if (j <= *m) {
00123             i__2 = j + j * a_dim1;
00124             i__3 = j + j * a_dim1;
00125             d__2 = dzasum_(m, &a[j * a_dim1 + 1], &c__1);
00126             i__4 = j + j * a_dim1;
00127             d__3 = a[i__4].r;
00128             d__1 = d_sign(&d__2, &d__3);
00129             z__2.r = d__1, z__2.i = 0.;
00130             z__1.r = a[i__3].r + z__2.r, z__1.i = a[i__3].i + z__2.i;
00131             a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00132         }
00133 /* L10: */
00134     }
00135 
00136 /*     scaled versions */
00137 
00138     if (*scale != 1) {
00139         *norma = zlange_("Max", m, n, &a[a_offset], lda, dummy);
00140         smlnum = dlamch_("Safe minimum");
00141         bignum = 1. / smlnum;
00142         dlabad_(&smlnum, &bignum);
00143         smlnum /= dlamch_("Epsilon");
00144         bignum = 1. / smlnum;
00145 
00146         if (*scale == 2) {
00147 
00148 /*           matrix scaled up */
00149 
00150             zlascl_("General", &c__0, &c__0, norma, &bignum, m, n, &a[
00151                     a_offset], lda, &info);
00152         } else if (*scale == 3) {
00153 
00154 /*           matrix scaled down */
00155 
00156             zlascl_("General", &c__0, &c__0, norma, &smlnum, m, n, &a[
00157                     a_offset], lda, &info);
00158         }
00159     }
00160 
00161     *norma = zlange_("One-norm", m, n, &a[a_offset], lda, dummy);
00162     return 0;
00163 
00164 /*     End of ZQRT13 */
00165 
00166 } /* zqrt13_ */


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