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


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