zlatme.c
Go to the documentation of this file.
00001 /* zlatme.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__1 = 1;
00021 static integer c__0 = 0;
00022 static integer c__5 = 5;
00023 
00024 /* Subroutine */ int zlatme_(integer *n, char *dist, integer *iseed, 
00025         doublecomplex *d__, integer *mode, doublereal *cond, doublecomplex *
00026         dmax__, char *ei, char *rsign, char *upper, char *sim, doublereal *ds, 
00027          integer *modes, doublereal *conds, integer *kl, integer *ku, 
00028         doublereal *anorm, doublecomplex *a, integer *lda, doublecomplex *
00029         work, integer *info)
00030 {
00031     /* System generated locals */
00032     integer a_dim1, a_offset, i__1, i__2;
00033     doublereal d__1, d__2;
00034     doublecomplex z__1, z__2;
00035 
00036     /* Builtin functions */
00037     double z_abs(doublecomplex *);
00038     void d_cnjg(doublecomplex *, doublecomplex *);
00039 
00040     /* Local variables */
00041     integer i__, j, ic, jc, ir, jcr;
00042     doublecomplex tau;
00043     logical bads;
00044     integer isim;
00045     doublereal temp;
00046     doublecomplex alpha;
00047     extern logical lsame_(char *, char *);
00048     integer iinfo;
00049     doublereal tempa[1];
00050     integer icols;
00051     extern /* Subroutine */ int zgerc_(integer *, integer *, doublecomplex *, 
00052             doublecomplex *, integer *, doublecomplex *, integer *, 
00053             doublecomplex *, integer *);
00054     integer idist;
00055     extern /* Subroutine */ int zscal_(integer *, doublecomplex *, 
00056             doublecomplex *, integer *), zgemv_(char *, integer *, integer *, 
00057             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00058             integer *, doublecomplex *, doublecomplex *, integer *);
00059     integer irows;
00060     extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, 
00061             doublecomplex *, integer *), dlatm1_(integer *, doublereal *, 
00062             integer *, integer *, integer *, doublereal *, integer *, integer 
00063             *), zlatm1_(integer *, doublereal *, integer *, integer *, 
00064             integer *, doublecomplex *, integer *, integer *);
00065     doublereal ralpha;
00066     extern /* Subroutine */ int xerbla_(char *, integer *);
00067     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00068             integer *, doublereal *);
00069     extern /* Subroutine */ int zdscal_(integer *, doublereal *, 
00070             doublecomplex *, integer *), zlarge_(integer *, doublecomplex *, 
00071             integer *, integer *, doublecomplex *, integer *), zlarfg_(
00072             integer *, doublecomplex *, doublecomplex *, integer *, 
00073             doublecomplex *), zlacgv_(integer *, doublecomplex *, integer *);
00074     extern /* Double Complex */ VOID zlarnd_(doublecomplex *, integer *, 
00075             integer *);
00076     integer irsign;
00077     extern /* Subroutine */ int zlaset_(char *, integer *, integer *, 
00078             doublecomplex *, doublecomplex *, doublecomplex *, integer *);
00079     integer iupper;
00080     extern /* Subroutine */ int zlarnv_(integer *, integer *, integer *, 
00081             doublecomplex *);
00082     doublecomplex xnorms;
00083 
00084 
00085 /*  -- LAPACK test routine (version 3.1) -- */
00086 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00087 /*     November 2006 */
00088 
00089 /*     .. Scalar Arguments .. */
00090 /*     .. */
00091 /*     .. Array Arguments .. */
00092 /*     .. */
00093 
00094 /*  Purpose */
00095 /*  ======= */
00096 
00097 /*     ZLATME generates random non-symmetric square matrices with */
00098 /*     specified eigenvalues for testing LAPACK programs. */
00099 
00100 /*     ZLATME operates by applying the following sequence of */
00101 /*     operations: */
00102 
00103 /*     1. Set the diagonal to D, where D may be input or */
00104 /*          computed according to MODE, COND, DMAX, and RSIGN */
00105 /*          as described below. */
00106 
00107 /*     2. If UPPER='T', the upper triangle of A is set to random values */
00108 /*          out of distribution DIST. */
00109 
00110 /*     3. If SIM='T', A is multiplied on the left by a random matrix */
00111 /*          X, whose singular values are specified by DS, MODES, and */
00112 /*          CONDS, and on the right by X inverse. */
00113 
00114 /*     4. If KL < N-1, the lower bandwidth is reduced to KL using */
00115 /*          Householder transformations.  If KU < N-1, the upper */
00116 /*          bandwidth is reduced to KU. */
00117 
00118 /*     5. If ANORM is not negative, the matrix is scaled to have */
00119 /*          maximum-element-norm ANORM. */
00120 
00121 /*     (Note: since the matrix cannot be reduced beyond Hessenberg form, */
00122 /*      no packing options are available.) */
00123 
00124 /*  Arguments */
00125 /*  ========= */
00126 
00127 /*  N      - INTEGER */
00128 /*           The number of columns (or rows) of A. Not modified. */
00129 
00130 /*  DIST   - CHARACTER*1 */
00131 /*           On entry, DIST specifies the type of distribution to be used */
00132 /*           to generate the random eigen-/singular values, and on the */
00133 /*           upper triangle (see UPPER). */
00134 /*           'U' => UNIFORM( 0, 1 )  ( 'U' for uniform ) */
00135 /*           'S' => UNIFORM( -1, 1 ) ( 'S' for symmetric ) */
00136 /*           'N' => NORMAL( 0, 1 )   ( 'N' for normal ) */
00137 /*           'D' => uniform on the complex disc |z| < 1. */
00138 /*           Not modified. */
00139 
00140 /*  ISEED  - INTEGER array, dimension ( 4 ) */
00141 /*           On entry ISEED specifies the seed of the random number */
00142 /*           generator. They should lie between 0 and 4095 inclusive, */
00143 /*           and ISEED(4) should be odd. The random number generator */
00144 /*           uses a linear congruential sequence limited to small */
00145 /*           integers, and so should produce machine independent */
00146 /*           random numbers. The values of ISEED are changed on */
00147 /*           exit, and can be used in the next call to ZLATME */
00148 /*           to continue the same random number sequence. */
00149 /*           Changed on exit. */
00150 
00151 /*  D      - COMPLEX*16 array, dimension ( N ) */
00152 /*           This array is used to specify the eigenvalues of A.  If */
00153 /*           MODE=0, then D is assumed to contain the eigenvalues */
00154 /*           otherwise they will be computed according to MODE, COND, */
00155 /*           DMAX, and RSIGN and placed in D. */
00156 /*           Modified if MODE is nonzero. */
00157 
00158 /*  MODE   - INTEGER */
00159 /*           On entry this describes how the eigenvalues are to */
00160 /*           be specified: */
00161 /*           MODE = 0 means use D as input */
00162 /*           MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND */
00163 /*           MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND */
00164 /*           MODE = 3 sets D(I)=COND**(-(I-1)/(N-1)) */
00165 /*           MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND) */
00166 /*           MODE = 5 sets D to random numbers in the range */
00167 /*                    ( 1/COND , 1 ) such that their logarithms */
00168 /*                    are uniformly distributed. */
00169 /*           MODE = 6 set D to random numbers from same distribution */
00170 /*                    as the rest of the matrix. */
00171 /*           MODE < 0 has the same meaning as ABS(MODE), except that */
00172 /*              the order of the elements of D is reversed. */
00173 /*           Thus if MODE is between 1 and 4, D has entries ranging */
00174 /*              from 1 to 1/COND, if between -1 and -4, D has entries */
00175 /*              ranging from 1/COND to 1, */
00176 /*           Not modified. */
00177 
00178 /*  COND   - DOUBLE PRECISION */
00179 /*           On entry, this is used as described under MODE above. */
00180 /*           If used, it must be >= 1. Not modified. */
00181 
00182 /*  DMAX   - COMPLEX*16 */
00183 /*           If MODE is neither -6, 0 nor 6, the contents of D, as */
00184 /*           computed according to MODE and COND, will be scaled by */
00185 /*           DMAX / max(abs(D(i))).  Note that DMAX need not be */
00186 /*           positive or real: if DMAX is negative or complex (or zero), */
00187 /*           D will be scaled by a negative or complex number (or zero). */
00188 /*           If RSIGN='F' then the largest (absolute) eigenvalue will be */
00189 /*           equal to DMAX. */
00190 /*           Not modified. */
00191 
00192 /*  EI     - CHARACTER*1 (ignored) */
00193 /*           Not modified. */
00194 
00195 /*  RSIGN  - CHARACTER*1 */
00196 /*           If MODE is not 0, 6, or -6, and RSIGN='T', then the */
00197 /*           elements of D, as computed according to MODE and COND, will */
00198 /*           be multiplied by a random complex number from the unit */
00199 /*           circle |z| = 1.  If RSIGN='F', they will not be.  RSIGN may */
00200 /*           only have the values 'T' or 'F'. */
00201 /*           Not modified. */
00202 
00203 /*  UPPER  - CHARACTER*1 */
00204 /*           If UPPER='T', then the elements of A above the diagonal */
00205 /*           will be set to random numbers out of DIST.  If UPPER='F', */
00206 /*           they will not.  UPPER may only have the values 'T' or 'F'. */
00207 /*           Not modified. */
00208 
00209 /*  SIM    - CHARACTER*1 */
00210 /*           If SIM='T', then A will be operated on by a "similarity */
00211 /*           transform", i.e., multiplied on the left by a matrix X and */
00212 /*           on the right by X inverse.  X = U S V, where U and V are */
00213 /*           random unitary matrices and S is a (diagonal) matrix of */
00214 /*           singular values specified by DS, MODES, and CONDS.  If */
00215 /*           SIM='F', then A will not be transformed. */
00216 /*           Not modified. */
00217 
00218 /*  DS     - DOUBLE PRECISION array, dimension ( N ) */
00219 /*           This array is used to specify the singular values of X, */
00220 /*           in the same way that D specifies the eigenvalues of A. */
00221 /*           If MODE=0, the DS contains the singular values, which */
00222 /*           may not be zero. */
00223 /*           Modified if MODE is nonzero. */
00224 
00225 /*  MODES  - INTEGER */
00226 /*  CONDS  - DOUBLE PRECISION */
00227 /*           Similar to MODE and COND, but for specifying the diagonal */
00228 /*           of S.  MODES=-6 and +6 are not allowed (since they would */
00229 /*           result in randomly ill-conditioned eigenvalues.) */
00230 
00231 /*  KL     - INTEGER */
00232 /*           This specifies the lower bandwidth of the  matrix.  KL=1 */
00233 /*           specifies upper Hessenberg form.  If KL is at least N-1, */
00234 /*           then A will have full lower bandwidth. */
00235 /*           Not modified. */
00236 
00237 /*  KU     - INTEGER */
00238 /*           This specifies the upper bandwidth of the  matrix.  KU=1 */
00239 /*           specifies lower Hessenberg form.  If KU is at least N-1, */
00240 /*           then A will have full upper bandwidth; if KU and KL */
00241 /*           are both at least N-1, then A will be dense.  Only one of */
00242 /*           KU and KL may be less than N-1. */
00243 /*           Not modified. */
00244 
00245 /*  ANORM  - DOUBLE PRECISION */
00246 /*           If ANORM is not negative, then A will be scaled by a non- */
00247 /*           negative real number to make the maximum-element-norm of A */
00248 /*           to be ANORM. */
00249 /*           Not modified. */
00250 
00251 /*  A      - COMPLEX*16 array, dimension ( LDA, N ) */
00252 /*           On exit A is the desired test matrix. */
00253 /*           Modified. */
00254 
00255 /*  LDA    - INTEGER */
00256 /*           LDA specifies the first dimension of A as declared in the */
00257 /*           calling program.  LDA must be at least M. */
00258 /*           Not modified. */
00259 
00260 /*  WORK   - COMPLEX*16 array, dimension ( 3*N ) */
00261 /*           Workspace. */
00262 /*           Modified. */
00263 
00264 /*  INFO   - INTEGER */
00265 /*           Error code.  On exit, INFO will be set to one of the */
00266 /*           following values: */
00267 /*             0 => normal return */
00268 /*            -1 => N negative */
00269 /*            -2 => DIST illegal string */
00270 /*            -5 => MODE not in range -6 to 6 */
00271 /*            -6 => COND less than 1.0, and MODE neither -6, 0 nor 6 */
00272 /*            -9 => RSIGN is not 'T' or 'F' */
00273 /*           -10 => UPPER is not 'T' or 'F' */
00274 /*           -11 => SIM   is not 'T' or 'F' */
00275 /*           -12 => MODES=0 and DS has a zero singular value. */
00276 /*           -13 => MODES is not in the range -5 to 5. */
00277 /*           -14 => MODES is nonzero and CONDS is less than 1. */
00278 /*           -15 => KL is less than 1. */
00279 /*           -16 => KU is less than 1, or KL and KU are both less than */
00280 /*                  N-1. */
00281 /*           -19 => LDA is less than M. */
00282 /*            1  => Error return from ZLATM1 (computing D) */
00283 /*            2  => Cannot scale to DMAX (max. eigenvalue is 0) */
00284 /*            3  => Error return from DLATM1 (computing DS) */
00285 /*            4  => Error return from ZLARGE */
00286 /*            5  => Zero singular value from DLATM1. */
00287 
00288 /*  ===================================================================== */
00289 
00290 /*     .. Parameters .. */
00291 /*     .. */
00292 /*     .. Local Scalars .. */
00293 /*     .. */
00294 /*     .. Local Arrays .. */
00295 /*     .. */
00296 /*     .. External Functions .. */
00297 /*     .. */
00298 /*     .. External Subroutines .. */
00299 /*     .. */
00300 /*     .. Intrinsic Functions .. */
00301 /*     .. */
00302 /*     .. Executable Statements .. */
00303 
00304 /*     1)      Decode and Test the input parameters. */
00305 /*             Initialize flags & seed. */
00306 
00307     /* Parameter adjustments */
00308     --iseed;
00309     --d__;
00310     --ds;
00311     a_dim1 = *lda;
00312     a_offset = 1 + a_dim1;
00313     a -= a_offset;
00314     --work;
00315 
00316     /* Function Body */
00317     *info = 0;
00318 
00319 /*     Quick return if possible */
00320 
00321     if (*n == 0) {
00322         return 0;
00323     }
00324 
00325 /*     Decode DIST */
00326 
00327     if (lsame_(dist, "U")) {
00328         idist = 1;
00329     } else if (lsame_(dist, "S")) {
00330         idist = 2;
00331     } else if (lsame_(dist, "N")) {
00332         idist = 3;
00333     } else if (lsame_(dist, "D")) {
00334         idist = 4;
00335     } else {
00336         idist = -1;
00337     }
00338 
00339 /*     Decode RSIGN */
00340 
00341     if (lsame_(rsign, "T")) {
00342         irsign = 1;
00343     } else if (lsame_(rsign, "F")) {
00344         irsign = 0;
00345     } else {
00346         irsign = -1;
00347     }
00348 
00349 /*     Decode UPPER */
00350 
00351     if (lsame_(upper, "T")) {
00352         iupper = 1;
00353     } else if (lsame_(upper, "F")) {
00354         iupper = 0;
00355     } else {
00356         iupper = -1;
00357     }
00358 
00359 /*     Decode SIM */
00360 
00361     if (lsame_(sim, "T")) {
00362         isim = 1;
00363     } else if (lsame_(sim, "F")) {
00364         isim = 0;
00365     } else {
00366         isim = -1;
00367     }
00368 
00369 /*     Check DS, if MODES=0 and ISIM=1 */
00370 
00371     bads = FALSE_;
00372     if (*modes == 0 && isim == 1) {
00373         i__1 = *n;
00374         for (j = 1; j <= i__1; ++j) {
00375             if (ds[j] == 0.) {
00376                 bads = TRUE_;
00377             }
00378 /* L10: */
00379         }
00380     }
00381 
00382 /*     Set INFO if an error */
00383 
00384     if (*n < 0) {
00385         *info = -1;
00386     } else if (idist == -1) {
00387         *info = -2;
00388     } else if (abs(*mode) > 6) {
00389         *info = -5;
00390     } else if (*mode != 0 && abs(*mode) != 6 && *cond < 1.) {
00391         *info = -6;
00392     } else if (irsign == -1) {
00393         *info = -9;
00394     } else if (iupper == -1) {
00395         *info = -10;
00396     } else if (isim == -1) {
00397         *info = -11;
00398     } else if (bads) {
00399         *info = -12;
00400     } else if (isim == 1 && abs(*modes) > 5) {
00401         *info = -13;
00402     } else if (isim == 1 && *modes != 0 && *conds < 1.) {
00403         *info = -14;
00404     } else if (*kl < 1) {
00405         *info = -15;
00406     } else if (*ku < 1 || *ku < *n - 1 && *kl < *n - 1) {
00407         *info = -16;
00408     } else if (*lda < max(1,*n)) {
00409         *info = -19;
00410     }
00411 
00412     if (*info != 0) {
00413         i__1 = -(*info);
00414         xerbla_("ZLATME", &i__1);
00415         return 0;
00416     }
00417 
00418 /*     Initialize random number generator */
00419 
00420     for (i__ = 1; i__ <= 4; ++i__) {
00421         iseed[i__] = (i__1 = iseed[i__], abs(i__1)) % 4096;
00422 /* L20: */
00423     }
00424 
00425     if (iseed[4] % 2 != 1) {
00426         ++iseed[4];
00427     }
00428 
00429 /*     2)      Set up diagonal of A */
00430 
00431 /*             Compute D according to COND and MODE */
00432 
00433     zlatm1_(mode, cond, &irsign, &idist, &iseed[1], &d__[1], n, &iinfo);
00434     if (iinfo != 0) {
00435         *info = 1;
00436         return 0;
00437     }
00438     if (*mode != 0 && abs(*mode) != 6) {
00439 
00440 /*        Scale by DMAX */
00441 
00442         temp = z_abs(&d__[1]);
00443         i__1 = *n;
00444         for (i__ = 2; i__ <= i__1; ++i__) {
00445 /* Computing MAX */
00446             d__1 = temp, d__2 = z_abs(&d__[i__]);
00447             temp = max(d__1,d__2);
00448 /* L30: */
00449         }
00450 
00451         if (temp > 0.) {
00452             z__1.r = dmax__->r / temp, z__1.i = dmax__->i / temp;
00453             alpha.r = z__1.r, alpha.i = z__1.i;
00454         } else {
00455             *info = 2;
00456             return 0;
00457         }
00458 
00459         zscal_(n, &alpha, &d__[1], &c__1);
00460 
00461     }
00462 
00463     zlaset_("Full", n, n, &c_b1, &c_b1, &a[a_offset], lda);
00464     i__1 = *lda + 1;
00465     zcopy_(n, &d__[1], &c__1, &a[a_offset], &i__1);
00466 
00467 /*     3)      If UPPER='T', set upper triangle of A to random numbers. */
00468 
00469     if (iupper != 0) {
00470         i__1 = *n;
00471         for (jc = 2; jc <= i__1; ++jc) {
00472             i__2 = jc - 1;
00473             zlarnv_(&idist, &iseed[1], &i__2, &a[jc * a_dim1 + 1]);
00474 /* L40: */
00475         }
00476     }
00477 
00478 /*     4)      If SIM='T', apply similarity transformation. */
00479 
00480 /*                                -1 */
00481 /*             Transform is  X A X  , where X = U S V, thus */
00482 
00483 /*             it is  U S V A V' (1/S) U' */
00484 
00485     if (isim != 0) {
00486 
00487 /*        Compute S (singular values of the eigenvector matrix) */
00488 /*        according to CONDS and MODES */
00489 
00490         dlatm1_(modes, conds, &c__0, &c__0, &iseed[1], &ds[1], n, &iinfo);
00491         if (iinfo != 0) {
00492             *info = 3;
00493             return 0;
00494         }
00495 
00496 /*        Multiply by V and V' */
00497 
00498         zlarge_(n, &a[a_offset], lda, &iseed[1], &work[1], &iinfo);
00499         if (iinfo != 0) {
00500             *info = 4;
00501             return 0;
00502         }
00503 
00504 /*        Multiply by S and (1/S) */
00505 
00506         i__1 = *n;
00507         for (j = 1; j <= i__1; ++j) {
00508             zdscal_(n, &ds[j], &a[j + a_dim1], lda);
00509             if (ds[j] != 0.) {
00510                 d__1 = 1. / ds[j];
00511                 zdscal_(n, &d__1, &a[j * a_dim1 + 1], &c__1);
00512             } else {
00513                 *info = 5;
00514                 return 0;
00515             }
00516 /* L50: */
00517         }
00518 
00519 /*        Multiply by U and U' */
00520 
00521         zlarge_(n, &a[a_offset], lda, &iseed[1], &work[1], &iinfo);
00522         if (iinfo != 0) {
00523             *info = 4;
00524             return 0;
00525         }
00526     }
00527 
00528 /*     5)      Reduce the bandwidth. */
00529 
00530     if (*kl < *n - 1) {
00531 
00532 /*        Reduce bandwidth -- kill column */
00533 
00534         i__1 = *n - 1;
00535         for (jcr = *kl + 1; jcr <= i__1; ++jcr) {
00536             ic = jcr - *kl;
00537             irows = *n + 1 - jcr;
00538             icols = *n + *kl - jcr;
00539 
00540             zcopy_(&irows, &a[jcr + ic * a_dim1], &c__1, &work[1], &c__1);
00541             xnorms.r = work[1].r, xnorms.i = work[1].i;
00542             zlarfg_(&irows, &xnorms, &work[2], &c__1, &tau);
00543             d_cnjg(&z__1, &tau);
00544             tau.r = z__1.r, tau.i = z__1.i;
00545             work[1].r = 1., work[1].i = 0.;
00546             zlarnd_(&z__1, &c__5, &iseed[1]);
00547             alpha.r = z__1.r, alpha.i = z__1.i;
00548 
00549             zgemv_("C", &irows, &icols, &c_b2, &a[jcr + (ic + 1) * a_dim1], 
00550                     lda, &work[1], &c__1, &c_b1, &work[irows + 1], &c__1);
00551             z__1.r = -tau.r, z__1.i = -tau.i;
00552             zgerc_(&irows, &icols, &z__1, &work[1], &c__1, &work[irows + 1], &
00553                     c__1, &a[jcr + (ic + 1) * a_dim1], lda);
00554 
00555             zgemv_("N", n, &irows, &c_b2, &a[jcr * a_dim1 + 1], lda, &work[1], 
00556                      &c__1, &c_b1, &work[irows + 1], &c__1);
00557             d_cnjg(&z__2, &tau);
00558             z__1.r = -z__2.r, z__1.i = -z__2.i;
00559             zgerc_(n, &irows, &z__1, &work[irows + 1], &c__1, &work[1], &c__1, 
00560                      &a[jcr * a_dim1 + 1], lda);
00561 
00562             i__2 = jcr + ic * a_dim1;
00563             a[i__2].r = xnorms.r, a[i__2].i = xnorms.i;
00564             i__2 = irows - 1;
00565             zlaset_("Full", &i__2, &c__1, &c_b1, &c_b1, &a[jcr + 1 + ic * 
00566                     a_dim1], lda);
00567 
00568             i__2 = icols + 1;
00569             zscal_(&i__2, &alpha, &a[jcr + ic * a_dim1], lda);
00570             d_cnjg(&z__1, &alpha);
00571             zscal_(n, &z__1, &a[jcr * a_dim1 + 1], &c__1);
00572 /* L60: */
00573         }
00574     } else if (*ku < *n - 1) {
00575 
00576 /*        Reduce upper bandwidth -- kill a row at a time. */
00577 
00578         i__1 = *n - 1;
00579         for (jcr = *ku + 1; jcr <= i__1; ++jcr) {
00580             ir = jcr - *ku;
00581             irows = *n + *ku - jcr;
00582             icols = *n + 1 - jcr;
00583 
00584             zcopy_(&icols, &a[ir + jcr * a_dim1], lda, &work[1], &c__1);
00585             xnorms.r = work[1].r, xnorms.i = work[1].i;
00586             zlarfg_(&icols, &xnorms, &work[2], &c__1, &tau);
00587             d_cnjg(&z__1, &tau);
00588             tau.r = z__1.r, tau.i = z__1.i;
00589             work[1].r = 1., work[1].i = 0.;
00590             i__2 = icols - 1;
00591             zlacgv_(&i__2, &work[2], &c__1);
00592             zlarnd_(&z__1, &c__5, &iseed[1]);
00593             alpha.r = z__1.r, alpha.i = z__1.i;
00594 
00595             zgemv_("N", &irows, &icols, &c_b2, &a[ir + 1 + jcr * a_dim1], lda, 
00596                      &work[1], &c__1, &c_b1, &work[icols + 1], &c__1);
00597             z__1.r = -tau.r, z__1.i = -tau.i;
00598             zgerc_(&irows, &icols, &z__1, &work[icols + 1], &c__1, &work[1], &
00599                     c__1, &a[ir + 1 + jcr * a_dim1], lda);
00600 
00601             zgemv_("C", &icols, n, &c_b2, &a[jcr + a_dim1], lda, &work[1], &
00602                     c__1, &c_b1, &work[icols + 1], &c__1);
00603             d_cnjg(&z__2, &tau);
00604             z__1.r = -z__2.r, z__1.i = -z__2.i;
00605             zgerc_(&icols, n, &z__1, &work[1], &c__1, &work[icols + 1], &c__1, 
00606                      &a[jcr + a_dim1], lda);
00607 
00608             i__2 = ir + jcr * a_dim1;
00609             a[i__2].r = xnorms.r, a[i__2].i = xnorms.i;
00610             i__2 = icols - 1;
00611             zlaset_("Full", &c__1, &i__2, &c_b1, &c_b1, &a[ir + (jcr + 1) * 
00612                     a_dim1], lda);
00613 
00614             i__2 = irows + 1;
00615             zscal_(&i__2, &alpha, &a[ir + jcr * a_dim1], &c__1);
00616             d_cnjg(&z__1, &alpha);
00617             zscal_(n, &z__1, &a[jcr + a_dim1], lda);
00618 /* L70: */
00619         }
00620     }
00621 
00622 /*     Scale the matrix to have norm ANORM */
00623 
00624     if (*anorm >= 0.) {
00625         temp = zlange_("M", n, n, &a[a_offset], lda, tempa);
00626         if (temp > 0.) {
00627             ralpha = *anorm / temp;
00628             i__1 = *n;
00629             for (j = 1; j <= i__1; ++j) {
00630                 zdscal_(n, &ralpha, &a[j * a_dim1 + 1], &c__1);
00631 /* L80: */
00632             }
00633         }
00634     }
00635 
00636     return 0;
00637 
00638 /*     End of ZLATME */
00639 
00640 } /* zlatme_ */


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