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


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