slatmr.c
Go to the documentation of this file.
00001 /* slatmr.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__0 = 0;
00019 static integer c__1 = 1;
00020 
00021 /* Subroutine */ int slatmr_(integer *m, integer *n, char *dist, integer *
00022         iseed, char *sym, real *d__, integer *mode, real *cond, real *dmax__, 
00023         char *rsign, char *grade, real *dl, integer *model, real *condl, real 
00024         *dr, integer *moder, real *condr, char *pivtng, integer *ipivot, 
00025         integer *kl, integer *ku, real *sparse, real *anorm, char *pack, real 
00026         *a, integer *lda, integer *iwork, integer *info)
00027 {
00028     /* System generated locals */
00029     integer a_dim1, a_offset, i__1, i__2;
00030     real r__1, r__2, r__3;
00031 
00032     /* Local variables */
00033     integer i__, j, k, kll, kuu, isub, jsub;
00034     real temp;
00035     integer isym;
00036     real alpha;
00037     integer ipack;
00038     extern logical lsame_(char *, char *);
00039     real tempa[1];
00040     extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *);
00041     integer iisub, idist, jjsub, mnmin;
00042     logical dzero;
00043     integer mnsub;
00044     real onorm;
00045     integer mxsub, npvts;
00046     extern /* Subroutine */ int slatm1_(integer *, real *, integer *, integer 
00047             *, integer *, real *, integer *, integer *);
00048     extern doublereal slatm2_(integer *, integer *, integer *, integer *, 
00049             integer *, integer *, integer *, integer *, real *, integer *, 
00050             real *, real *, integer *, integer *, real *), slatm3_(integer *, 
00051             integer *, integer *, integer *, integer *, integer *, integer *, 
00052             integer *, integer *, integer *, real *, integer *, real *, real *
00053 , integer *, integer *, real *);
00054     integer igrade;
00055     extern doublereal slangb_(char *, integer *, integer *, integer *, real *, 
00056              integer *, real *), slange_(char *, integer *, integer *, 
00057              real *, integer *, real *);
00058     logical fulbnd;
00059     extern /* Subroutine */ int xerbla_(char *, integer *);
00060     logical badpvt;
00061     extern doublereal slansb_(char *, char *, integer *, integer *, real *, 
00062             integer *, real *);
00063     integer irsign;
00064     extern doublereal slansp_(char *, char *, integer *, real *, real *);
00065     integer ipvtng;
00066     extern doublereal slansy_(char *, char *, integer *, real *, integer *, 
00067             real *);
00068 
00069 
00070 /*  -- LAPACK test routine (version 3.1) -- */
00071 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00072 /*     November 2006 */
00073 
00074 /*     .. Scalar Arguments .. */
00075 /*     .. */
00076 /*     .. Array Arguments .. */
00077 /*     .. */
00078 
00079 /*  Purpose */
00080 /*  ======= */
00081 
00082 /*     SLATMR generates random matrices of various types for testing */
00083 /*     LAPACK programs. */
00084 
00085 /*     SLATMR operates by applying the following sequence of */
00086 /*     operations: */
00087 
00088 /*       Generate a matrix A with random entries of distribution DIST */
00089 /*          which is symmetric if SYM='S', and nonsymmetric */
00090 /*          if SYM='N'. */
00091 
00092 /*       Set the diagonal to D, where D may be input or */
00093 /*          computed according to MODE, COND, DMAX and RSIGN */
00094 /*          as described below. */
00095 
00096 /*       Grade the matrix, if desired, from the left and/or right */
00097 /*          as specified by GRADE. The inputs DL, MODEL, CONDL, DR, */
00098 /*          MODER and CONDR also determine the grading as described */
00099 /*          below. */
00100 
00101 /*       Permute, if desired, the rows and/or columns as specified by */
00102 /*          PIVTNG and IPIVOT. */
00103 
00104 /*       Set random entries to zero, if desired, to get a random sparse */
00105 /*          matrix as specified by SPARSE. */
00106 
00107 /*       Make A a band matrix, if desired, by zeroing out the matrix */
00108 /*          outside a band of lower bandwidth KL and upper bandwidth KU. */
00109 
00110 /*       Scale A, if desired, to have maximum entry ANORM. */
00111 
00112 /*       Pack the matrix if desired. Options specified by PACK are: */
00113 /*          no packing */
00114 /*          zero out upper half (if symmetric) */
00115 /*          zero out lower half (if symmetric) */
00116 /*          store the upper half columnwise (if symmetric or */
00117 /*              square upper triangular) */
00118 /*          store the lower half columnwise (if symmetric or */
00119 /*              square lower triangular) */
00120 /*              same as upper half rowwise if symmetric */
00121 /*          store the lower triangle in banded format (if symmetric) */
00122 /*          store the upper triangle in banded format (if symmetric) */
00123 /*          store the entire matrix in banded format */
00124 
00125 /*     Note: If two calls to SLATMR differ only in the PACK parameter, */
00126 /*           they will generate mathematically equivalent matrices. */
00127 
00128 /*           If two calls to SLATMR both have full bandwidth (KL = M-1 */
00129 /*           and KU = N-1), and differ only in the PIVTNG and PACK */
00130 /*           parameters, then the matrices generated will differ only */
00131 /*           in the order of the rows and/or columns, and otherwise */
00132 /*           contain the same data. This consistency cannot be and */
00133 /*           is not maintained with less than full bandwidth. */
00134 
00135 /*  Arguments */
00136 /*  ========= */
00137 
00138 /*  M      - INTEGER */
00139 /*           Number of rows of A. Not modified. */
00140 
00141 /*  N      - INTEGER */
00142 /*           Number of columns of A. Not modified. */
00143 
00144 /*  DIST   - CHARACTER*1 */
00145 /*           On entry, DIST specifies the type of distribution to be used */
00146 /*           to generate a random matrix . */
00147 /*           'U' => UNIFORM( 0, 1 )  ( 'U' for uniform ) */
00148 /*           'S' => UNIFORM( -1, 1 ) ( 'S' for symmetric ) */
00149 /*           'N' => NORMAL( 0, 1 )   ( 'N' for normal ) */
00150 /*           Not modified. */
00151 
00152 /*  ISEED  - INTEGER array, dimension (4) */
00153 /*           On entry ISEED specifies the seed of the random number */
00154 /*           generator. They should lie between 0 and 4095 inclusive, */
00155 /*           and ISEED(4) should be odd. The random number generator */
00156 /*           uses a linear congruential sequence limited to small */
00157 /*           integers, and so should produce machine independent */
00158 /*           random numbers. The values of ISEED are changed on */
00159 /*           exit, and can be used in the next call to SLATMR */
00160 /*           to continue the same random number sequence. */
00161 /*           Changed on exit. */
00162 
00163 /*  SYM    - CHARACTER*1 */
00164 /*           If SYM='S' or 'H', generated matrix is symmetric. */
00165 /*           If SYM='N', generated matrix is nonsymmetric. */
00166 /*           Not modified. */
00167 
00168 /*  D      - REAL array, dimension (min(M,N)) */
00169 /*           On entry this array specifies the diagonal entries */
00170 /*           of the diagonal of A.  D may either be specified */
00171 /*           on entry, or set according to MODE and COND as described */
00172 /*           below. May be changed on exit if MODE is nonzero. */
00173 
00174 /*  MODE   - INTEGER */
00175 /*           On entry describes how D is to be used: */
00176 /*           MODE = 0 means use D as input */
00177 /*           MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND */
00178 /*           MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND */
00179 /*           MODE = 3 sets D(I)=COND**(-(I-1)/(N-1)) */
00180 /*           MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND) */
00181 /*           MODE = 5 sets D to random numbers in the range */
00182 /*                    ( 1/COND , 1 ) such that their logarithms */
00183 /*                    are uniformly distributed. */
00184 /*           MODE = 6 set D to random numbers from same distribution */
00185 /*                    as the rest of the matrix. */
00186 /*           MODE < 0 has the same meaning as ABS(MODE), except that */
00187 /*              the order of the elements of D is reversed. */
00188 /*           Thus if MODE is positive, D has entries ranging from */
00189 /*              1 to 1/COND, if negative, from 1/COND to 1, */
00190 /*           Not modified. */
00191 
00192 /*  COND   - REAL */
00193 /*           On entry, used as described under MODE above. */
00194 /*           If used, it must be >= 1. Not modified. */
00195 
00196 /*  DMAX   - REAL */
00197 /*           If MODE neither -6, 0 nor 6, the diagonal is scaled by */
00198 /*           DMAX / max(abs(D(i))), so that maximum absolute entry */
00199 /*           of diagonal is abs(DMAX). If DMAX is negative (or zero), */
00200 /*           diagonal will be scaled by a negative number (or zero). */
00201 
00202 /*  RSIGN  - CHARACTER*1 */
00203 /*           If MODE neither -6, 0 nor 6, specifies sign of diagonal */
00204 /*           as follows: */
00205 /*           'T' => diagonal entries are multiplied by 1 or -1 */
00206 /*                  with probability .5 */
00207 /*           'F' => diagonal unchanged */
00208 /*           Not modified. */
00209 
00210 /*  GRADE  - CHARACTER*1 */
00211 /*           Specifies grading of matrix as follows: */
00212 /*           'N'  => no grading */
00213 /*           'L'  => matrix premultiplied by diag( DL ) */
00214 /*                   (only if matrix nonsymmetric) */
00215 /*           'R'  => matrix postmultiplied by diag( DR ) */
00216 /*                   (only if matrix nonsymmetric) */
00217 /*           'B'  => matrix premultiplied by diag( DL ) and */
00218 /*                         postmultiplied by diag( DR ) */
00219 /*                   (only if matrix nonsymmetric) */
00220 /*           'S' or 'H'  => matrix premultiplied by diag( DL ) and */
00221 /*                          postmultiplied by diag( DL ) */
00222 /*                          ('S' for symmetric, or 'H' for Hermitian) */
00223 /*           'E'  => matrix premultiplied by diag( DL ) and */
00224 /*                         postmultiplied by inv( diag( DL ) ) */
00225 /*                         ( 'E' for eigenvalue invariance) */
00226 /*                   (only if matrix nonsymmetric) */
00227 /*                   Note: if GRADE='E', then M must equal N. */
00228 /*           Not modified. */
00229 
00230 /*  DL     - REAL array, dimension (M) */
00231 /*           If MODEL=0, then on entry this array specifies the diagonal */
00232 /*           entries of a diagonal matrix used as described under GRADE */
00233 /*           above. If MODEL is not zero, then DL will be set according */
00234 /*           to MODEL and CONDL, analogous to the way D is set according */
00235 /*           to MODE and COND (except there is no DMAX parameter for DL). */
00236 /*           If GRADE='E', then DL cannot have zero entries. */
00237 /*           Not referenced if GRADE = 'N' or 'R'. Changed on exit. */
00238 
00239 /*  MODEL  - INTEGER */
00240 /*           This specifies how the diagonal array DL is to be computed, */
00241 /*           just as MODE specifies how D is to be computed. */
00242 /*           Not modified. */
00243 
00244 /*  CONDL  - REAL */
00245 /*           When MODEL is not zero, this specifies the condition number */
00246 /*           of the computed DL.  Not modified. */
00247 
00248 /*  DR     - REAL array, dimension (N) */
00249 /*           If MODER=0, then on entry this array specifies the diagonal */
00250 /*           entries of a diagonal matrix used as described under GRADE */
00251 /*           above. If MODER is not zero, then DR will be set according */
00252 /*           to MODER and CONDR, analogous to the way D is set according */
00253 /*           to MODE and COND (except there is no DMAX parameter for DR). */
00254 /*           Not referenced if GRADE = 'N', 'L', 'H', 'S' or 'E'. */
00255 /*           Changed on exit. */
00256 
00257 /*  MODER  - INTEGER */
00258 /*           This specifies how the diagonal array DR is to be computed, */
00259 /*           just as MODE specifies how D is to be computed. */
00260 /*           Not modified. */
00261 
00262 /*  CONDR  - REAL */
00263 /*           When MODER is not zero, this specifies the condition number */
00264 /*           of the computed DR.  Not modified. */
00265 
00266 /*  PIVTNG - CHARACTER*1 */
00267 /*           On entry specifies pivoting permutations as follows: */
00268 /*           'N' or ' ' => none. */
00269 /*           'L' => left or row pivoting (matrix must be nonsymmetric). */
00270 /*           'R' => right or column pivoting (matrix must be */
00271 /*                  nonsymmetric). */
00272 /*           'B' or 'F' => both or full pivoting, i.e., on both sides. */
00273 /*                         In this case, M must equal N */
00274 
00275 /*           If two calls to SLATMR both have full bandwidth (KL = M-1 */
00276 /*           and KU = N-1), and differ only in the PIVTNG and PACK */
00277 /*           parameters, then the matrices generated will differ only */
00278 /*           in the order of the rows and/or columns, and otherwise */
00279 /*           contain the same data. This consistency cannot be */
00280 /*           maintained with less than full bandwidth. */
00281 
00282 /*  IPIVOT - INTEGER array, dimension (N or M) */
00283 /*           This array specifies the permutation used.  After the */
00284 /*           basic matrix is generated, the rows, columns, or both */
00285 /*           are permuted.   If, say, row pivoting is selected, SLATMR */
00286 /*           starts with the *last* row and interchanges the M-th and */
00287 /*           IPIVOT(M)-th rows, then moves to the next-to-last row, */
00288 /*           interchanging the (M-1)-th and the IPIVOT(M-1)-th rows, */
00289 /*           and so on.  In terms of "2-cycles", the permutation is */
00290 /*           (1 IPIVOT(1)) (2 IPIVOT(2)) ... (M IPIVOT(M)) */
00291 /*           where the rightmost cycle is applied first.  This is the */
00292 /*           *inverse* of the effect of pivoting in LINPACK.  The idea */
00293 /*           is that factoring (with pivoting) an identity matrix */
00294 /*           which has been inverse-pivoted in this way should */
00295 /*           result in a pivot vector identical to IPIVOT. */
00296 /*           Not referenced if PIVTNG = 'N'. Not modified. */
00297 
00298 /*  SPARSE - REAL */
00299 /*           On entry specifies the sparsity of the matrix if a sparse */
00300 /*           matrix is to be generated. SPARSE should lie between */
00301 /*           0 and 1. To generate a sparse matrix, for each matrix entry */
00302 /*           a uniform ( 0, 1 ) random number x is generated and */
00303 /*           compared to SPARSE; if x is larger the matrix entry */
00304 /*           is unchanged and if x is smaller the entry is set */
00305 /*           to zero. Thus on the average a fraction SPARSE of the */
00306 /*           entries will be set to zero. */
00307 /*           Not modified. */
00308 
00309 /*  KL     - INTEGER */
00310 /*           On entry specifies the lower bandwidth of the  matrix. For */
00311 /*           example, KL=0 implies upper triangular, KL=1 implies upper */
00312 /*           Hessenberg, and KL at least M-1 implies the matrix is not */
00313 /*           banded. Must equal KU if matrix is symmetric. */
00314 /*           Not modified. */
00315 
00316 /*  KU     - INTEGER */
00317 /*           On entry specifies the upper bandwidth of the  matrix. For */
00318 /*           example, KU=0 implies lower triangular, KU=1 implies lower */
00319 /*           Hessenberg, and KU at least N-1 implies the matrix is not */
00320 /*           banded. Must equal KL if matrix is symmetric. */
00321 /*           Not modified. */
00322 
00323 /*  ANORM  - REAL */
00324 /*           On entry specifies maximum entry of output matrix */
00325 /*           (output matrix will by multiplied by a constant so that */
00326 /*           its largest absolute entry equal ANORM) */
00327 /*           if ANORM is nonnegative. If ANORM is negative no scaling */
00328 /*           is done. Not modified. */
00329 
00330 /*  PACK   - CHARACTER*1 */
00331 /*           On entry specifies packing of matrix as follows: */
00332 /*           'N' => no packing */
00333 /*           'U' => zero out all subdiagonal entries (if symmetric) */
00334 /*           'L' => zero out all superdiagonal entries (if symmetric) */
00335 /*           'C' => store the upper triangle columnwise */
00336 /*                  (only if matrix symmetric or square upper triangular) */
00337 /*           'R' => store the lower triangle columnwise */
00338 /*                  (only if matrix symmetric or square lower triangular) */
00339 /*                  (same as upper half rowwise if symmetric) */
00340 /*           'B' => store the lower triangle in band storage scheme */
00341 /*                  (only if matrix symmetric) */
00342 /*           'Q' => store the upper triangle in band storage scheme */
00343 /*                  (only if matrix symmetric) */
00344 /*           'Z' => store the entire matrix in band storage scheme */
00345 /*                      (pivoting can be provided for by using this */
00346 /*                      option to store A in the trailing rows of */
00347 /*                      the allocated storage) */
00348 
00349 /*           Using these options, the various LAPACK packed and banded */
00350 /*           storage schemes can be obtained: */
00351 /*           GB               - use 'Z' */
00352 /*           PB, SB or TB     - use 'B' or 'Q' */
00353 /*           PP, SP or TP     - use 'C' or 'R' */
00354 
00355 /*           If two calls to SLATMR differ only in the PACK parameter, */
00356 /*           they will generate mathematically equivalent matrices. */
00357 /*           Not modified. */
00358 
00359 /*  A      - REAL array, dimension (LDA,N) */
00360 /*           On exit A is the desired test matrix. Only those */
00361 /*           entries of A which are significant on output */
00362 /*           will be referenced (even if A is in packed or band */
00363 /*           storage format). The 'unoccupied corners' of A in */
00364 /*           band format will be zeroed out. */
00365 
00366 /*  LDA    - INTEGER */
00367 /*           on entry LDA specifies the first dimension of A as */
00368 /*           declared in the calling program. */
00369 /*           If PACK='N', 'U' or 'L', LDA must be at least max ( 1, M ). */
00370 /*           If PACK='C' or 'R', LDA must be at least 1. */
00371 /*           If PACK='B', or 'Q', LDA must be MIN ( KU+1, N ) */
00372 /*           If PACK='Z', LDA must be at least KUU+KLL+1, where */
00373 /*           KUU = MIN ( KU, N-1 ) and KLL = MIN ( KL, N-1 ) */
00374 /*           Not modified. */
00375 
00376 /*  IWORK  - INTEGER array, dimension ( N or M) */
00377 /*           Workspace. Not referenced if PIVTNG = 'N'. Changed on exit. */
00378 
00379 /*  INFO   - INTEGER */
00380 /*           Error parameter on exit: */
00381 /*             0 => normal return */
00382 /*            -1 => M negative or unequal to N and SYM='S' or 'H' */
00383 /*            -2 => N negative */
00384 /*            -3 => DIST illegal string */
00385 /*            -5 => SYM illegal string */
00386 /*            -7 => MODE not in range -6 to 6 */
00387 /*            -8 => COND less than 1.0, and MODE neither -6, 0 nor 6 */
00388 /*           -10 => MODE neither -6, 0 nor 6 and RSIGN illegal string */
00389 /*           -11 => GRADE illegal string, or GRADE='E' and */
00390 /*                  M not equal to N, or GRADE='L', 'R', 'B' or 'E' and */
00391 /*                  SYM = 'S' or 'H' */
00392 /*           -12 => GRADE = 'E' and DL contains zero */
00393 /*           -13 => MODEL not in range -6 to 6 and GRADE= 'L', 'B', 'H', */
00394 /*                  'S' or 'E' */
00395 /*           -14 => CONDL less than 1.0, GRADE='L', 'B', 'H', 'S' or 'E', */
00396 /*                  and MODEL neither -6, 0 nor 6 */
00397 /*           -16 => MODER not in range -6 to 6 and GRADE= 'R' or 'B' */
00398 /*           -17 => CONDR less than 1.0, GRADE='R' or 'B', and */
00399 /*                  MODER neither -6, 0 nor 6 */
00400 /*           -18 => PIVTNG illegal string, or PIVTNG='B' or 'F' and */
00401 /*                  M not equal to N, or PIVTNG='L' or 'R' and SYM='S' */
00402 /*                  or 'H' */
00403 /*           -19 => IPIVOT contains out of range number and */
00404 /*                  PIVTNG not equal to 'N' */
00405 /*           -20 => KL negative */
00406 /*           -21 => KU negative, or SYM='S' or 'H' and KU not equal to KL */
00407 /*           -22 => SPARSE not in range 0. to 1. */
00408 /*           -24 => PACK illegal string, or PACK='U', 'L', 'B' or 'Q' */
00409 /*                  and SYM='N', or PACK='C' and SYM='N' and either KL */
00410 /*                  not equal to 0 or N not equal to M, or PACK='R' and */
00411 /*                  SYM='N', and either KU not equal to 0 or N not equal */
00412 /*                  to M */
00413 /*           -26 => LDA too small */
00414 /*             1 => Error return from SLATM1 (computing D) */
00415 /*             2 => Cannot scale diagonal to DMAX (max. entry is 0) */
00416 /*             3 => Error return from SLATM1 (computing DL) */
00417 /*             4 => Error return from SLATM1 (computing DR) */
00418 /*             5 => ANORM is positive, but matrix constructed prior to */
00419 /*                  attempting to scale it to have norm ANORM, is zero */
00420 
00421 /*  ===================================================================== */
00422 
00423 /*     .. Parameters .. */
00424 /*     .. */
00425 /*     .. Local Scalars .. */
00426 /*     .. */
00427 /*     .. Local Arrays .. */
00428 /*     .. */
00429 /*     .. External Functions .. */
00430 /*     .. */
00431 /*     .. External Subroutines .. */
00432 /*     .. */
00433 /*     .. Intrinsic Functions .. */
00434 /*     .. */
00435 /*     .. Executable Statements .. */
00436 
00437 /*     1)      Decode and Test the input parameters. */
00438 /*             Initialize flags & seed. */
00439 
00440     /* Parameter adjustments */
00441     --iseed;
00442     --d__;
00443     --dl;
00444     --dr;
00445     --ipivot;
00446     a_dim1 = *lda;
00447     a_offset = 1 + a_dim1;
00448     a -= a_offset;
00449     --iwork;
00450 
00451     /* Function Body */
00452     *info = 0;
00453 
00454 /*     Quick return if possible */
00455 
00456     if (*m == 0 || *n == 0) {
00457         return 0;
00458     }
00459 
00460 /*     Decode DIST */
00461 
00462     if (lsame_(dist, "U")) {
00463         idist = 1;
00464     } else if (lsame_(dist, "S")) {
00465         idist = 2;
00466     } else if (lsame_(dist, "N")) {
00467         idist = 3;
00468     } else {
00469         idist = -1;
00470     }
00471 
00472 /*     Decode SYM */
00473 
00474     if (lsame_(sym, "S")) {
00475         isym = 0;
00476     } else if (lsame_(sym, "N")) {
00477         isym = 1;
00478     } else if (lsame_(sym, "H")) {
00479         isym = 0;
00480     } else {
00481         isym = -1;
00482     }
00483 
00484 /*     Decode RSIGN */
00485 
00486     if (lsame_(rsign, "F")) {
00487         irsign = 0;
00488     } else if (lsame_(rsign, "T")) {
00489         irsign = 1;
00490     } else {
00491         irsign = -1;
00492     }
00493 
00494 /*     Decode PIVTNG */
00495 
00496     if (lsame_(pivtng, "N")) {
00497         ipvtng = 0;
00498     } else if (lsame_(pivtng, " ")) {
00499         ipvtng = 0;
00500     } else if (lsame_(pivtng, "L")) {
00501         ipvtng = 1;
00502         npvts = *m;
00503     } else if (lsame_(pivtng, "R")) {
00504         ipvtng = 2;
00505         npvts = *n;
00506     } else if (lsame_(pivtng, "B")) {
00507         ipvtng = 3;
00508         npvts = min(*n,*m);
00509     } else if (lsame_(pivtng, "F")) {
00510         ipvtng = 3;
00511         npvts = min(*n,*m);
00512     } else {
00513         ipvtng = -1;
00514     }
00515 
00516 /*     Decode GRADE */
00517 
00518     if (lsame_(grade, "N")) {
00519         igrade = 0;
00520     } else if (lsame_(grade, "L")) {
00521         igrade = 1;
00522     } else if (lsame_(grade, "R")) {
00523         igrade = 2;
00524     } else if (lsame_(grade, "B")) {
00525         igrade = 3;
00526     } else if (lsame_(grade, "E")) {
00527         igrade = 4;
00528     } else if (lsame_(grade, "H") || lsame_(grade, 
00529             "S")) {
00530         igrade = 5;
00531     } else {
00532         igrade = -1;
00533     }
00534 
00535 /*     Decode PACK */
00536 
00537     if (lsame_(pack, "N")) {
00538         ipack = 0;
00539     } else if (lsame_(pack, "U")) {
00540         ipack = 1;
00541     } else if (lsame_(pack, "L")) {
00542         ipack = 2;
00543     } else if (lsame_(pack, "C")) {
00544         ipack = 3;
00545     } else if (lsame_(pack, "R")) {
00546         ipack = 4;
00547     } else if (lsame_(pack, "B")) {
00548         ipack = 5;
00549     } else if (lsame_(pack, "Q")) {
00550         ipack = 6;
00551     } else if (lsame_(pack, "Z")) {
00552         ipack = 7;
00553     } else {
00554         ipack = -1;
00555     }
00556 
00557 /*     Set certain internal parameters */
00558 
00559     mnmin = min(*m,*n);
00560 /* Computing MIN */
00561     i__1 = *kl, i__2 = *m - 1;
00562     kll = min(i__1,i__2);
00563 /* Computing MIN */
00564     i__1 = *ku, i__2 = *n - 1;
00565     kuu = min(i__1,i__2);
00566 
00567 /*     If inv(DL) is used, check to see if DL has a zero entry. */
00568 
00569     dzero = FALSE_;
00570     if (igrade == 4 && *model == 0) {
00571         i__1 = *m;
00572         for (i__ = 1; i__ <= i__1; ++i__) {
00573             if (dl[i__] == 0.f) {
00574                 dzero = TRUE_;
00575             }
00576 /* L10: */
00577         }
00578     }
00579 
00580 /*     Check values in IPIVOT */
00581 
00582     badpvt = FALSE_;
00583     if (ipvtng > 0) {
00584         i__1 = npvts;
00585         for (j = 1; j <= i__1; ++j) {
00586             if (ipivot[j] <= 0 || ipivot[j] > npvts) {
00587                 badpvt = TRUE_;
00588             }
00589 /* L20: */
00590         }
00591     }
00592 
00593 /*     Set INFO if an error */
00594 
00595     if (*m < 0) {
00596         *info = -1;
00597     } else if (*m != *n && isym == 0) {
00598         *info = -1;
00599     } else if (*n < 0) {
00600         *info = -2;
00601     } else if (idist == -1) {
00602         *info = -3;
00603     } else if (isym == -1) {
00604         *info = -5;
00605     } else if (*mode < -6 || *mode > 6) {
00606         *info = -7;
00607     } else if (*mode != -6 && *mode != 0 && *mode != 6 && *cond < 1.f) {
00608         *info = -8;
00609     } else if (*mode != -6 && *mode != 0 && *mode != 6 && irsign == -1) {
00610         *info = -10;
00611     } else if (igrade == -1 || igrade == 4 && *m != *n || igrade >= 1 && 
00612             igrade <= 4 && isym == 0) {
00613         *info = -11;
00614     } else if (igrade == 4 && dzero) {
00615         *info = -12;
00616     } else if ((igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5) && (
00617             *model < -6 || *model > 6)) {
00618         *info = -13;
00619     } else if ((igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5) && (
00620             *model != -6 && *model != 0 && *model != 6) && *condl < 1.f) {
00621         *info = -14;
00622     } else if ((igrade == 2 || igrade == 3) && (*moder < -6 || *moder > 6)) {
00623         *info = -16;
00624     } else if ((igrade == 2 || igrade == 3) && (*moder != -6 && *moder != 0 &&
00625              *moder != 6) && *condr < 1.f) {
00626         *info = -17;
00627     } else if (ipvtng == -1 || ipvtng == 3 && *m != *n || (ipvtng == 1 || 
00628             ipvtng == 2) && isym == 0) {
00629         *info = -18;
00630     } else if (ipvtng != 0 && badpvt) {
00631         *info = -19;
00632     } else if (*kl < 0) {
00633         *info = -20;
00634     } else if (*ku < 0 || isym == 0 && *kl != *ku) {
00635         *info = -21;
00636     } else if (*sparse < 0.f || *sparse > 1.f) {
00637         *info = -22;
00638     } else if (ipack == -1 || (ipack == 1 || ipack == 2 || ipack == 5 || 
00639             ipack == 6) && isym == 1 || ipack == 3 && isym == 1 && (*kl != 0 
00640             || *m != *n) || ipack == 4 && isym == 1 && (*ku != 0 || *m != *n))
00641              {
00642         *info = -24;
00643     } else if ((ipack == 0 || ipack == 1 || ipack == 2) && *lda < max(1,*m) ||
00644              (ipack == 3 || ipack == 4) && *lda < 1 || (ipack == 5 || ipack ==
00645              6) && *lda < kuu + 1 || ipack == 7 && *lda < kll + kuu + 1) {
00646         *info = -26;
00647     }
00648 
00649     if (*info != 0) {
00650         i__1 = -(*info);
00651         xerbla_("SLATMR", &i__1);
00652         return 0;
00653     }
00654 
00655 /*     Decide if we can pivot consistently */
00656 
00657     fulbnd = FALSE_;
00658     if (kuu == *n - 1 && kll == *m - 1) {
00659         fulbnd = TRUE_;
00660     }
00661 
00662 /*     Initialize random number generator */
00663 
00664     for (i__ = 1; i__ <= 4; ++i__) {
00665         iseed[i__] = (i__1 = iseed[i__], abs(i__1)) % 4096;
00666 /* L30: */
00667     }
00668 
00669     iseed[4] = (iseed[4] / 2 << 1) + 1;
00670 
00671 /*     2)      Set up D, DL, and DR, if indicated. */
00672 
00673 /*             Compute D according to COND and MODE */
00674 
00675     slatm1_(mode, cond, &irsign, &idist, &iseed[1], &d__[1], &mnmin, info);
00676     if (*info != 0) {
00677         *info = 1;
00678         return 0;
00679     }
00680     if (*mode != 0 && *mode != -6 && *mode != 6) {
00681 
00682 /*        Scale by DMAX */
00683 
00684         temp = dabs(d__[1]);
00685         i__1 = mnmin;
00686         for (i__ = 2; i__ <= i__1; ++i__) {
00687 /* Computing MAX */
00688             r__2 = temp, r__3 = (r__1 = d__[i__], dabs(r__1));
00689             temp = dmax(r__2,r__3);
00690 /* L40: */
00691         }
00692         if (temp == 0.f && *dmax__ != 0.f) {
00693             *info = 2;
00694             return 0;
00695         }
00696         if (temp != 0.f) {
00697             alpha = *dmax__ / temp;
00698         } else {
00699             alpha = 1.f;
00700         }
00701         i__1 = mnmin;
00702         for (i__ = 1; i__ <= i__1; ++i__) {
00703             d__[i__] = alpha * d__[i__];
00704 /* L50: */
00705         }
00706 
00707     }
00708 
00709 /*     Compute DL if grading set */
00710 
00711     if (igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5) {
00712         slatm1_(model, condl, &c__0, &idist, &iseed[1], &dl[1], m, info);
00713         if (*info != 0) {
00714             *info = 3;
00715             return 0;
00716         }
00717     }
00718 
00719 /*     Compute DR if grading set */
00720 
00721     if (igrade == 2 || igrade == 3) {
00722         slatm1_(moder, condr, &c__0, &idist, &iseed[1], &dr[1], n, info);
00723         if (*info != 0) {
00724             *info = 4;
00725             return 0;
00726         }
00727     }
00728 
00729 /*     3)     Generate IWORK if pivoting */
00730 
00731     if (ipvtng > 0) {
00732         i__1 = npvts;
00733         for (i__ = 1; i__ <= i__1; ++i__) {
00734             iwork[i__] = i__;
00735 /* L60: */
00736         }
00737         if (fulbnd) {
00738             i__1 = npvts;
00739             for (i__ = 1; i__ <= i__1; ++i__) {
00740                 k = ipivot[i__];
00741                 j = iwork[i__];
00742                 iwork[i__] = iwork[k];
00743                 iwork[k] = j;
00744 /* L70: */
00745             }
00746         } else {
00747             for (i__ = npvts; i__ >= 1; --i__) {
00748                 k = ipivot[i__];
00749                 j = iwork[i__];
00750                 iwork[i__] = iwork[k];
00751                 iwork[k] = j;
00752 /* L80: */
00753             }
00754         }
00755     }
00756 
00757 /*     4)      Generate matrices for each kind of PACKing */
00758 /*             Always sweep matrix columnwise (if symmetric, upper */
00759 /*             half only) so that matrix generated does not depend */
00760 /*             on PACK */
00761 
00762     if (fulbnd) {
00763 
00764 /*        Use SLATM3 so matrices generated with differing PIVOTing only */
00765 /*        differ only in the order of their rows and/or columns. */
00766 
00767         if (ipack == 0) {
00768             if (isym == 0) {
00769                 i__1 = *n;
00770                 for (j = 1; j <= i__1; ++j) {
00771                     i__2 = j;
00772                     for (i__ = 1; i__ <= i__2; ++i__) {
00773                         temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00774                                 idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00775                                 dr[1], &ipvtng, &iwork[1], sparse);
00776                         a[isub + jsub * a_dim1] = temp;
00777                         a[jsub + isub * a_dim1] = temp;
00778 /* L90: */
00779                     }
00780 /* L100: */
00781                 }
00782             } else if (isym == 1) {
00783                 i__1 = *n;
00784                 for (j = 1; j <= i__1; ++j) {
00785                     i__2 = *m;
00786                     for (i__ = 1; i__ <= i__2; ++i__) {
00787                         temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00788                                 idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00789                                 dr[1], &ipvtng, &iwork[1], sparse);
00790                         a[isub + jsub * a_dim1] = temp;
00791 /* L110: */
00792                     }
00793 /* L120: */
00794                 }
00795             }
00796 
00797         } else if (ipack == 1) {
00798 
00799             i__1 = *n;
00800             for (j = 1; j <= i__1; ++j) {
00801                 i__2 = j;
00802                 for (i__ = 1; i__ <= i__2; ++i__) {
00803                     temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00804                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
00805 , &ipvtng, &iwork[1], sparse);
00806                     mnsub = min(isub,jsub);
00807                     mxsub = max(isub,jsub);
00808                     a[mnsub + mxsub * a_dim1] = temp;
00809                     if (mnsub != mxsub) {
00810                         a[mxsub + mnsub * a_dim1] = 0.f;
00811                     }
00812 /* L130: */
00813                 }
00814 /* L140: */
00815             }
00816 
00817         } else if (ipack == 2) {
00818 
00819             i__1 = *n;
00820             for (j = 1; j <= i__1; ++j) {
00821                 i__2 = j;
00822                 for (i__ = 1; i__ <= i__2; ++i__) {
00823                     temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00824                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
00825 , &ipvtng, &iwork[1], sparse);
00826                     mnsub = min(isub,jsub);
00827                     mxsub = max(isub,jsub);
00828                     a[mxsub + mnsub * a_dim1] = temp;
00829                     if (mnsub != mxsub) {
00830                         a[mnsub + mxsub * a_dim1] = 0.f;
00831                     }
00832 /* L150: */
00833                 }
00834 /* L160: */
00835             }
00836 
00837         } else if (ipack == 3) {
00838 
00839             i__1 = *n;
00840             for (j = 1; j <= i__1; ++j) {
00841                 i__2 = j;
00842                 for (i__ = 1; i__ <= i__2; ++i__) {
00843                     temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00844                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
00845 , &ipvtng, &iwork[1], sparse);
00846 
00847 /*                 Compute K = location of (ISUB,JSUB) entry in packed */
00848 /*                 array */
00849 
00850                     mnsub = min(isub,jsub);
00851                     mxsub = max(isub,jsub);
00852                     k = mxsub * (mxsub - 1) / 2 + mnsub;
00853 
00854 /*                 Convert K to (IISUB,JJSUB) location */
00855 
00856                     jjsub = (k - 1) / *lda + 1;
00857                     iisub = k - *lda * (jjsub - 1);
00858 
00859                     a[iisub + jjsub * a_dim1] = temp;
00860 /* L170: */
00861                 }
00862 /* L180: */
00863             }
00864 
00865         } else if (ipack == 4) {
00866 
00867             i__1 = *n;
00868             for (j = 1; j <= i__1; ++j) {
00869                 i__2 = j;
00870                 for (i__ = 1; i__ <= i__2; ++i__) {
00871                     temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00872                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
00873 , &ipvtng, &iwork[1], sparse);
00874 
00875 /*                 Compute K = location of (I,J) entry in packed array */
00876 
00877                     mnsub = min(isub,jsub);
00878                     mxsub = max(isub,jsub);
00879                     if (mnsub == 1) {
00880                         k = mxsub;
00881                     } else {
00882                         k = *n * (*n + 1) / 2 - (*n - mnsub + 1) * (*n - 
00883                                 mnsub + 2) / 2 + mxsub - mnsub + 1;
00884                     }
00885 
00886 /*                 Convert K to (IISUB,JJSUB) location */
00887 
00888                     jjsub = (k - 1) / *lda + 1;
00889                     iisub = k - *lda * (jjsub - 1);
00890 
00891                     a[iisub + jjsub * a_dim1] = temp;
00892 /* L190: */
00893                 }
00894 /* L200: */
00895             }
00896 
00897         } else if (ipack == 5) {
00898 
00899             i__1 = *n;
00900             for (j = 1; j <= i__1; ++j) {
00901                 i__2 = j;
00902                 for (i__ = j - kuu; i__ <= i__2; ++i__) {
00903                     if (i__ < 1) {
00904                         a[j - i__ + 1 + (i__ + *n) * a_dim1] = 0.f;
00905                     } else {
00906                         temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00907                                 idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00908                                 dr[1], &ipvtng, &iwork[1], sparse);
00909                         mnsub = min(isub,jsub);
00910                         mxsub = max(isub,jsub);
00911                         a[mxsub - mnsub + 1 + mnsub * a_dim1] = temp;
00912                     }
00913 /* L210: */
00914                 }
00915 /* L220: */
00916             }
00917 
00918         } else if (ipack == 6) {
00919 
00920             i__1 = *n;
00921             for (j = 1; j <= i__1; ++j) {
00922                 i__2 = j;
00923                 for (i__ = j - kuu; i__ <= i__2; ++i__) {
00924                     temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00925                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
00926 , &ipvtng, &iwork[1], sparse);
00927                     mnsub = min(isub,jsub);
00928                     mxsub = max(isub,jsub);
00929                     a[mnsub - mxsub + kuu + 1 + mxsub * a_dim1] = temp;
00930 /* L230: */
00931                 }
00932 /* L240: */
00933             }
00934 
00935         } else if (ipack == 7) {
00936 
00937             if (isym == 0) {
00938                 i__1 = *n;
00939                 for (j = 1; j <= i__1; ++j) {
00940                     i__2 = j;
00941                     for (i__ = j - kuu; i__ <= i__2; ++i__) {
00942                         temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00943                                 idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00944                                 dr[1], &ipvtng, &iwork[1], sparse);
00945                         mnsub = min(isub,jsub);
00946                         mxsub = max(isub,jsub);
00947                         a[mnsub - mxsub + kuu + 1 + mxsub * a_dim1] = temp;
00948                         if (i__ < 1) {
00949                             a[j - i__ + 1 + kuu + (i__ + *n) * a_dim1] = 0.f;
00950                         }
00951                         if (i__ >= 1 && mnsub != mxsub) {
00952                             a[mxsub - mnsub + 1 + kuu + mnsub * a_dim1] = 
00953                                     temp;
00954                         }
00955 /* L250: */
00956                     }
00957 /* L260: */
00958                 }
00959             } else if (isym == 1) {
00960                 i__1 = *n;
00961                 for (j = 1; j <= i__1; ++j) {
00962                     i__2 = j + kll;
00963                     for (i__ = j - kuu; i__ <= i__2; ++i__) {
00964                         temp = slatm3_(m, n, &i__, &j, &isub, &jsub, kl, ku, &
00965                                 idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00966                                 dr[1], &ipvtng, &iwork[1], sparse);
00967                         a[isub - jsub + kuu + 1 + jsub * a_dim1] = temp;
00968 /* L270: */
00969                     }
00970 /* L280: */
00971                 }
00972             }
00973 
00974         }
00975 
00976     } else {
00977 
00978 /*        Use SLATM2 */
00979 
00980         if (ipack == 0) {
00981             if (isym == 0) {
00982                 i__1 = *n;
00983                 for (j = 1; j <= i__1; ++j) {
00984                     i__2 = j;
00985                     for (i__ = 1; i__ <= i__2; ++i__) {
00986                         a[i__ + j * a_dim1] = slatm2_(m, n, &i__, &j, kl, ku, 
00987                                 &idist, &iseed[1], &d__[1], &igrade, &dl[1], &
00988                                 dr[1], &ipvtng, &iwork[1], sparse);
00989                         a[j + i__ * a_dim1] = a[i__ + j * a_dim1];
00990 /* L290: */
00991                     }
00992 /* L300: */
00993                 }
00994             } else if (isym == 1) {
00995                 i__1 = *n;
00996                 for (j = 1; j <= i__1; ++j) {
00997                     i__2 = *m;
00998                     for (i__ = 1; i__ <= i__2; ++i__) {
00999                         a[i__ + j * a_dim1] = slatm2_(m, n, &i__, &j, kl, ku, 
01000                                 &idist, &iseed[1], &d__[1], &igrade, &dl[1], &
01001                                 dr[1], &ipvtng, &iwork[1], sparse);
01002 /* L310: */
01003                     }
01004 /* L320: */
01005                 }
01006             }
01007 
01008         } else if (ipack == 1) {
01009 
01010             i__1 = *n;
01011             for (j = 1; j <= i__1; ++j) {
01012                 i__2 = j;
01013                 for (i__ = 1; i__ <= i__2; ++i__) {
01014                     a[i__ + j * a_dim1] = slatm2_(m, n, &i__, &j, kl, ku, &
01015                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
01016 , &ipvtng, &iwork[1], sparse);
01017                     if (i__ != j) {
01018                         a[j + i__ * a_dim1] = 0.f;
01019                     }
01020 /* L330: */
01021                 }
01022 /* L340: */
01023             }
01024 
01025         } else if (ipack == 2) {
01026 
01027             i__1 = *n;
01028             for (j = 1; j <= i__1; ++j) {
01029                 i__2 = j;
01030                 for (i__ = 1; i__ <= i__2; ++i__) {
01031                     a[j + i__ * a_dim1] = slatm2_(m, n, &i__, &j, kl, ku, &
01032                             idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[1]
01033 , &ipvtng, &iwork[1], sparse);
01034                     if (i__ != j) {
01035                         a[i__ + j * a_dim1] = 0.f;
01036                     }
01037 /* L350: */
01038                 }
01039 /* L360: */
01040             }
01041 
01042         } else if (ipack == 3) {
01043 
01044             isub = 0;
01045             jsub = 1;
01046             i__1 = *n;
01047             for (j = 1; j <= i__1; ++j) {
01048                 i__2 = j;
01049                 for (i__ = 1; i__ <= i__2; ++i__) {
01050                     ++isub;
01051                     if (isub > *lda) {
01052                         isub = 1;
01053                         ++jsub;
01054                     }
01055                     a[isub + jsub * a_dim1] = slatm2_(m, n, &i__, &j, kl, ku, 
01056                             &idist, &iseed[1], &d__[1], &igrade, &dl[1], &dr[
01057                             1], &ipvtng, &iwork[1], sparse);
01058 /* L370: */
01059                 }
01060 /* L380: */
01061             }
01062 
01063         } else if (ipack == 4) {
01064 
01065             if (isym == 0) {
01066                 i__1 = *n;
01067                 for (j = 1; j <= i__1; ++j) {
01068                     i__2 = j;
01069                     for (i__ = 1; i__ <= i__2; ++i__) {
01070 
01071 /*                    Compute K = location of (I,J) entry in packed array */
01072 
01073                         if (i__ == 1) {
01074                             k = j;
01075                         } else {
01076                             k = *n * (*n + 1) / 2 - (*n - i__ + 1) * (*n - 
01077                                     i__ + 2) / 2 + j - i__ + 1;
01078                         }
01079 
01080 /*                    Convert K to (ISUB,JSUB) location */
01081 
01082                         jsub = (k - 1) / *lda + 1;
01083                         isub = k - *lda * (jsub - 1);
01084 
01085                         a[isub + jsub * a_dim1] = slatm2_(m, n, &i__, &j, kl, 
01086                                 ku, &idist, &iseed[1], &d__[1], &igrade, &dl[
01087                                 1], &dr[1], &ipvtng, &iwork[1], sparse);
01088 /* L390: */
01089                     }
01090 /* L400: */
01091                 }
01092             } else {
01093                 isub = 0;
01094                 jsub = 1;
01095                 i__1 = *n;
01096                 for (j = 1; j <= i__1; ++j) {
01097                     i__2 = *m;
01098                     for (i__ = j; i__ <= i__2; ++i__) {
01099                         ++isub;
01100                         if (isub > *lda) {
01101                             isub = 1;
01102                             ++jsub;
01103                         }
01104                         a[isub + jsub * a_dim1] = slatm2_(m, n, &i__, &j, kl, 
01105                                 ku, &idist, &iseed[1], &d__[1], &igrade, &dl[
01106                                 1], &dr[1], &ipvtng, &iwork[1], sparse);
01107 /* L410: */
01108                     }
01109 /* L420: */
01110                 }
01111             }
01112 
01113         } else if (ipack == 5) {
01114 
01115             i__1 = *n;
01116             for (j = 1; j <= i__1; ++j) {
01117                 i__2 = j;
01118                 for (i__ = j - kuu; i__ <= i__2; ++i__) {
01119                     if (i__ < 1) {
01120                         a[j - i__ + 1 + (i__ + *n) * a_dim1] = 0.f;
01121                     } else {
01122                         a[j - i__ + 1 + i__ * a_dim1] = slatm2_(m, n, &i__, &
01123                                 j, kl, ku, &idist, &iseed[1], &d__[1], &
01124                                 igrade, &dl[1], &dr[1], &ipvtng, &iwork[1], 
01125                                 sparse);
01126                     }
01127 /* L430: */
01128                 }
01129 /* L440: */
01130             }
01131 
01132         } else if (ipack == 6) {
01133 
01134             i__1 = *n;
01135             for (j = 1; j <= i__1; ++j) {
01136                 i__2 = j;
01137                 for (i__ = j - kuu; i__ <= i__2; ++i__) {
01138                     a[i__ - j + kuu + 1 + j * a_dim1] = slatm2_(m, n, &i__, &
01139                             j, kl, ku, &idist, &iseed[1], &d__[1], &igrade, &
01140                             dl[1], &dr[1], &ipvtng, &iwork[1], sparse);
01141 /* L450: */
01142                 }
01143 /* L460: */
01144             }
01145 
01146         } else if (ipack == 7) {
01147 
01148             if (isym == 0) {
01149                 i__1 = *n;
01150                 for (j = 1; j <= i__1; ++j) {
01151                     i__2 = j;
01152                     for (i__ = j - kuu; i__ <= i__2; ++i__) {
01153                         a[i__ - j + kuu + 1 + j * a_dim1] = slatm2_(m, n, &
01154                                 i__, &j, kl, ku, &idist, &iseed[1], &d__[1], &
01155                                 igrade, &dl[1], &dr[1], &ipvtng, &iwork[1], 
01156                                 sparse);
01157                         if (i__ < 1) {
01158                             a[j - i__ + 1 + kuu + (i__ + *n) * a_dim1] = 0.f;
01159                         }
01160                         if (i__ >= 1 && i__ != j) {
01161                             a[j - i__ + 1 + kuu + i__ * a_dim1] = a[i__ - j + 
01162                                     kuu + 1 + j * a_dim1];
01163                         }
01164 /* L470: */
01165                     }
01166 /* L480: */
01167                 }
01168             } else if (isym == 1) {
01169                 i__1 = *n;
01170                 for (j = 1; j <= i__1; ++j) {
01171                     i__2 = j + kll;
01172                     for (i__ = j - kuu; i__ <= i__2; ++i__) {
01173                         a[i__ - j + kuu + 1 + j * a_dim1] = slatm2_(m, n, &
01174                                 i__, &j, kl, ku, &idist, &iseed[1], &d__[1], &
01175                                 igrade, &dl[1], &dr[1], &ipvtng, &iwork[1], 
01176                                 sparse);
01177 /* L490: */
01178                     }
01179 /* L500: */
01180                 }
01181             }
01182 
01183         }
01184 
01185     }
01186 
01187 /*     5)      Scaling the norm */
01188 
01189     if (ipack == 0) {
01190         onorm = slange_("M", m, n, &a[a_offset], lda, tempa);
01191     } else if (ipack == 1) {
01192         onorm = slansy_("M", "U", n, &a[a_offset], lda, tempa);
01193     } else if (ipack == 2) {
01194         onorm = slansy_("M", "L", n, &a[a_offset], lda, tempa);
01195     } else if (ipack == 3) {
01196         onorm = slansp_("M", "U", n, &a[a_offset], tempa);
01197     } else if (ipack == 4) {
01198         onorm = slansp_("M", "L", n, &a[a_offset], tempa);
01199     } else if (ipack == 5) {
01200         onorm = slansb_("M", "L", n, &kll, &a[a_offset], lda, tempa);
01201     } else if (ipack == 6) {
01202         onorm = slansb_("M", "U", n, &kuu, &a[a_offset], lda, tempa);
01203     } else if (ipack == 7) {
01204         onorm = slangb_("M", n, &kll, &kuu, &a[a_offset], lda, tempa);
01205     }
01206 
01207     if (*anorm >= 0.f) {
01208 
01209         if (*anorm > 0.f && onorm == 0.f) {
01210 
01211 /*           Desired scaling impossible */
01212 
01213             *info = 5;
01214             return 0;
01215 
01216         } else if (*anorm > 1.f && onorm < 1.f || *anorm < 1.f && onorm > 1.f)
01217                  {
01218 
01219 /*           Scale carefully to avoid over / underflow */
01220 
01221             if (ipack <= 2) {
01222                 i__1 = *n;
01223                 for (j = 1; j <= i__1; ++j) {
01224                     r__1 = 1.f / onorm;
01225                     sscal_(m, &r__1, &a[j * a_dim1 + 1], &c__1);
01226                     sscal_(m, anorm, &a[j * a_dim1 + 1], &c__1);
01227 /* L510: */
01228                 }
01229 
01230             } else if (ipack == 3 || ipack == 4) {
01231 
01232                 i__1 = *n * (*n + 1) / 2;
01233                 r__1 = 1.f / onorm;
01234                 sscal_(&i__1, &r__1, &a[a_offset], &c__1);
01235                 i__1 = *n * (*n + 1) / 2;
01236                 sscal_(&i__1, anorm, &a[a_offset], &c__1);
01237 
01238             } else if (ipack >= 5) {
01239 
01240                 i__1 = *n;
01241                 for (j = 1; j <= i__1; ++j) {
01242                     i__2 = kll + kuu + 1;
01243                     r__1 = 1.f / onorm;
01244                     sscal_(&i__2, &r__1, &a[j * a_dim1 + 1], &c__1);
01245                     i__2 = kll + kuu + 1;
01246                     sscal_(&i__2, anorm, &a[j * a_dim1 + 1], &c__1);
01247 /* L520: */
01248                 }
01249 
01250             }
01251 
01252         } else {
01253 
01254 /*           Scale straightforwardly */
01255 
01256             if (ipack <= 2) {
01257                 i__1 = *n;
01258                 for (j = 1; j <= i__1; ++j) {
01259                     r__1 = *anorm / onorm;
01260                     sscal_(m, &r__1, &a[j * a_dim1 + 1], &c__1);
01261 /* L530: */
01262                 }
01263 
01264             } else if (ipack == 3 || ipack == 4) {
01265 
01266                 i__1 = *n * (*n + 1) / 2;
01267                 r__1 = *anorm / onorm;
01268                 sscal_(&i__1, &r__1, &a[a_offset], &c__1);
01269 
01270             } else if (ipack >= 5) {
01271 
01272                 i__1 = *n;
01273                 for (j = 1; j <= i__1; ++j) {
01274                     i__2 = kll + kuu + 1;
01275                     r__1 = *anorm / onorm;
01276                     sscal_(&i__2, &r__1, &a[j * a_dim1 + 1], &c__1);
01277 /* L540: */
01278                 }
01279             }
01280 
01281         }
01282 
01283     }
01284 
01285 /*     End of SLATMR */
01286 
01287     return 0;
01288 } /* slatmr_ */


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