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


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