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


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