dlatms.c
Go to the documentation of this file.
00001 /* dlatms.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__1 = 1;
00019 static doublereal c_b22 = 0.;
00020 static logical c_true = TRUE_;
00021 static logical c_false = FALSE_;
00022 
00023 /* Subroutine */ int dlatms_(integer *m, integer *n, char *dist, integer *
00024         iseed, char *sym, doublereal *d__, integer *mode, doublereal *cond, 
00025         doublereal *dmax__, integer *kl, integer *ku, char *pack, doublereal *
00026         a, integer *lda, doublereal *work, integer *info)
00027 {
00028     /* System generated locals */
00029     integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5, i__6;
00030     doublereal d__1, d__2, d__3;
00031     logical L__1;
00032 
00033     /* Builtin functions */
00034     double cos(doublereal), sin(doublereal);
00035 
00036     /* Local variables */
00037     doublereal c__;
00038     integer i__, j, k;
00039     doublereal s;
00040     integer ic, jc, nc, il, ir, jr, mr, ir1, ir2, jch, llb, jkl, jku, uub, 
00041             ilda, icol;
00042     doublereal temp;
00043     integer irow, isym;
00044     doublereal alpha, angle;
00045     integer ipack;
00046     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00047             integer *);
00048     integer ioffg;
00049     extern logical lsame_(char *, char *);
00050     integer iinfo, idist, mnmin;
00051     extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, 
00052             doublereal *, integer *);
00053     integer iskew;
00054     doublereal extra, dummy;
00055     extern /* Subroutine */ int dlatm1_(integer *, doublereal *, integer *, 
00056             integer *, integer *, doublereal *, integer *, integer *), 
00057             dlagge_(integer *, integer *, integer *, integer *, doublereal *, 
00058             doublereal *, integer *, integer *, doublereal *, integer *);
00059     integer iendch, ipackg, minlda;
00060     extern doublereal dlarnd_(integer *, integer *);
00061     extern /* Subroutine */ int dlaset_(char *, integer *, integer *, 
00062             doublereal *, doublereal *, doublereal *, integer *), 
00063             dlartg_(doublereal *, doublereal *, doublereal *, doublereal *, 
00064             doublereal *), xerbla_(char *, integer *), dlagsy_(
00065             integer *, integer *, doublereal *, doublereal *, integer *, 
00066             integer *, doublereal *, integer *), dlarot_(logical *, logical *, 
00067              logical *, integer *, doublereal *, doublereal *, doublereal *, 
00068             integer *, doublereal *, doublereal *);
00069     logical iltemp, givens;
00070     integer ioffst, irsign;
00071     logical ilextr, topdwn;
00072     integer isympk;
00073 
00074 
00075 /*  -- LAPACK test routine (version 3.1) -- */
00076 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00077 /*     November 2006 */
00078 
00079 /*     .. Scalar Arguments .. */
00080 /*     .. */
00081 /*     .. Array Arguments .. */
00082 /*     .. */
00083 
00084 /*  Purpose */
00085 /*  ======= */
00086 
00087 /*     DLATMS generates random matrices with specified singular values */
00088 /*     (or symmetric/hermitian with specified eigenvalues) */
00089 /*     for testing LAPACK programs. */
00090 
00091 /*     DLATMS operates by applying the following sequence of */
00092 /*     operations: */
00093 
00094 /*       Set the diagonal to D, where D may be input or */
00095 /*          computed according to MODE, COND, DMAX, and SYM */
00096 /*          as described below. */
00097 
00098 /*       Generate a matrix with the appropriate band structure, by one */
00099 /*          of two methods: */
00100 
00101 /*       Method A: */
00102 /*           Generate a dense M x N matrix by multiplying D on the left */
00103 /*               and the right by random unitary matrices, then: */
00104 
00105 /*           Reduce the bandwidth according to KL and KU, using */
00106 /*           Householder transformations. */
00107 
00108 /*       Method B: */
00109 /*           Convert the bandwidth-0 (i.e., diagonal) matrix to a */
00110 /*               bandwidth-1 matrix using Givens rotations, "chasing" */
00111 /*               out-of-band elements back, much as in QR; then */
00112 /*               convert the bandwidth-1 to a bandwidth-2 matrix, etc. */
00113 /*               Note that for reasonably small bandwidths (relative to */
00114 /*               M and N) this requires less storage, as a dense matrix */
00115 /*               is not generated.  Also, for symmetric matrices, only */
00116 /*               one triangle is generated. */
00117 
00118 /*       Method A is chosen if the bandwidth is a large fraction of the */
00119 /*           order of the matrix, and LDA is at least M (so a dense */
00120 /*           matrix can be stored.)  Method B is chosen if the bandwidth */
00121 /*           is small (< 1/2 N for symmetric, < .3 N+M for */
00122 /*           non-symmetric), or LDA is less than M and not less than the */
00123 /*           bandwidth. */
00124 
00125 /*       Pack the matrix if desired. Options specified by PACK are: */
00126 /*          no packing */
00127 /*          zero out upper half (if symmetric) */
00128 /*          zero out lower half (if symmetric) */
00129 /*          store the upper half columnwise (if symmetric or upper */
00130 /*                triangular) */
00131 /*          store the lower half columnwise (if symmetric or lower */
00132 /*                triangular) */
00133 /*          store the lower triangle in banded format (if symmetric */
00134 /*                or lower triangular) */
00135 /*          store the upper triangle in banded format (if symmetric */
00136 /*                or upper triangular) */
00137 /*          store the entire matrix in banded format */
00138 /*       If Method B is chosen, and band format is specified, then the */
00139 /*          matrix will be generated in the band format, so no repacking */
00140 /*          will be necessary. */
00141 
00142 /*  Arguments */
00143 /*  ========= */
00144 
00145 /*  M      - INTEGER */
00146 /*           The number of rows of A. Not modified. */
00147 
00148 /*  N      - INTEGER */
00149 /*           The number of columns of A. Not modified. */
00150 
00151 /*  DIST   - CHARACTER*1 */
00152 /*           On entry, DIST specifies the type of distribution to be used */
00153 /*           to generate the random eigen-/singular values. */
00154 /*           'U' => UNIFORM( 0, 1 )  ( 'U' for uniform ) */
00155 /*           'S' => UNIFORM( -1, 1 ) ( 'S' for symmetric ) */
00156 /*           'N' => NORMAL( 0, 1 )   ( 'N' for normal ) */
00157 /*           Not modified. */
00158 
00159 /*  ISEED  - INTEGER array, dimension ( 4 ) */
00160 /*           On entry ISEED specifies the seed of the random number */
00161 /*           generator. They should lie between 0 and 4095 inclusive, */
00162 /*           and ISEED(4) should be odd. The random number generator */
00163 /*           uses a linear congruential sequence limited to small */
00164 /*           integers, and so should produce machine independent */
00165 /*           random numbers. The values of ISEED are changed on */
00166 /*           exit, and can be used in the next call to DLATMS */
00167 /*           to continue the same random number sequence. */
00168 /*           Changed on exit. */
00169 
00170 /*  SYM    - CHARACTER*1 */
00171 /*           If SYM='S' or 'H', the generated matrix is symmetric, with */
00172 /*             eigenvalues specified by D, COND, MODE, and DMAX; they */
00173 /*             may be positive, negative, or zero. */
00174 /*           If SYM='P', the generated matrix is symmetric, with */
00175 /*             eigenvalues (= singular values) specified by D, COND, */
00176 /*             MODE, and DMAX; they will not be negative. */
00177 /*           If SYM='N', the generated matrix is nonsymmetric, with */
00178 /*             singular values specified by D, COND, MODE, and DMAX; */
00179 /*             they will not be negative. */
00180 /*           Not modified. */
00181 
00182 /*  D      - DOUBLE PRECISION array, dimension ( MIN( M , N ) ) */
00183 /*           This array is used to specify the singular values or */
00184 /*           eigenvalues of A (see SYM, above.)  If MODE=0, then D is */
00185 /*           assumed to contain the singular/eigenvalues, otherwise */
00186 /*           they will be computed according to MODE, COND, and DMAX, */
00187 /*           and placed in D. */
00188 /*           Modified if MODE is nonzero. */
00189 
00190 /*  MODE   - INTEGER */
00191 /*           On entry this describes how the singular/eigenvalues are to */
00192 /*           be specified: */
00193 /*           MODE = 0 means use D as input */
00194 /*           MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND */
00195 /*           MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND */
00196 /*           MODE = 3 sets D(I)=COND**(-(I-1)/(N-1)) */
00197 /*           MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND) */
00198 /*           MODE = 5 sets D to random numbers in the range */
00199 /*                    ( 1/COND , 1 ) such that their logarithms */
00200 /*                    are uniformly distributed. */
00201 /*           MODE = 6 set D to random numbers from same distribution */
00202 /*                    as the rest of the matrix. */
00203 /*           MODE < 0 has the same meaning as ABS(MODE), except that */
00204 /*              the order of the elements of D is reversed. */
00205 /*           Thus if MODE is positive, D has entries ranging from */
00206 /*              1 to 1/COND, if negative, from 1/COND to 1, */
00207 /*           If SYM='S' or 'H', and MODE is neither 0, 6, nor -6, then */
00208 /*              the elements of D will also be multiplied by a random */
00209 /*              sign (i.e., +1 or -1.) */
00210 /*           Not modified. */
00211 
00212 /*  COND   - DOUBLE PRECISION */
00213 /*           On entry, this is used as described under MODE above. */
00214 /*           If used, it must be >= 1. Not modified. */
00215 
00216 /*  DMAX   - DOUBLE PRECISION */
00217 /*           If MODE is neither -6, 0 nor 6, the contents of D, as */
00218 /*           computed according to MODE and COND, will be scaled by */
00219 /*           DMAX / max(abs(D(i))); thus, the maximum absolute eigen- or */
00220 /*           singular value (which is to say the norm) will be abs(DMAX). */
00221 /*           Note that DMAX need not be positive: if DMAX is negative */
00222 /*           (or zero), D will be scaled by a negative number (or zero). */
00223 /*           Not modified. */
00224 
00225 /*  KL     - INTEGER */
00226 /*           This specifies the lower bandwidth of the  matrix. For */
00227 /*           example, KL=0 implies upper triangular, KL=1 implies upper */
00228 /*           Hessenberg, and KL being at least M-1 means that the matrix */
00229 /*           has full lower bandwidth.  KL must equal KU if the matrix */
00230 /*           is symmetric. */
00231 /*           Not modified. */
00232 
00233 /*  KU     - INTEGER */
00234 /*           This specifies the upper bandwidth of the  matrix. For */
00235 /*           example, KU=0 implies lower triangular, KU=1 implies lower */
00236 /*           Hessenberg, and KU being at least N-1 means that the matrix */
00237 /*           has full upper bandwidth.  KL must equal KU if the matrix */
00238 /*           is symmetric. */
00239 /*           Not modified. */
00240 
00241 /*  PACK   - CHARACTER*1 */
00242 /*           This specifies packing of matrix as follows: */
00243 /*           'N' => no packing */
00244 /*           'U' => zero out all subdiagonal entries (if symmetric) */
00245 /*           'L' => zero out all superdiagonal entries (if symmetric) */
00246 /*           'C' => store the upper triangle columnwise */
00247 /*                  (only if the matrix is symmetric or upper triangular) */
00248 /*           'R' => store the lower triangle columnwise */
00249 /*                  (only if the matrix is symmetric or lower triangular) */
00250 /*           'B' => store the lower triangle in band storage scheme */
00251 /*                  (only if matrix symmetric or lower triangular) */
00252 /*           'Q' => store the upper triangle in band storage scheme */
00253 /*                  (only if matrix symmetric or upper triangular) */
00254 /*           'Z' => store the entire matrix in band storage scheme */
00255 /*                      (pivoting can be provided for by using this */
00256 /*                      option to store A in the trailing rows of */
00257 /*                      the allocated storage) */
00258 
00259 /*           Using these options, the various LAPACK packed and banded */
00260 /*           storage schemes can be obtained: */
00261 /*           GB               - use 'Z' */
00262 /*           PB, SB or TB     - use 'B' or 'Q' */
00263 /*           PP, SP or TP     - use 'C' or 'R' */
00264 
00265 /*           If two calls to DLATMS differ only in the PACK parameter, */
00266 /*           they will generate mathematically equivalent matrices. */
00267 /*           Not modified. */
00268 
00269 /*  A      - DOUBLE PRECISION array, dimension ( LDA, N ) */
00270 /*           On exit A is the desired test matrix.  A is first generated */
00271 /*           in full (unpacked) form, and then packed, if so specified */
00272 /*           by PACK.  Thus, the first M elements of the first N */
00273 /*           columns will always be modified.  If PACK specifies a */
00274 /*           packed or banded storage scheme, all LDA elements of the */
00275 /*           first N columns will be modified; the elements of the */
00276 /*           array which do not correspond to elements of the generated */
00277 /*           matrix are set to zero. */
00278 /*           Modified. */
00279 
00280 /*  LDA    - INTEGER */
00281 /*           LDA specifies the first dimension of A as declared in the */
00282 /*           calling program.  If PACK='N', 'U', 'L', 'C', or 'R', then */
00283 /*           LDA must be at least M.  If PACK='B' or 'Q', then LDA must */
00284 /*           be at least MIN( KL, M-1) (which is equal to MIN(KU,N-1)). */
00285 /*           If PACK='Z', LDA must be large enough to hold the packed */
00286 /*           array: MIN( KU, N-1) + MIN( KL, M-1) + 1. */
00287 /*           Not modified. */
00288 
00289 /*  WORK   - DOUBLE PRECISION array, dimension ( 3*MAX( N , M ) ) */
00290 /*           Workspace. */
00291 /*           Modified. */
00292 
00293 /*  INFO   - INTEGER */
00294 /*           Error code.  On exit, INFO will be set to one of the */
00295 /*           following values: */
00296 /*             0 => normal return */
00297 /*            -1 => M negative or unequal to N and SYM='S', 'H', or 'P' */
00298 /*            -2 => N negative */
00299 /*            -3 => DIST illegal string */
00300 /*            -5 => SYM illegal string */
00301 /*            -7 => MODE not in range -6 to 6 */
00302 /*            -8 => COND less than 1.0, and MODE neither -6, 0 nor 6 */
00303 /*           -10 => KL negative */
00304 /*           -11 => KU negative, or SYM='S' or 'H' and KU not equal to KL */
00305 /*           -12 => PACK illegal string, or PACK='U' or 'L', and SYM='N'; */
00306 /*                  or PACK='C' or 'Q' and SYM='N' and KL is not zero; */
00307 /*                  or PACK='R' or 'B' and SYM='N' and KU is not zero; */
00308 /*                  or PACK='U', 'L', 'C', 'R', 'B', or 'Q', and M is not */
00309 /*                  N. */
00310 /*           -14 => LDA is less than M, or PACK='Z' and LDA is less than */
00311 /*                  MIN(KU,N-1) + MIN(KL,M-1) + 1. */
00312 /*            1  => Error return from DLATM1 */
00313 /*            2  => Cannot scale to DMAX (max. sing. value is 0) */
00314 /*            3  => Error return from DLAGGE or SLAGSY */
00315 
00316 /*  ===================================================================== */
00317 
00318 /*     .. Parameters .. */
00319 /*     .. */
00320 /*     .. Local Scalars .. */
00321 /*     .. */
00322 /*     .. External Functions .. */
00323 /*     .. */
00324 /*     .. External Subroutines .. */
00325 /*     .. */
00326 /*     .. Intrinsic Functions .. */
00327 /*     .. */
00328 /*     .. Executable Statements .. */
00329 
00330 /*     1)      Decode and Test the input parameters. */
00331 /*             Initialize flags & seed. */
00332 
00333     /* Parameter adjustments */
00334     --iseed;
00335     --d__;
00336     a_dim1 = *lda;
00337     a_offset = 1 + a_dim1;
00338     a -= a_offset;
00339     --work;
00340 
00341     /* Function Body */
00342     *info = 0;
00343 
00344 /*     Quick return if possible */
00345 
00346     if (*m == 0 || *n == 0) {
00347         return 0;
00348     }
00349 
00350 /*     Decode DIST */
00351 
00352     if (lsame_(dist, "U")) {
00353         idist = 1;
00354     } else if (lsame_(dist, "S")) {
00355         idist = 2;
00356     } else if (lsame_(dist, "N")) {
00357         idist = 3;
00358     } else {
00359         idist = -1;
00360     }
00361 
00362 /*     Decode SYM */
00363 
00364     if (lsame_(sym, "N")) {
00365         isym = 1;
00366         irsign = 0;
00367     } else if (lsame_(sym, "P")) {
00368         isym = 2;
00369         irsign = 0;
00370     } else if (lsame_(sym, "S")) {
00371         isym = 2;
00372         irsign = 1;
00373     } else if (lsame_(sym, "H")) {
00374         isym = 2;
00375         irsign = 1;
00376     } else {
00377         isym = -1;
00378     }
00379 
00380 /*     Decode PACK */
00381 
00382     isympk = 0;
00383     if (lsame_(pack, "N")) {
00384         ipack = 0;
00385     } else if (lsame_(pack, "U")) {
00386         ipack = 1;
00387         isympk = 1;
00388     } else if (lsame_(pack, "L")) {
00389         ipack = 2;
00390         isympk = 1;
00391     } else if (lsame_(pack, "C")) {
00392         ipack = 3;
00393         isympk = 2;
00394     } else if (lsame_(pack, "R")) {
00395         ipack = 4;
00396         isympk = 3;
00397     } else if (lsame_(pack, "B")) {
00398         ipack = 5;
00399         isympk = 3;
00400     } else if (lsame_(pack, "Q")) {
00401         ipack = 6;
00402         isympk = 2;
00403     } else if (lsame_(pack, "Z")) {
00404         ipack = 7;
00405     } else {
00406         ipack = -1;
00407     }
00408 
00409 /*     Set certain internal parameters */
00410 
00411     mnmin = min(*m,*n);
00412 /* Computing MIN */
00413     i__1 = *kl, i__2 = *m - 1;
00414     llb = min(i__1,i__2);
00415 /* Computing MIN */
00416     i__1 = *ku, i__2 = *n - 1;
00417     uub = min(i__1,i__2);
00418 /* Computing MIN */
00419     i__1 = *m, i__2 = *n + llb;
00420     mr = min(i__1,i__2);
00421 /* Computing MIN */
00422     i__1 = *n, i__2 = *m + uub;
00423     nc = min(i__1,i__2);
00424 
00425     if (ipack == 5 || ipack == 6) {
00426         minlda = uub + 1;
00427     } else if (ipack == 7) {
00428         minlda = llb + uub + 1;
00429     } else {
00430         minlda = *m;
00431     }
00432 
00433 /*     Use Givens rotation method if bandwidth small enough, */
00434 /*     or if LDA is too small to store the matrix unpacked. */
00435 
00436     givens = FALSE_;
00437     if (isym == 1) {
00438 /* Computing MAX */
00439         i__1 = 1, i__2 = mr + nc;
00440         if ((doublereal) (llb + uub) < (doublereal) max(i__1,i__2) * .3) {
00441             givens = TRUE_;
00442         }
00443     } else {
00444         if (llb << 1 < *m) {
00445             givens = TRUE_;
00446         }
00447     }
00448     if (*lda < *m && *lda >= minlda) {
00449         givens = TRUE_;
00450     }
00451 
00452 /*     Set INFO if an error */
00453 
00454     if (*m < 0) {
00455         *info = -1;
00456     } else if (*m != *n && isym != 1) {
00457         *info = -1;
00458     } else if (*n < 0) {
00459         *info = -2;
00460     } else if (idist == -1) {
00461         *info = -3;
00462     } else if (isym == -1) {
00463         *info = -5;
00464     } else if (abs(*mode) > 6) {
00465         *info = -7;
00466     } else if (*mode != 0 && abs(*mode) != 6 && *cond < 1.) {
00467         *info = -8;
00468     } else if (*kl < 0) {
00469         *info = -10;
00470     } else if (*ku < 0 || isym != 1 && *kl != *ku) {
00471         *info = -11;
00472     } else if (ipack == -1 || isympk == 1 && isym == 1 || isympk == 2 && isym 
00473             == 1 && *kl > 0 || isympk == 3 && isym == 1 && *ku > 0 || isympk 
00474             != 0 && *m != *n) {
00475         *info = -12;
00476     } else if (*lda < max(1,minlda)) {
00477         *info = -14;
00478     }
00479 
00480     if (*info != 0) {
00481         i__1 = -(*info);
00482         xerbla_("DLATMS", &i__1);
00483         return 0;
00484     }
00485 
00486 /*     Initialize random number generator */
00487 
00488     for (i__ = 1; i__ <= 4; ++i__) {
00489         iseed[i__] = (i__1 = iseed[i__], abs(i__1)) % 4096;
00490 /* L10: */
00491     }
00492 
00493     if (iseed[4] % 2 != 1) {
00494         ++iseed[4];
00495     }
00496 
00497 /*     2)      Set up D  if indicated. */
00498 
00499 /*             Compute D according to COND and MODE */
00500 
00501     dlatm1_(mode, cond, &irsign, &idist, &iseed[1], &d__[1], &mnmin, &iinfo);
00502     if (iinfo != 0) {
00503         *info = 1;
00504         return 0;
00505     }
00506 
00507 /*     Choose Top-Down if D is (apparently) increasing, */
00508 /*     Bottom-Up if D is (apparently) decreasing. */
00509 
00510     if (abs(d__[1]) <= (d__1 = d__[mnmin], abs(d__1))) {
00511         topdwn = TRUE_;
00512     } else {
00513         topdwn = FALSE_;
00514     }
00515 
00516     if (*mode != 0 && abs(*mode) != 6) {
00517 
00518 /*        Scale by DMAX */
00519 
00520         temp = abs(d__[1]);
00521         i__1 = mnmin;
00522         for (i__ = 2; i__ <= i__1; ++i__) {
00523 /* Computing MAX */
00524             d__2 = temp, d__3 = (d__1 = d__[i__], abs(d__1));
00525             temp = max(d__2,d__3);
00526 /* L20: */
00527         }
00528 
00529         if (temp > 0.) {
00530             alpha = *dmax__ / temp;
00531         } else {
00532             *info = 2;
00533             return 0;
00534         }
00535 
00536         dscal_(&mnmin, &alpha, &d__[1], &c__1);
00537 
00538     }
00539 
00540 /*     3)      Generate Banded Matrix using Givens rotations. */
00541 /*             Also the special case of UUB=LLB=0 */
00542 
00543 /*               Compute Addressing constants to cover all */
00544 /*               storage formats.  Whether GE, SY, GB, or SB, */
00545 /*               upper or lower triangle or both, */
00546 /*               the (i,j)-th element is in */
00547 /*               A( i - ISKEW*j + IOFFST, j ) */
00548 
00549     if (ipack > 4) {
00550         ilda = *lda - 1;
00551         iskew = 1;
00552         if (ipack > 5) {
00553             ioffst = uub + 1;
00554         } else {
00555             ioffst = 1;
00556         }
00557     } else {
00558         ilda = *lda;
00559         iskew = 0;
00560         ioffst = 0;
00561     }
00562 
00563 /*     IPACKG is the format that the matrix is generated in. If this is */
00564 /*     different from IPACK, then the matrix must be repacked at the */
00565 /*     end.  It also signals how to compute the norm, for scaling. */
00566 
00567     ipackg = 0;
00568     dlaset_("Full", lda, n, &c_b22, &c_b22, &a[a_offset], lda);
00569 
00570 /*     Diagonal Matrix -- We are done, unless it */
00571 /*     is to be stored SP/PP/TP (PACK='R' or 'C') */
00572 
00573     if (llb == 0 && uub == 0) {
00574         i__1 = ilda + 1;
00575         dcopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffst + a_dim1], &i__1)
00576                 ;
00577         if (ipack <= 2 || ipack >= 5) {
00578             ipackg = ipack;
00579         }
00580 
00581     } else if (givens) {
00582 
00583 /*        Check whether to use Givens rotations, */
00584 /*        Householder transformations, or nothing. */
00585 
00586         if (isym == 1) {
00587 
00588 /*           Non-symmetric -- A = U D V */
00589 
00590             if (ipack > 4) {
00591                 ipackg = ipack;
00592             } else {
00593                 ipackg = 0;
00594             }
00595 
00596             i__1 = ilda + 1;
00597             dcopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffst + a_dim1], &
00598                     i__1);
00599 
00600             if (topdwn) {
00601                 jkl = 0;
00602                 i__1 = uub;
00603                 for (jku = 1; jku <= i__1; ++jku) {
00604 
00605 /*                 Transform from bandwidth JKL, JKU-1 to JKL, JKU */
00606 
00607 /*                 Last row actually rotated is M */
00608 /*                 Last column actually rotated is MIN( M+JKU, N ) */
00609 
00610 /* Computing MIN */
00611                     i__3 = *m + jku;
00612                     i__2 = min(i__3,*n) + jkl - 1;
00613                     for (jr = 1; jr <= i__2; ++jr) {
00614                         extra = 0.;
00615                         angle = dlarnd_(&c__1, &iseed[1]) * 
00616                                 6.2831853071795864769252867663;
00617                         c__ = cos(angle);
00618                         s = sin(angle);
00619 /* Computing MAX */
00620                         i__3 = 1, i__4 = jr - jkl;
00621                         icol = max(i__3,i__4);
00622                         if (jr < *m) {
00623 /* Computing MIN */
00624                             i__3 = *n, i__4 = jr + jku;
00625                             il = min(i__3,i__4) + 1 - icol;
00626                             L__1 = jr > jkl;
00627                             dlarot_(&c_true, &L__1, &c_false, &il, &c__, &s, &
00628                                     a[jr - iskew * icol + ioffst + icol * 
00629                                     a_dim1], &ilda, &extra, &dummy);
00630                         }
00631 
00632 /*                    Chase "EXTRA" back up */
00633 
00634                         ir = jr;
00635                         ic = icol;
00636                         i__3 = -jkl - jku;
00637                         for (jch = jr - jkl; i__3 < 0 ? jch >= 1 : jch <= 1; 
00638                                 jch += i__3) {
00639                             if (ir < *m) {
00640                                 dlartg_(&a[ir + 1 - iskew * (ic + 1) + ioffst 
00641                                         + (ic + 1) * a_dim1], &extra, &c__, &
00642                                         s, &dummy);
00643                             }
00644 /* Computing MAX */
00645                             i__4 = 1, i__5 = jch - jku;
00646                             irow = max(i__4,i__5);
00647                             il = ir + 2 - irow;
00648                             temp = 0.;
00649                             iltemp = jch > jku;
00650                             d__1 = -s;
00651                             dlarot_(&c_false, &iltemp, &c_true, &il, &c__, &
00652                                     d__1, &a[irow - iskew * ic + ioffst + ic *
00653                                      a_dim1], &ilda, &temp, &extra);
00654                             if (iltemp) {
00655                                 dlartg_(&a[irow + 1 - iskew * (ic + 1) + 
00656                                         ioffst + (ic + 1) * a_dim1], &temp, &
00657                                         c__, &s, &dummy);
00658 /* Computing MAX */
00659                                 i__4 = 1, i__5 = jch - jku - jkl;
00660                                 icol = max(i__4,i__5);
00661                                 il = ic + 2 - icol;
00662                                 extra = 0.;
00663                                 L__1 = jch > jku + jkl;
00664                                 d__1 = -s;
00665                                 dlarot_(&c_true, &L__1, &c_true, &il, &c__, &
00666                                         d__1, &a[irow - iskew * icol + ioffst 
00667                                         + icol * a_dim1], &ilda, &extra, &
00668                                         temp);
00669                                 ic = icol;
00670                                 ir = irow;
00671                             }
00672 /* L30: */
00673                         }
00674 /* L40: */
00675                     }
00676 /* L50: */
00677                 }
00678 
00679                 jku = uub;
00680                 i__1 = llb;
00681                 for (jkl = 1; jkl <= i__1; ++jkl) {
00682 
00683 /*                 Transform from bandwidth JKL-1, JKU to JKL, JKU */
00684 
00685 /* Computing MIN */
00686                     i__3 = *n + jkl;
00687                     i__2 = min(i__3,*m) + jku - 1;
00688                     for (jc = 1; jc <= i__2; ++jc) {
00689                         extra = 0.;
00690                         angle = dlarnd_(&c__1, &iseed[1]) * 
00691                                 6.2831853071795864769252867663;
00692                         c__ = cos(angle);
00693                         s = sin(angle);
00694 /* Computing MAX */
00695                         i__3 = 1, i__4 = jc - jku;
00696                         irow = max(i__3,i__4);
00697                         if (jc < *n) {
00698 /* Computing MIN */
00699                             i__3 = *m, i__4 = jc + jkl;
00700                             il = min(i__3,i__4) + 1 - irow;
00701                             L__1 = jc > jku;
00702                             dlarot_(&c_false, &L__1, &c_false, &il, &c__, &s, 
00703                                     &a[irow - iskew * jc + ioffst + jc * 
00704                                     a_dim1], &ilda, &extra, &dummy);
00705                         }
00706 
00707 /*                    Chase "EXTRA" back up */
00708 
00709                         ic = jc;
00710                         ir = irow;
00711                         i__3 = -jkl - jku;
00712                         for (jch = jc - jku; i__3 < 0 ? jch >= 1 : jch <= 1; 
00713                                 jch += i__3) {
00714                             if (ic < *n) {
00715                                 dlartg_(&a[ir + 1 - iskew * (ic + 1) + ioffst 
00716                                         + (ic + 1) * a_dim1], &extra, &c__, &
00717                                         s, &dummy);
00718                             }
00719 /* Computing MAX */
00720                             i__4 = 1, i__5 = jch - jkl;
00721                             icol = max(i__4,i__5);
00722                             il = ic + 2 - icol;
00723                             temp = 0.;
00724                             iltemp = jch > jkl;
00725                             d__1 = -s;
00726                             dlarot_(&c_true, &iltemp, &c_true, &il, &c__, &
00727                                     d__1, &a[ir - iskew * icol + ioffst + 
00728                                     icol * a_dim1], &ilda, &temp, &extra);
00729                             if (iltemp) {
00730                                 dlartg_(&a[ir + 1 - iskew * (icol + 1) + 
00731                                         ioffst + (icol + 1) * a_dim1], &temp, 
00732                                         &c__, &s, &dummy);
00733 /* Computing MAX */
00734                                 i__4 = 1, i__5 = jch - jkl - jku;
00735                                 irow = max(i__4,i__5);
00736                                 il = ir + 2 - irow;
00737                                 extra = 0.;
00738                                 L__1 = jch > jkl + jku;
00739                                 d__1 = -s;
00740                                 dlarot_(&c_false, &L__1, &c_true, &il, &c__, &
00741                                         d__1, &a[irow - iskew * icol + ioffst 
00742                                         + icol * a_dim1], &ilda, &extra, &
00743                                         temp);
00744                                 ic = icol;
00745                                 ir = irow;
00746                             }
00747 /* L60: */
00748                         }
00749 /* L70: */
00750                     }
00751 /* L80: */
00752                 }
00753 
00754             } else {
00755 
00756 /*              Bottom-Up -- Start at the bottom right. */
00757 
00758                 jkl = 0;
00759                 i__1 = uub;
00760                 for (jku = 1; jku <= i__1; ++jku) {
00761 
00762 /*                 Transform from bandwidth JKL, JKU-1 to JKL, JKU */
00763 
00764 /*                 First row actually rotated is M */
00765 /*                 First column actually rotated is MIN( M+JKU, N ) */
00766 
00767 /* Computing MIN */
00768                     i__2 = *m, i__3 = *n + jkl;
00769                     iendch = min(i__2,i__3) - 1;
00770 /* Computing MIN */
00771                     i__2 = *m + jku;
00772                     i__3 = 1 - jkl;
00773                     for (jc = min(i__2,*n) - 1; jc >= i__3; --jc) {
00774                         extra = 0.;
00775                         angle = dlarnd_(&c__1, &iseed[1]) * 
00776                                 6.2831853071795864769252867663;
00777                         c__ = cos(angle);
00778                         s = sin(angle);
00779 /* Computing MAX */
00780                         i__2 = 1, i__4 = jc - jku + 1;
00781                         irow = max(i__2,i__4);
00782                         if (jc > 0) {
00783 /* Computing MIN */
00784                             i__2 = *m, i__4 = jc + jkl + 1;
00785                             il = min(i__2,i__4) + 1 - irow;
00786                             L__1 = jc + jkl < *m;
00787                             dlarot_(&c_false, &c_false, &L__1, &il, &c__, &s, 
00788                                     &a[irow - iskew * jc + ioffst + jc * 
00789                                     a_dim1], &ilda, &dummy, &extra);
00790                         }
00791 
00792 /*                    Chase "EXTRA" back down */
00793 
00794                         ic = jc;
00795                         i__2 = iendch;
00796                         i__4 = jkl + jku;
00797                         for (jch = jc + jkl; i__4 < 0 ? jch >= i__2 : jch <= 
00798                                 i__2; jch += i__4) {
00799                             ilextr = ic > 0;
00800                             if (ilextr) {
00801                                 dlartg_(&a[jch - iskew * ic + ioffst + ic * 
00802                                         a_dim1], &extra, &c__, &s, &dummy);
00803                             }
00804                             ic = max(1,ic);
00805 /* Computing MIN */
00806                             i__5 = *n - 1, i__6 = jch + jku;
00807                             icol = min(i__5,i__6);
00808                             iltemp = jch + jku < *n;
00809                             temp = 0.;
00810                             i__5 = icol + 2 - ic;
00811                             dlarot_(&c_true, &ilextr, &iltemp, &i__5, &c__, &
00812                                     s, &a[jch - iskew * ic + ioffst + ic * 
00813                                     a_dim1], &ilda, &extra, &temp);
00814                             if (iltemp) {
00815                                 dlartg_(&a[jch - iskew * icol + ioffst + icol 
00816                                         * a_dim1], &temp, &c__, &s, &dummy);
00817 /* Computing MIN */
00818                                 i__5 = iendch, i__6 = jch + jkl + jku;
00819                                 il = min(i__5,i__6) + 2 - jch;
00820                                 extra = 0.;
00821                                 L__1 = jch + jkl + jku <= iendch;
00822                                 dlarot_(&c_false, &c_true, &L__1, &il, &c__, &
00823                                         s, &a[jch - iskew * icol + ioffst + 
00824                                         icol * a_dim1], &ilda, &temp, &extra);
00825                                 ic = icol;
00826                             }
00827 /* L90: */
00828                         }
00829 /* L100: */
00830                     }
00831 /* L110: */
00832                 }
00833 
00834                 jku = uub;
00835                 i__1 = llb;
00836                 for (jkl = 1; jkl <= i__1; ++jkl) {
00837 
00838 /*                 Transform from bandwidth JKL-1, JKU to JKL, JKU */
00839 
00840 /*                 First row actually rotated is MIN( N+JKL, M ) */
00841 /*                 First column actually rotated is N */
00842 
00843 /* Computing MIN */
00844                     i__3 = *n, i__4 = *m + jku;
00845                     iendch = min(i__3,i__4) - 1;
00846 /* Computing MIN */
00847                     i__3 = *n + jkl;
00848                     i__4 = 1 - jku;
00849                     for (jr = min(i__3,*m) - 1; jr >= i__4; --jr) {
00850                         extra = 0.;
00851                         angle = dlarnd_(&c__1, &iseed[1]) * 
00852                                 6.2831853071795864769252867663;
00853                         c__ = cos(angle);
00854                         s = sin(angle);
00855 /* Computing MAX */
00856                         i__3 = 1, i__2 = jr - jkl + 1;
00857                         icol = max(i__3,i__2);
00858                         if (jr > 0) {
00859 /* Computing MIN */
00860                             i__3 = *n, i__2 = jr + jku + 1;
00861                             il = min(i__3,i__2) + 1 - icol;
00862                             L__1 = jr + jku < *n;
00863                             dlarot_(&c_true, &c_false, &L__1, &il, &c__, &s, &
00864                                     a[jr - iskew * icol + ioffst + icol * 
00865                                     a_dim1], &ilda, &dummy, &extra);
00866                         }
00867 
00868 /*                    Chase "EXTRA" back down */
00869 
00870                         ir = jr;
00871                         i__3 = iendch;
00872                         i__2 = jkl + jku;
00873                         for (jch = jr + jku; i__2 < 0 ? jch >= i__3 : jch <= 
00874                                 i__3; jch += i__2) {
00875                             ilextr = ir > 0;
00876                             if (ilextr) {
00877                                 dlartg_(&a[ir - iskew * jch + ioffst + jch * 
00878                                         a_dim1], &extra, &c__, &s, &dummy);
00879                             }
00880                             ir = max(1,ir);
00881 /* Computing MIN */
00882                             i__5 = *m - 1, i__6 = jch + jkl;
00883                             irow = min(i__5,i__6);
00884                             iltemp = jch + jkl < *m;
00885                             temp = 0.;
00886                             i__5 = irow + 2 - ir;
00887                             dlarot_(&c_false, &ilextr, &iltemp, &i__5, &c__, &
00888                                     s, &a[ir - iskew * jch + ioffst + jch * 
00889                                     a_dim1], &ilda, &extra, &temp);
00890                             if (iltemp) {
00891                                 dlartg_(&a[irow - iskew * jch + ioffst + jch *
00892                                          a_dim1], &temp, &c__, &s, &dummy);
00893 /* Computing MIN */
00894                                 i__5 = iendch, i__6 = jch + jkl + jku;
00895                                 il = min(i__5,i__6) + 2 - jch;
00896                                 extra = 0.;
00897                                 L__1 = jch + jkl + jku <= iendch;
00898                                 dlarot_(&c_true, &c_true, &L__1, &il, &c__, &
00899                                         s, &a[irow - iskew * jch + ioffst + 
00900                                         jch * a_dim1], &ilda, &temp, &extra);
00901                                 ir = irow;
00902                             }
00903 /* L120: */
00904                         }
00905 /* L130: */
00906                     }
00907 /* L140: */
00908                 }
00909             }
00910 
00911         } else {
00912 
00913 /*           Symmetric -- A = U D U' */
00914 
00915             ipackg = ipack;
00916             ioffg = ioffst;
00917 
00918             if (topdwn) {
00919 
00920 /*              Top-Down -- Generate Upper triangle only */
00921 
00922                 if (ipack >= 5) {
00923                     ipackg = 6;
00924                     ioffg = uub + 1;
00925                 } else {
00926                     ipackg = 1;
00927                 }
00928                 i__1 = ilda + 1;
00929                 dcopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffg + a_dim1], 
00930                          &i__1);
00931 
00932                 i__1 = uub;
00933                 for (k = 1; k <= i__1; ++k) {
00934                     i__4 = *n - 1;
00935                     for (jc = 1; jc <= i__4; ++jc) {
00936 /* Computing MAX */
00937                         i__2 = 1, i__3 = jc - k;
00938                         irow = max(i__2,i__3);
00939 /* Computing MIN */
00940                         i__2 = jc + 1, i__3 = k + 2;
00941                         il = min(i__2,i__3);
00942                         extra = 0.;
00943                         temp = a[jc - iskew * (jc + 1) + ioffg + (jc + 1) * 
00944                                 a_dim1];
00945                         angle = dlarnd_(&c__1, &iseed[1]) * 
00946                                 6.2831853071795864769252867663;
00947                         c__ = cos(angle);
00948                         s = sin(angle);
00949                         L__1 = jc > k;
00950                         dlarot_(&c_false, &L__1, &c_true, &il, &c__, &s, &a[
00951                                 irow - iskew * jc + ioffg + jc * a_dim1], &
00952                                 ilda, &extra, &temp);
00953 /* Computing MIN */
00954                         i__3 = k, i__5 = *n - jc;
00955                         i__2 = min(i__3,i__5) + 1;
00956                         dlarot_(&c_true, &c_true, &c_false, &i__2, &c__, &s, &
00957                                 a[(1 - iskew) * jc + ioffg + jc * a_dim1], &
00958                                 ilda, &temp, &dummy);
00959 
00960 /*                    Chase EXTRA back up the matrix */
00961 
00962                         icol = jc;
00963                         i__2 = -k;
00964                         for (jch = jc - k; i__2 < 0 ? jch >= 1 : jch <= 1; 
00965                                 jch += i__2) {
00966                             dlartg_(&a[jch + 1 - iskew * (icol + 1) + ioffg + 
00967                                     (icol + 1) * a_dim1], &extra, &c__, &s, &
00968                                     dummy);
00969                             temp = a[jch - iskew * (jch + 1) + ioffg + (jch + 
00970                                     1) * a_dim1];
00971                             i__3 = k + 2;
00972                             d__1 = -s;
00973                             dlarot_(&c_true, &c_true, &c_true, &i__3, &c__, &
00974                                     d__1, &a[(1 - iskew) * jch + ioffg + jch *
00975                                      a_dim1], &ilda, &temp, &extra);
00976 /* Computing MAX */
00977                             i__3 = 1, i__5 = jch - k;
00978                             irow = max(i__3,i__5);
00979 /* Computing MIN */
00980                             i__3 = jch + 1, i__5 = k + 2;
00981                             il = min(i__3,i__5);
00982                             extra = 0.;
00983                             L__1 = jch > k;
00984                             d__1 = -s;
00985                             dlarot_(&c_false, &L__1, &c_true, &il, &c__, &
00986                                     d__1, &a[irow - iskew * jch + ioffg + jch 
00987                                     * a_dim1], &ilda, &extra, &temp);
00988                             icol = jch;
00989 /* L150: */
00990                         }
00991 /* L160: */
00992                     }
00993 /* L170: */
00994                 }
00995 
00996 /*              If we need lower triangle, copy from upper. Note that */
00997 /*              the order of copying is chosen to work for 'q' -> 'b' */
00998 
00999                 if (ipack != ipackg && ipack != 3) {
01000                     i__1 = *n;
01001                     for (jc = 1; jc <= i__1; ++jc) {
01002                         irow = ioffst - iskew * jc;
01003 /* Computing MIN */
01004                         i__2 = *n, i__3 = jc + uub;
01005                         i__4 = min(i__2,i__3);
01006                         for (jr = jc; jr <= i__4; ++jr) {
01007                             a[jr + irow + jc * a_dim1] = a[jc - iskew * jr + 
01008                                     ioffg + jr * a_dim1];
01009 /* L180: */
01010                         }
01011 /* L190: */
01012                     }
01013                     if (ipack == 5) {
01014                         i__1 = *n;
01015                         for (jc = *n - uub + 1; jc <= i__1; ++jc) {
01016                             i__4 = uub + 1;
01017                             for (jr = *n + 2 - jc; jr <= i__4; ++jr) {
01018                                 a[jr + jc * a_dim1] = 0.;
01019 /* L200: */
01020                             }
01021 /* L210: */
01022                         }
01023                     }
01024                     if (ipackg == 6) {
01025                         ipackg = ipack;
01026                     } else {
01027                         ipackg = 0;
01028                     }
01029                 }
01030             } else {
01031 
01032 /*              Bottom-Up -- Generate Lower triangle only */
01033 
01034                 if (ipack >= 5) {
01035                     ipackg = 5;
01036                     if (ipack == 6) {
01037                         ioffg = 1;
01038                     }
01039                 } else {
01040                     ipackg = 2;
01041                 }
01042                 i__1 = ilda + 1;
01043                 dcopy_(&mnmin, &d__[1], &c__1, &a[1 - iskew + ioffg + a_dim1], 
01044                          &i__1);
01045 
01046                 i__1 = uub;
01047                 for (k = 1; k <= i__1; ++k) {
01048                     for (jc = *n - 1; jc >= 1; --jc) {
01049 /* Computing MIN */
01050                         i__4 = *n + 1 - jc, i__2 = k + 2;
01051                         il = min(i__4,i__2);
01052                         extra = 0.;
01053                         temp = a[(1 - iskew) * jc + 1 + ioffg + jc * a_dim1];
01054                         angle = dlarnd_(&c__1, &iseed[1]) * 
01055                                 6.2831853071795864769252867663;
01056                         c__ = cos(angle);
01057                         s = -sin(angle);
01058                         L__1 = *n - jc > k;
01059                         dlarot_(&c_false, &c_true, &L__1, &il, &c__, &s, &a[(
01060                                 1 - iskew) * jc + ioffg + jc * a_dim1], &ilda, 
01061                                  &temp, &extra);
01062 /* Computing MAX */
01063                         i__4 = 1, i__2 = jc - k + 1;
01064                         icol = max(i__4,i__2);
01065                         i__4 = jc + 2 - icol;
01066                         dlarot_(&c_true, &c_false, &c_true, &i__4, &c__, &s, &
01067                                 a[jc - iskew * icol + ioffg + icol * a_dim1], 
01068                                 &ilda, &dummy, &temp);
01069 
01070 /*                    Chase EXTRA back down the matrix */
01071 
01072                         icol = jc;
01073                         i__4 = *n - 1;
01074                         i__2 = k;
01075                         for (jch = jc + k; i__2 < 0 ? jch >= i__4 : jch <= 
01076                                 i__4; jch += i__2) {
01077                             dlartg_(&a[jch - iskew * icol + ioffg + icol * 
01078                                     a_dim1], &extra, &c__, &s, &dummy);
01079                             temp = a[(1 - iskew) * jch + 1 + ioffg + jch * 
01080                                     a_dim1];
01081                             i__3 = k + 2;
01082                             dlarot_(&c_true, &c_true, &c_true, &i__3, &c__, &
01083                                     s, &a[jch - iskew * icol + ioffg + icol * 
01084                                     a_dim1], &ilda, &extra, &temp);
01085 /* Computing MIN */
01086                             i__3 = *n + 1 - jch, i__5 = k + 2;
01087                             il = min(i__3,i__5);
01088                             extra = 0.;
01089                             L__1 = *n - jch > k;
01090                             dlarot_(&c_false, &c_true, &L__1, &il, &c__, &s, &
01091                                     a[(1 - iskew) * jch + ioffg + jch * 
01092                                     a_dim1], &ilda, &temp, &extra);
01093                             icol = jch;
01094 /* L220: */
01095                         }
01096 /* L230: */
01097                     }
01098 /* L240: */
01099                 }
01100 
01101 /*              If we need upper triangle, copy from lower. Note that */
01102 /*              the order of copying is chosen to work for 'b' -> 'q' */
01103 
01104                 if (ipack != ipackg && ipack != 4) {
01105                     for (jc = *n; jc >= 1; --jc) {
01106                         irow = ioffst - iskew * jc;
01107 /* Computing MAX */
01108                         i__2 = 1, i__4 = jc - uub;
01109                         i__1 = max(i__2,i__4);
01110                         for (jr = jc; jr >= i__1; --jr) {
01111                             a[jr + irow + jc * a_dim1] = a[jc - iskew * jr + 
01112                                     ioffg + jr * a_dim1];
01113 /* L250: */
01114                         }
01115 /* L260: */
01116                     }
01117                     if (ipack == 6) {
01118                         i__1 = uub;
01119                         for (jc = 1; jc <= i__1; ++jc) {
01120                             i__2 = uub + 1 - jc;
01121                             for (jr = 1; jr <= i__2; ++jr) {
01122                                 a[jr + jc * a_dim1] = 0.;
01123 /* L270: */
01124                             }
01125 /* L280: */
01126                         }
01127                     }
01128                     if (ipackg == 5) {
01129                         ipackg = ipack;
01130                     } else {
01131                         ipackg = 0;
01132                     }
01133                 }
01134             }
01135         }
01136 
01137     } else {
01138 
01139 /*        4)      Generate Banded Matrix by first */
01140 /*                Rotating by random Unitary matrices, */
01141 /*                then reducing the bandwidth using Householder */
01142 /*                transformations. */
01143 
01144 /*                Note: we should get here only if LDA .ge. N */
01145 
01146         if (isym == 1) {
01147 
01148 /*           Non-symmetric -- A = U D V */
01149 
01150             dlagge_(&mr, &nc, &llb, &uub, &d__[1], &a[a_offset], lda, &iseed[
01151                     1], &work[1], &iinfo);
01152         } else {
01153 
01154 /*           Symmetric -- A = U D U' */
01155 
01156             dlagsy_(m, &llb, &d__[1], &a[a_offset], lda, &iseed[1], &work[1], 
01157                     &iinfo);
01158 
01159         }
01160         if (iinfo != 0) {
01161             *info = 3;
01162             return 0;
01163         }
01164     }
01165 
01166 /*     5)      Pack the matrix */
01167 
01168     if (ipack != ipackg) {
01169         if (ipack == 1) {
01170 
01171 /*           'U' -- Upper triangular, not packed */
01172 
01173             i__1 = *m;
01174             for (j = 1; j <= i__1; ++j) {
01175                 i__2 = *m;
01176                 for (i__ = j + 1; i__ <= i__2; ++i__) {
01177                     a[i__ + j * a_dim1] = 0.;
01178 /* L290: */
01179                 }
01180 /* L300: */
01181             }
01182 
01183         } else if (ipack == 2) {
01184 
01185 /*           'L' -- Lower triangular, not packed */
01186 
01187             i__1 = *m;
01188             for (j = 2; j <= i__1; ++j) {
01189                 i__2 = j - 1;
01190                 for (i__ = 1; i__ <= i__2; ++i__) {
01191                     a[i__ + j * a_dim1] = 0.;
01192 /* L310: */
01193                 }
01194 /* L320: */
01195             }
01196 
01197         } else if (ipack == 3) {
01198 
01199 /*           'C' -- Upper triangle packed Columnwise. */
01200 
01201             icol = 1;
01202             irow = 0;
01203             i__1 = *m;
01204             for (j = 1; j <= i__1; ++j) {
01205                 i__2 = j;
01206                 for (i__ = 1; i__ <= i__2; ++i__) {
01207                     ++irow;
01208                     if (irow > *lda) {
01209                         irow = 1;
01210                         ++icol;
01211                     }
01212                     a[irow + icol * a_dim1] = a[i__ + j * a_dim1];
01213 /* L330: */
01214                 }
01215 /* L340: */
01216             }
01217 
01218         } else if (ipack == 4) {
01219 
01220 /*           'R' -- Lower triangle packed Columnwise. */
01221 
01222             icol = 1;
01223             irow = 0;
01224             i__1 = *m;
01225             for (j = 1; j <= i__1; ++j) {
01226                 i__2 = *m;
01227                 for (i__ = j; i__ <= i__2; ++i__) {
01228                     ++irow;
01229                     if (irow > *lda) {
01230                         irow = 1;
01231                         ++icol;
01232                     }
01233                     a[irow + icol * a_dim1] = a[i__ + j * a_dim1];
01234 /* L350: */
01235                 }
01236 /* L360: */
01237             }
01238 
01239         } else if (ipack >= 5) {
01240 
01241 /*           'B' -- The lower triangle is packed as a band matrix. */
01242 /*           'Q' -- The upper triangle is packed as a band matrix. */
01243 /*           'Z' -- The whole matrix is packed as a band matrix. */
01244 
01245             if (ipack == 5) {
01246                 uub = 0;
01247             }
01248             if (ipack == 6) {
01249                 llb = 0;
01250             }
01251 
01252             i__1 = uub;
01253             for (j = 1; j <= i__1; ++j) {
01254 /* Computing MIN */
01255                 i__2 = j + llb;
01256                 for (i__ = min(i__2,*m); i__ >= 1; --i__) {
01257                     a[i__ - j + uub + 1 + j * a_dim1] = a[i__ + j * a_dim1];
01258 /* L370: */
01259                 }
01260 /* L380: */
01261             }
01262 
01263             i__1 = *n;
01264             for (j = uub + 2; j <= i__1; ++j) {
01265 /* Computing MIN */
01266                 i__4 = j + llb;
01267                 i__2 = min(i__4,*m);
01268                 for (i__ = j - uub; i__ <= i__2; ++i__) {
01269                     a[i__ - j + uub + 1 + j * a_dim1] = a[i__ + j * a_dim1];
01270 /* L390: */
01271                 }
01272 /* L400: */
01273             }
01274         }
01275 
01276 /*        If packed, zero out extraneous elements. */
01277 
01278 /*        Symmetric/Triangular Packed -- */
01279 /*        zero out everything after A(IROW,ICOL) */
01280 
01281         if (ipack == 3 || ipack == 4) {
01282             i__1 = *m;
01283             for (jc = icol; jc <= i__1; ++jc) {
01284                 i__2 = *lda;
01285                 for (jr = irow + 1; jr <= i__2; ++jr) {
01286                     a[jr + jc * a_dim1] = 0.;
01287 /* L410: */
01288                 }
01289                 irow = 0;
01290 /* L420: */
01291             }
01292 
01293         } else if (ipack >= 5) {
01294 
01295 /*           Packed Band -- */
01296 /*              1st row is now in A( UUB+2-j, j), zero above it */
01297 /*              m-th row is now in A( M+UUB-j,j), zero below it */
01298 /*              last non-zero diagonal is now in A( UUB+LLB+1,j ), */
01299 /*                 zero below it, too. */
01300 
01301             ir1 = uub + llb + 2;
01302             ir2 = uub + *m + 2;
01303             i__1 = *n;
01304             for (jc = 1; jc <= i__1; ++jc) {
01305                 i__2 = uub + 1 - jc;
01306                 for (jr = 1; jr <= i__2; ++jr) {
01307                     a[jr + jc * a_dim1] = 0.;
01308 /* L430: */
01309                 }
01310 /* Computing MAX */
01311 /* Computing MIN */
01312                 i__3 = ir1, i__5 = ir2 - jc;
01313                 i__2 = 1, i__4 = min(i__3,i__5);
01314                 i__6 = *lda;
01315                 for (jr = max(i__2,i__4); jr <= i__6; ++jr) {
01316                     a[jr + jc * a_dim1] = 0.;
01317 /* L440: */
01318                 }
01319 /* L450: */
01320             }
01321         }
01322     }
01323 
01324     return 0;
01325 
01326 /*     End of DLATMS */
01327 
01328 } /* dlatms_ */


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