dlarge.c
Go to the documentation of this file.
00001 /* dlarge.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__3 = 3;
00019 static integer c__1 = 1;
00020 static doublereal c_b8 = 1.;
00021 static doublereal c_b10 = 0.;
00022 
00023 /* Subroutine */ int dlarge_(integer *n, doublereal *a, integer *lda, integer 
00024         *iseed, doublereal *work, integer *info)
00025 {
00026     /* System generated locals */
00027     integer a_dim1, a_offset, i__1;
00028     doublereal d__1;
00029 
00030     /* Builtin functions */
00031     double d_sign(doublereal *, doublereal *);
00032 
00033     /* Local variables */
00034     integer i__;
00035     doublereal wa, wb, wn, tau;
00036     extern /* Subroutine */ int dger_(integer *, integer *, doublereal *, 
00037             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00038             integer *);
00039     extern doublereal dnrm2_(integer *, doublereal *, integer *);
00040     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00041             integer *), dgemv_(char *, integer *, integer *, doublereal *, 
00042             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00043             doublereal *, integer *), xerbla_(char *, integer *), dlarnv_(integer *, integer *, integer *, doublereal *);
00044 
00045 
00046 /*  -- LAPACK auxiliary test routine (version 3.1) */
00047 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00048 /*     November 2006 */
00049 
00050 /*     .. Scalar Arguments .. */
00051 /*     .. */
00052 /*     .. Array Arguments .. */
00053 /*     .. */
00054 
00055 /*  Purpose */
00056 /*  ======= */
00057 
00058 /*  DLARGE pre- and post-multiplies a real general n by n matrix A */
00059 /*  with a random orthogonal matrix: A = U*D*U'. */
00060 
00061 /*  Arguments */
00062 /*  ========= */
00063 
00064 /*  N       (input) INTEGER */
00065 /*          The order of the matrix A.  N >= 0. */
00066 
00067 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00068 /*          On entry, the original n by n matrix A. */
00069 /*          On exit, A is overwritten by U*A*U' for some random */
00070 /*          orthogonal matrix U. */
00071 
00072 /*  LDA     (input) INTEGER */
00073 /*          The leading dimension of the array A.  LDA >= N. */
00074 
00075 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00076 /*          On entry, the seed of the random number generator; the array */
00077 /*          elements must be between 0 and 4095, and ISEED(4) must be */
00078 /*          odd. */
00079 /*          On exit, the seed is updated. */
00080 
00081 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (2*N) */
00082 
00083 /*  INFO    (output) INTEGER */
00084 /*          = 0: successful exit */
00085 /*          < 0: if INFO = -i, the i-th argument had an illegal value */
00086 
00087 /*  ===================================================================== */
00088 
00089 /*     .. Parameters .. */
00090 /*     .. */
00091 /*     .. Local Scalars .. */
00092 /*     .. */
00093 /*     .. External Subroutines .. */
00094 /*     .. */
00095 /*     .. Intrinsic Functions .. */
00096 /*     .. */
00097 /*     .. External Functions .. */
00098 /*     .. */
00099 /*     .. Executable Statements .. */
00100 
00101 /*     Test the input arguments */
00102 
00103     /* Parameter adjustments */
00104     a_dim1 = *lda;
00105     a_offset = 1 + a_dim1;
00106     a -= a_offset;
00107     --iseed;
00108     --work;
00109 
00110     /* Function Body */
00111     *info = 0;
00112     if (*n < 0) {
00113         *info = -1;
00114     } else if (*lda < max(1,*n)) {
00115         *info = -3;
00116     }
00117     if (*info < 0) {
00118         i__1 = -(*info);
00119         xerbla_("DLARGE", &i__1);
00120         return 0;
00121     }
00122 
00123 /*     pre- and post-multiply A by random orthogonal matrix */
00124 
00125     for (i__ = *n; i__ >= 1; --i__) {
00126 
00127 /*        generate random reflection */
00128 
00129         i__1 = *n - i__ + 1;
00130         dlarnv_(&c__3, &iseed[1], &i__1, &work[1]);
00131         i__1 = *n - i__ + 1;
00132         wn = dnrm2_(&i__1, &work[1], &c__1);
00133         wa = d_sign(&wn, &work[1]);
00134         if (wn == 0.) {
00135             tau = 0.;
00136         } else {
00137             wb = work[1] + wa;
00138             i__1 = *n - i__;
00139             d__1 = 1. / wb;
00140             dscal_(&i__1, &d__1, &work[2], &c__1);
00141             work[1] = 1.;
00142             tau = wb / wa;
00143         }
00144 
00145 /*        multiply A(i:n,1:n) by random reflection from the left */
00146 
00147         i__1 = *n - i__ + 1;
00148         dgemv_("Transpose", &i__1, n, &c_b8, &a[i__ + a_dim1], lda, &work[1], 
00149                 &c__1, &c_b10, &work[*n + 1], &c__1);
00150         i__1 = *n - i__ + 1;
00151         d__1 = -tau;
00152         dger_(&i__1, n, &d__1, &work[1], &c__1, &work[*n + 1], &c__1, &a[i__ 
00153                 + a_dim1], lda);
00154 
00155 /*        multiply A(1:n,i:n) by random reflection from the right */
00156 
00157         i__1 = *n - i__ + 1;
00158         dgemv_("No transpose", n, &i__1, &c_b8, &a[i__ * a_dim1 + 1], lda, &
00159                 work[1], &c__1, &c_b10, &work[*n + 1], &c__1);
00160         i__1 = *n - i__ + 1;
00161         d__1 = -tau;
00162         dger_(n, &i__1, &d__1, &work[*n + 1], &c__1, &work[1], &c__1, &a[i__ *
00163                  a_dim1 + 1], lda);
00164 /* L10: */
00165     }
00166     return 0;
00167 
00168 /*     End of DLARGE */
00169 
00170 } /* dlarge_ */


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