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


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