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


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