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


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