LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine slatmr ( integer  M,
integer  N,
character  DIST,
integer, dimension( 4 )  ISEED,
character  SYM,
real, dimension( * )  D,
integer  MODE,
real  COND,
real  DMAX,
character  RSIGN,
character  GRADE,
real, dimension( * )  DL,
integer  MODEL,
real  CONDL,
real, dimension( * )  DR,
integer  MODER,
real  CONDR,
character  PIVTNG,
integer, dimension( * )  IPIVOT,
integer  KL,
integer  KU,
real  SPARSE,
real  ANORM,
character  PACK,
real, dimension( lda, * )  A,
integer  LDA,
integer, dimension( * )  IWORK,
integer  INFO 
)

SLATMR

Purpose:
    SLATMR generates random matrices of various types for testing
    LAPACK programs.

    SLATMR operates by applying the following sequence of
    operations:

      Generate a matrix A with random entries of distribution DIST
         which is symmetric if SYM='S', and nonsymmetric
         if SYM='N'.

      Set the diagonal to D, where D may be input or
         computed according to MODE, COND, DMAX and RSIGN
         as described below.

      Grade the matrix, if desired, from the left and/or right
         as specified by GRADE. The inputs DL, MODEL, CONDL, DR,
         MODER and CONDR also determine the grading as described
         below.

      Permute, if desired, the rows and/or columns as specified by
         PIVTNG and IPIVOT.

      Set random entries to zero, if desired, to get a random sparse
         matrix as specified by SPARSE.

      Make A a band matrix, if desired, by zeroing out the matrix
         outside a band of lower bandwidth KL and upper bandwidth KU.

      Scale A, if desired, to have maximum entry ANORM.

      Pack the matrix if desired. Options specified by PACK are:
         no packing
         zero out upper half (if symmetric)
         zero out lower half (if symmetric)
         store the upper half columnwise (if symmetric or
             square upper triangular)
         store the lower half columnwise (if symmetric or
             square lower triangular)
             same as upper half rowwise if symmetric
         store the lower triangle in banded format (if symmetric)
         store the upper triangle in banded format (if symmetric)
         store the entire matrix in banded format

    Note: If two calls to SLATMR differ only in the PACK parameter,
          they will generate mathematically equivalent matrices.

          If two calls to SLATMR both have full bandwidth (KL = M-1
          and KU = N-1), and differ only in the PIVTNG and PACK
          parameters, then the matrices generated will differ only
          in the order of the rows and/or columns, and otherwise
          contain the same data. This consistency cannot be and
          is not maintained with less than full bandwidth.
Parameters
[in]M
          M is INTEGER
           Number of rows of A. Not modified.
[in]N
          N is INTEGER
           Number of columns of A. Not modified.
[in]DIST
          DIST is CHARACTER*1
           On entry, DIST specifies the type of distribution to be used
           to generate a random matrix .
           'U' => UNIFORM( 0, 1 )  ( 'U' for uniform )
           'S' => UNIFORM( -1, 1 ) ( 'S' for symmetric )
           'N' => NORMAL( 0, 1 )   ( 'N' for normal )
           Not modified.
[in,out]ISEED
          ISEED is INTEGER array, dimension (4)
           On entry ISEED specifies the seed of the random number
           generator. They should lie between 0 and 4095 inclusive,
           and ISEED(4) should be odd. The random number generator
           uses a linear congruential sequence limited to small
           integers, and so should produce machine independent
           random numbers. The values of ISEED are changed on
           exit, and can be used in the next call to SLATMR
           to continue the same random number sequence.
           Changed on exit.
[in]SYM
          SYM is CHARACTER*1
           If SYM='S' or 'H', generated matrix is symmetric.
           If SYM='N', generated matrix is nonsymmetric.
           Not modified.
[in]D
          D is REAL array, dimension (min(M,N))
           On entry this array specifies the diagonal entries
           of the diagonal of A.  D may either be specified
           on entry, or set according to MODE and COND as described
           below. May be changed on exit if MODE is nonzero.
[in]MODE
          MODE is INTEGER
           On entry describes how D is to be used:
           MODE = 0 means use D as input
           MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND
           MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND
           MODE = 3 sets D(I)=COND**(-(I-1)/(N-1))
           MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND)
           MODE = 5 sets D to random numbers in the range
                    ( 1/COND , 1 ) such that their logarithms
                    are uniformly distributed.
           MODE = 6 set D to random numbers from same distribution
                    as the rest of the matrix.
           MODE < 0 has the same meaning as ABS(MODE), except that
              the order of the elements of D is reversed.
           Thus if MODE is positive, D has entries ranging from
              1 to 1/COND, if negative, from 1/COND to 1,
           Not modified.
[in]COND
          COND is REAL
           On entry, used as described under MODE above.
           If used, it must be >= 1. Not modified.
[in]DMAX
          DMAX is REAL
           If MODE neither -6, 0 nor 6, the diagonal is scaled by
           DMAX / max(abs(D(i))), so that maximum absolute entry
           of diagonal is abs(DMAX). If DMAX is negative (or zero),
           diagonal will be scaled by a negative number (or zero).
[in]RSIGN
          RSIGN is CHARACTER*1
           If MODE neither -6, 0 nor 6, specifies sign of diagonal
           as follows:
           'T' => diagonal entries are multiplied by 1 or -1
                  with probability .5
           'F' => diagonal unchanged
           Not modified.
[in]GRADE
          GRADE is CHARACTER*1
           Specifies grading of matrix as follows:
           'N'  => no grading
           'L'  => matrix premultiplied by diag( DL )
                   (only if matrix nonsymmetric)
           'R'  => matrix postmultiplied by diag( DR )
                   (only if matrix nonsymmetric)
           'B'  => matrix premultiplied by diag( DL ) and
                         postmultiplied by diag( DR )
                   (only if matrix nonsymmetric)
           'S' or 'H'  => matrix premultiplied by diag( DL ) and
                          postmultiplied by diag( DL )
                          ('S' for symmetric, or 'H' for Hermitian)
           'E'  => matrix premultiplied by diag( DL ) and
                         postmultiplied by inv( diag( DL ) )
                         ( 'E' for eigenvalue invariance)
                   (only if matrix nonsymmetric)
                   Note: if GRADE='E', then M must equal N.
           Not modified.
[in,out]DL
          DL is REAL array, dimension (M)
           If MODEL=0, then on entry this array specifies the diagonal
           entries of a diagonal matrix used as described under GRADE
           above. If MODEL is not zero, then DL will be set according
           to MODEL and CONDL, analogous to the way D is set according
           to MODE and COND (except there is no DMAX parameter for DL).
           If GRADE='E', then DL cannot have zero entries.
           Not referenced if GRADE = 'N' or 'R'. Changed on exit.
[in]MODEL
          MODEL is INTEGER
           This specifies how the diagonal array DL is to be computed,
           just as MODE specifies how D is to be computed.
           Not modified.
[in]CONDL
          CONDL is REAL
           When MODEL is not zero, this specifies the condition number
           of the computed DL.  Not modified.
[in,out]DR
          DR is REAL array, dimension (N)
           If MODER=0, then on entry this array specifies the diagonal
           entries of a diagonal matrix used as described under GRADE
           above. If MODER is not zero, then DR will be set according
           to MODER and CONDR, analogous to the way D is set according
           to MODE and COND (except there is no DMAX parameter for DR).
           Not referenced if GRADE = 'N', 'L', 'H', 'S' or 'E'.
           Changed on exit.
[in]MODER
          MODER is INTEGER
           This specifies how the diagonal array DR is to be computed,
           just as MODE specifies how D is to be computed.
           Not modified.
[in]CONDR
          CONDR is REAL
           When MODER is not zero, this specifies the condition number
           of the computed DR.  Not modified.
[in]PIVTNG
          PIVTNG is CHARACTER*1
           On entry specifies pivoting permutations as follows:
           'N' or ' ' => none.
           'L' => left or row pivoting (matrix must be nonsymmetric).
           'R' => right or column pivoting (matrix must be
                  nonsymmetric).
           'B' or 'F' => both or full pivoting, i.e., on both sides.
                         In this case, M must equal N

           If two calls to SLATMR both have full bandwidth (KL = M-1
           and KU = N-1), and differ only in the PIVTNG and PACK
           parameters, then the matrices generated will differ only
           in the order of the rows and/or columns, and otherwise
           contain the same data. This consistency cannot be
           maintained with less than full bandwidth.
[in]IPIVOT
          IPIVOT is INTEGER array, dimension (N or M)
           This array specifies the permutation used.  After the
           basic matrix is generated, the rows, columns, or both
           are permuted.   If, say, row pivoting is selected, SLATMR
           starts with the *last* row and interchanges the M-th and
           IPIVOT(M)-th rows, then moves to the next-to-last row,
           interchanging the (M-1)-th and the IPIVOT(M-1)-th rows,
           and so on.  In terms of "2-cycles", the permutation is
           (1 IPIVOT(1)) (2 IPIVOT(2)) ... (M IPIVOT(M))
           where the rightmost cycle is applied first.  This is the
           *inverse* of the effect of pivoting in LINPACK.  The idea
           is that factoring (with pivoting) an identity matrix
           which has been inverse-pivoted in this way should
           result in a pivot vector identical to IPIVOT.
           Not referenced if PIVTNG = 'N'. Not modified.
[in]SPARSE
          SPARSE is REAL
           On entry specifies the sparsity of the matrix if a sparse
           matrix is to be generated. SPARSE should lie between
           0 and 1. To generate a sparse matrix, for each matrix entry
           a uniform ( 0, 1 ) random number x is generated and
           compared to SPARSE; if x is larger the matrix entry
           is unchanged and if x is smaller the entry is set
           to zero. Thus on the average a fraction SPARSE of the
           entries will be set to zero.
           Not modified.
[in]KL
          KL is INTEGER
           On entry specifies the lower bandwidth of the  matrix. For
           example, KL=0 implies upper triangular, KL=1 implies upper
           Hessenberg, and KL at least M-1 implies the matrix is not
           banded. Must equal KU if matrix is symmetric.
           Not modified.
[in]KU
          KU is INTEGER
           On entry specifies the upper bandwidth of the  matrix. For
           example, KU=0 implies lower triangular, KU=1 implies lower
           Hessenberg, and KU at least N-1 implies the matrix is not
           banded. Must equal KL if matrix is symmetric.
           Not modified.
[in]ANORM
          ANORM is REAL
           On entry specifies maximum entry of output matrix
           (output matrix will by multiplied by a constant so that
           its largest absolute entry equal ANORM)
           if ANORM is nonnegative. If ANORM is negative no scaling
           is done. Not modified.
[in]PACK
          PACK is CHARACTER*1
           On entry specifies packing of matrix as follows:
           'N' => no packing
           'U' => zero out all subdiagonal entries (if symmetric)
           'L' => zero out all superdiagonal entries (if symmetric)
           'C' => store the upper triangle columnwise
                  (only if matrix symmetric or square upper triangular)
           'R' => store the lower triangle columnwise
                  (only if matrix symmetric or square lower triangular)
                  (same as upper half rowwise if symmetric)
           'B' => store the lower triangle in band storage scheme
                  (only if matrix symmetric)
           'Q' => store the upper triangle in band storage scheme
                  (only if matrix symmetric)
           'Z' => store the entire matrix in band storage scheme
                      (pivoting can be provided for by using this
                      option to store A in the trailing rows of
                      the allocated storage)

           Using these options, the various LAPACK packed and banded
           storage schemes can be obtained:
           GB               - use 'Z'
           PB, SB or TB     - use 'B' or 'Q'
           PP, SP or TP     - use 'C' or 'R'

           If two calls to SLATMR differ only in the PACK parameter,
           they will generate mathematically equivalent matrices.
           Not modified.
[in,out]A
          A is REAL array, dimension (LDA,N)
           On exit A is the desired test matrix. Only those
           entries of A which are significant on output
           will be referenced (even if A is in packed or band
           storage format). The 'unoccupied corners' of A in
           band format will be zeroed out.
[in]LDA
          LDA is INTEGER
           on entry LDA specifies the first dimension of A as
           declared in the calling program.
           If PACK='N', 'U' or 'L', LDA must be at least max ( 1, M ).
           If PACK='C' or 'R', LDA must be at least 1.
           If PACK='B', or 'Q', LDA must be MIN ( KU+1, N )
           If PACK='Z', LDA must be at least KUU+KLL+1, where
           KUU = MIN ( KU, N-1 ) and KLL = MIN ( KL, N-1 )
           Not modified.
[out]IWORK
          IWORK is INTEGER array, dimension ( N or M)
           Workspace. Not referenced if PIVTNG = 'N'. Changed on exit.
[out]INFO
          INFO is INTEGER
           Error parameter on exit:
             0 => normal return
            -1 => M negative or unequal to N and SYM='S' or 'H'
            -2 => N negative
            -3 => DIST illegal string
            -5 => SYM illegal string
            -7 => MODE not in range -6 to 6
            -8 => COND less than 1.0, and MODE neither -6, 0 nor 6
           -10 => MODE neither -6, 0 nor 6 and RSIGN illegal string
           -11 => GRADE illegal string, or GRADE='E' and
                  M not equal to N, or GRADE='L', 'R', 'B' or 'E' and
                  SYM = 'S' or 'H'
           -12 => GRADE = 'E' and DL contains zero
           -13 => MODEL not in range -6 to 6 and GRADE= 'L', 'B', 'H',
                  'S' or 'E'
           -14 => CONDL less than 1.0, GRADE='L', 'B', 'H', 'S' or 'E',
                  and MODEL neither -6, 0 nor 6
           -16 => MODER not in range -6 to 6 and GRADE= 'R' or 'B'
           -17 => CONDR less than 1.0, GRADE='R' or 'B', and
                  MODER neither -6, 0 nor 6
           -18 => PIVTNG illegal string, or PIVTNG='B' or 'F' and
                  M not equal to N, or PIVTNG='L' or 'R' and SYM='S'
                  or 'H'
           -19 => IPIVOT contains out of range number and
                  PIVTNG not equal to 'N'
           -20 => KL negative
           -21 => KU negative, or SYM='S' or 'H' and KU not equal to KL
           -22 => SPARSE not in range 0. to 1.
           -24 => PACK illegal string, or PACK='U', 'L', 'B' or 'Q'
                  and SYM='N', or PACK='C' and SYM='N' and either KL
                  not equal to 0 or N not equal to M, or PACK='R' and
                  SYM='N', and either KU not equal to 0 or N not equal
                  to M
           -26 => LDA too small
             1 => Error return from SLATM1 (computing D)
             2 => Cannot scale diagonal to DMAX (max. entry is 0)
             3 => Error return from SLATM1 (computing DL)
             4 => Error return from SLATM1 (computing DR)
             5 => ANORM is positive, but matrix constructed prior to
                  attempting to scale it to have norm ANORM, is zero
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 473 of file slatmr.f.

473 *
474 * -- LAPACK computational routine (version 3.4.0) --
475 * -- LAPACK is a software package provided by Univ. of Tennessee, --
476 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
477 * November 2011
478 *
479 * .. Scalar Arguments ..
480  CHARACTER dist, grade, pack, pivtng, rsign, sym
481  INTEGER info, kl, ku, lda, m, mode, model, moder, n
482  REAL anorm, cond, condl, condr, dmax, sparse
483 * ..
484 * .. Array Arguments ..
485  INTEGER ipivot( * ), iseed( 4 ), iwork( * )
486  REAL a( lda, * ), d( * ), dl( * ), dr( * )
487 * ..
488 *
489 * =====================================================================
490 *
491 * .. Parameters ..
492  REAL zero
493  parameter ( zero = 0.0e0 )
494  REAL one
495  parameter ( one = 1.0e0 )
496 * ..
497 * .. Local Scalars ..
498  LOGICAL badpvt, dzero, fulbnd
499  INTEGER i, idist, igrade, iisub, ipack, ipvtng, irsign,
500  $ isub, isym, j, jjsub, jsub, k, kll, kuu, mnmin,
501  $ mnsub, mxsub, npvts
502  REAL alpha, onorm, temp
503 * ..
504 * .. Local Arrays ..
505  REAL tempa( 1 )
506 * ..
507 * .. External Functions ..
508  LOGICAL lsame
510  $ slatm3
511  EXTERNAL lsame, slangb, slange, slansb, slansp, slansy,
512  $ slatm2, slatm3
513 * ..
514 * .. External Subroutines ..
515  EXTERNAL slatm1, sscal, xerbla
516 * ..
517 * .. Intrinsic Functions ..
518  INTRINSIC abs, max, min, mod
519 * ..
520 * .. Executable Statements ..
521 *
522 * 1) Decode and Test the input parameters.
523 * Initialize flags & seed.
524 *
525  info = 0
526 *
527 * Quick return if possible
528 *
529  IF( m.EQ.0 .OR. n.EQ.0 )
530  $ RETURN
531 *
532 * Decode DIST
533 *
534  IF( lsame( dist, 'U' ) ) THEN
535  idist = 1
536  ELSE IF( lsame( dist, 'S' ) ) THEN
537  idist = 2
538  ELSE IF( lsame( dist, 'N' ) ) THEN
539  idist = 3
540  ELSE
541  idist = -1
542  END IF
543 *
544 * Decode SYM
545 *
546  IF( lsame( sym, 'S' ) ) THEN
547  isym = 0
548  ELSE IF( lsame( sym, 'N' ) ) THEN
549  isym = 1
550  ELSE IF( lsame( sym, 'H' ) ) THEN
551  isym = 0
552  ELSE
553  isym = -1
554  END IF
555 *
556 * Decode RSIGN
557 *
558  IF( lsame( rsign, 'F' ) ) THEN
559  irsign = 0
560  ELSE IF( lsame( rsign, 'T' ) ) THEN
561  irsign = 1
562  ELSE
563  irsign = -1
564  END IF
565 *
566 * Decode PIVTNG
567 *
568  IF( lsame( pivtng, 'N' ) ) THEN
569  ipvtng = 0
570  ELSE IF( lsame( pivtng, ' ' ) ) THEN
571  ipvtng = 0
572  ELSE IF( lsame( pivtng, 'L' ) ) THEN
573  ipvtng = 1
574  npvts = m
575  ELSE IF( lsame( pivtng, 'R' ) ) THEN
576  ipvtng = 2
577  npvts = n
578  ELSE IF( lsame( pivtng, 'B' ) ) THEN
579  ipvtng = 3
580  npvts = min( n, m )
581  ELSE IF( lsame( pivtng, 'F' ) ) THEN
582  ipvtng = 3
583  npvts = min( n, m )
584  ELSE
585  ipvtng = -1
586  END IF
587 *
588 * Decode GRADE
589 *
590  IF( lsame( grade, 'N' ) ) THEN
591  igrade = 0
592  ELSE IF( lsame( grade, 'L' ) ) THEN
593  igrade = 1
594  ELSE IF( lsame( grade, 'R' ) ) THEN
595  igrade = 2
596  ELSE IF( lsame( grade, 'B' ) ) THEN
597  igrade = 3
598  ELSE IF( lsame( grade, 'E' ) ) THEN
599  igrade = 4
600  ELSE IF( lsame( grade, 'H' ) .OR. lsame( grade, 'S' ) ) THEN
601  igrade = 5
602  ELSE
603  igrade = -1
604  END IF
605 *
606 * Decode PACK
607 *
608  IF( lsame( pack, 'N' ) ) THEN
609  ipack = 0
610  ELSE IF( lsame( pack, 'U' ) ) THEN
611  ipack = 1
612  ELSE IF( lsame( pack, 'L' ) ) THEN
613  ipack = 2
614  ELSE IF( lsame( pack, 'C' ) ) THEN
615  ipack = 3
616  ELSE IF( lsame( pack, 'R' ) ) THEN
617  ipack = 4
618  ELSE IF( lsame( pack, 'B' ) ) THEN
619  ipack = 5
620  ELSE IF( lsame( pack, 'Q' ) ) THEN
621  ipack = 6
622  ELSE IF( lsame( pack, 'Z' ) ) THEN
623  ipack = 7
624  ELSE
625  ipack = -1
626  END IF
627 *
628 * Set certain internal parameters
629 *
630  mnmin = min( m, n )
631  kll = min( kl, m-1 )
632  kuu = min( ku, n-1 )
633 *
634 * If inv(DL) is used, check to see if DL has a zero entry.
635 *
636  dzero = .false.
637  IF( igrade.EQ.4 .AND. model.EQ.0 ) THEN
638  DO 10 i = 1, m
639  IF( dl( i ).EQ.zero )
640  $ dzero = .true.
641  10 CONTINUE
642  END IF
643 *
644 * Check values in IPIVOT
645 *
646  badpvt = .false.
647  IF( ipvtng.GT.0 ) THEN
648  DO 20 j = 1, npvts
649  IF( ipivot( j ).LE.0 .OR. ipivot( j ).GT.npvts )
650  $ badpvt = .true.
651  20 CONTINUE
652  END IF
653 *
654 * Set INFO if an error
655 *
656  IF( m.LT.0 ) THEN
657  info = -1
658  ELSE IF( m.NE.n .AND. isym.EQ.0 ) THEN
659  info = -1
660  ELSE IF( n.LT.0 ) THEN
661  info = -2
662  ELSE IF( idist.EQ.-1 ) THEN
663  info = -3
664  ELSE IF( isym.EQ.-1 ) THEN
665  info = -5
666  ELSE IF( mode.LT.-6 .OR. mode.GT.6 ) THEN
667  info = -7
668  ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
669  $ cond.LT.one ) THEN
670  info = -8
671  ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
672  $ irsign.EQ.-1 ) THEN
673  info = -10
674  ELSE IF( igrade.EQ.-1 .OR. ( igrade.EQ.4 .AND. m.NE.n ) .OR.
675  $ ( ( igrade.GE.1 .AND. igrade.LE.4 ) .AND. isym.EQ.0 ) )
676  $ THEN
677  info = -11
678  ELSE IF( igrade.EQ.4 .AND. dzero ) THEN
679  info = -12
680  ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
681  $ igrade.EQ.5 ) .AND. ( model.LT.-6 .OR. model.GT.6 ) )
682  $ THEN
683  info = -13
684  ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
685  $ igrade.EQ.5 ) .AND. ( model.NE.-6 .AND. model.NE.0 .AND.
686  $ model.NE.6 ) .AND. condl.LT.one ) THEN
687  info = -14
688  ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
689  $ ( moder.LT.-6 .OR. moder.GT.6 ) ) THEN
690  info = -16
691  ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
692  $ ( moder.NE.-6 .AND. moder.NE.0 .AND. moder.NE.6 ) .AND.
693  $ condr.LT.one ) THEN
694  info = -17
695  ELSE IF( ipvtng.EQ.-1 .OR. ( ipvtng.EQ.3 .AND. m.NE.n ) .OR.
696  $ ( ( ipvtng.EQ.1 .OR. ipvtng.EQ.2 ) .AND. isym.EQ.0 ) )
697  $ THEN
698  info = -18
699  ELSE IF( ipvtng.NE.0 .AND. badpvt ) THEN
700  info = -19
701  ELSE IF( kl.LT.0 ) THEN
702  info = -20
703  ELSE IF( ku.LT.0 .OR. ( isym.EQ.0 .AND. kl.NE.ku ) ) THEN
704  info = -21
705  ELSE IF( sparse.LT.zero .OR. sparse.GT.one ) THEN
706  info = -22
707  ELSE IF( ipack.EQ.-1 .OR. ( ( ipack.EQ.1 .OR. ipack.EQ.2 .OR.
708  $ ipack.EQ.5 .OR. ipack.EQ.6 ) .AND. isym.EQ.1 ) .OR.
709  $ ( ipack.EQ.3 .AND. isym.EQ.1 .AND. ( kl.NE.0 .OR. m.NE.
710  $ n ) ) .OR. ( ipack.EQ.4 .AND. isym.EQ.1 .AND. ( ku.NE.
711  $ 0 .OR. m.NE.n ) ) ) THEN
712  info = -24
713  ELSE IF( ( ( ipack.EQ.0 .OR. ipack.EQ.1 .OR. ipack.EQ.2 ) .AND.
714  $ lda.LT.max( 1, m ) ) .OR. ( ( ipack.EQ.3 .OR. ipack.EQ.
715  $ 4 ) .AND. lda.LT.1 ) .OR. ( ( ipack.EQ.5 .OR. ipack.EQ.
716  $ 6 ) .AND. lda.LT.kuu+1 ) .OR.
717  $ ( ipack.EQ.7 .AND. lda.LT.kll+kuu+1 ) ) THEN
718  info = -26
719  END IF
720 *
721  IF( info.NE.0 ) THEN
722  CALL xerbla( 'SLATMR', -info )
723  RETURN
724  END IF
725 *
726 * Decide if we can pivot consistently
727 *
728  fulbnd = .false.
729  IF( kuu.EQ.n-1 .AND. kll.EQ.m-1 )
730  $ fulbnd = .true.
731 *
732 * Initialize random number generator
733 *
734  DO 30 i = 1, 4
735  iseed( i ) = mod( abs( iseed( i ) ), 4096 )
736  30 CONTINUE
737 *
738  iseed( 4 ) = 2*( iseed( 4 ) / 2 ) + 1
739 *
740 * 2) Set up D, DL, and DR, if indicated.
741 *
742 * Compute D according to COND and MODE
743 *
744  CALL slatm1( mode, cond, irsign, idist, iseed, d, mnmin, info )
745  IF( info.NE.0 ) THEN
746  info = 1
747  RETURN
748  END IF
749  IF( mode.NE.0 .AND. mode.NE.-6 .AND. mode.NE.6 ) THEN
750 *
751 * Scale by DMAX
752 *
753  temp = abs( d( 1 ) )
754  DO 40 i = 2, mnmin
755  temp = max( temp, abs( d( i ) ) )
756  40 CONTINUE
757  IF( temp.EQ.zero .AND. dmax.NE.zero ) THEN
758  info = 2
759  RETURN
760  END IF
761  IF( temp.NE.zero ) THEN
762  alpha = dmax / temp
763  ELSE
764  alpha = one
765  END IF
766  DO 50 i = 1, mnmin
767  d( i ) = alpha*d( i )
768  50 CONTINUE
769 *
770  END IF
771 *
772 * Compute DL if grading set
773 *
774  IF( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR. igrade.EQ.
775  $ 5 ) THEN
776  CALL slatm1( model, condl, 0, idist, iseed, dl, m, info )
777  IF( info.NE.0 ) THEN
778  info = 3
779  RETURN
780  END IF
781  END IF
782 *
783 * Compute DR if grading set
784 *
785  IF( igrade.EQ.2 .OR. igrade.EQ.3 ) THEN
786  CALL slatm1( moder, condr, 0, idist, iseed, dr, n, info )
787  IF( info.NE.0 ) THEN
788  info = 4
789  RETURN
790  END IF
791  END IF
792 *
793 * 3) Generate IWORK if pivoting
794 *
795  IF( ipvtng.GT.0 ) THEN
796  DO 60 i = 1, npvts
797  iwork( i ) = i
798  60 CONTINUE
799  IF( fulbnd ) THEN
800  DO 70 i = 1, npvts
801  k = ipivot( i )
802  j = iwork( i )
803  iwork( i ) = iwork( k )
804  iwork( k ) = j
805  70 CONTINUE
806  ELSE
807  DO 80 i = npvts, 1, -1
808  k = ipivot( i )
809  j = iwork( i )
810  iwork( i ) = iwork( k )
811  iwork( k ) = j
812  80 CONTINUE
813  END IF
814  END IF
815 *
816 * 4) Generate matrices for each kind of PACKing
817 * Always sweep matrix columnwise (if symmetric, upper
818 * half only) so that matrix generated does not depend
819 * on PACK
820 *
821  IF( fulbnd ) THEN
822 *
823 * Use SLATM3 so matrices generated with differing PIVOTing only
824 * differ only in the order of their rows and/or columns.
825 *
826  IF( ipack.EQ.0 ) THEN
827  IF( isym.EQ.0 ) THEN
828  DO 100 j = 1, n
829  DO 90 i = 1, j
830  temp = slatm3( m, n, i, j, isub, jsub, kl, ku,
831  $ idist, iseed, d, igrade, dl, dr, ipvtng,
832  $ iwork, sparse )
833  a( isub, jsub ) = temp
834  a( jsub, isub ) = temp
835  90 CONTINUE
836  100 CONTINUE
837  ELSE IF( isym.EQ.1 ) THEN
838  DO 120 j = 1, n
839  DO 110 i = 1, m
840  temp = slatm3( m, n, i, j, isub, jsub, kl, ku,
841  $ idist, iseed, d, igrade, dl, dr, ipvtng,
842  $ iwork, sparse )
843  a( isub, jsub ) = temp
844  110 CONTINUE
845  120 CONTINUE
846  END IF
847 *
848  ELSE IF( ipack.EQ.1 ) THEN
849 *
850  DO 140 j = 1, n
851  DO 130 i = 1, j
852  temp = slatm3( m, n, i, j, isub, jsub, kl, ku, idist,
853  $ iseed, d, igrade, dl, dr, ipvtng, iwork,
854  $ sparse )
855  mnsub = min( isub, jsub )
856  mxsub = max( isub, jsub )
857  a( mnsub, mxsub ) = temp
858  IF( mnsub.NE.mxsub )
859  $ a( mxsub, mnsub ) = zero
860  130 CONTINUE
861  140 CONTINUE
862 *
863  ELSE IF( ipack.EQ.2 ) THEN
864 *
865  DO 160 j = 1, n
866  DO 150 i = 1, j
867  temp = slatm3( m, n, i, j, isub, jsub, kl, ku, idist,
868  $ iseed, d, igrade, dl, dr, ipvtng, iwork,
869  $ sparse )
870  mnsub = min( isub, jsub )
871  mxsub = max( isub, jsub )
872  a( mxsub, mnsub ) = temp
873  IF( mnsub.NE.mxsub )
874  $ a( mnsub, mxsub ) = zero
875  150 CONTINUE
876  160 CONTINUE
877 *
878  ELSE IF( ipack.EQ.3 ) THEN
879 *
880  DO 180 j = 1, n
881  DO 170 i = 1, j
882  temp = slatm3( m, n, i, j, isub, jsub, kl, ku, idist,
883  $ iseed, d, igrade, dl, dr, ipvtng, iwork,
884  $ sparse )
885 *
886 * Compute K = location of (ISUB,JSUB) entry in packed
887 * array
888 *
889  mnsub = min( isub, jsub )
890  mxsub = max( isub, jsub )
891  k = mxsub*( mxsub-1 ) / 2 + mnsub
892 *
893 * Convert K to (IISUB,JJSUB) location
894 *
895  jjsub = ( k-1 ) / lda + 1
896  iisub = k - lda*( jjsub-1 )
897 *
898  a( iisub, jjsub ) = temp
899  170 CONTINUE
900  180 CONTINUE
901 *
902  ELSE IF( ipack.EQ.4 ) THEN
903 *
904  DO 200 j = 1, n
905  DO 190 i = 1, j
906  temp = slatm3( m, n, i, j, isub, jsub, kl, ku, idist,
907  $ iseed, d, igrade, dl, dr, ipvtng, iwork,
908  $ sparse )
909 *
910 * Compute K = location of (I,J) entry in packed array
911 *
912  mnsub = min( isub, jsub )
913  mxsub = max( isub, jsub )
914  IF( mnsub.EQ.1 ) THEN
915  k = mxsub
916  ELSE
917  k = n*( n+1 ) / 2 - ( n-mnsub+1 )*( n-mnsub+2 ) /
918  $ 2 + mxsub - mnsub + 1
919  END IF
920 *
921 * Convert K to (IISUB,JJSUB) location
922 *
923  jjsub = ( k-1 ) / lda + 1
924  iisub = k - lda*( jjsub-1 )
925 *
926  a( iisub, jjsub ) = temp
927  190 CONTINUE
928  200 CONTINUE
929 *
930  ELSE IF( ipack.EQ.5 ) THEN
931 *
932  DO 220 j = 1, n
933  DO 210 i = j - kuu, j
934  IF( i.LT.1 ) THEN
935  a( j-i+1, i+n ) = zero
936  ELSE
937  temp = slatm3( m, n, i, j, isub, jsub, kl, ku,
938  $ idist, iseed, d, igrade, dl, dr, ipvtng,
939  $ iwork, sparse )
940  mnsub = min( isub, jsub )
941  mxsub = max( isub, jsub )
942  a( mxsub-mnsub+1, mnsub ) = temp
943  END IF
944  210 CONTINUE
945  220 CONTINUE
946 *
947  ELSE IF( ipack.EQ.6 ) THEN
948 *
949  DO 240 j = 1, n
950  DO 230 i = j - kuu, j
951  temp = slatm3( m, n, i, j, isub, jsub, kl, ku, idist,
952  $ iseed, d, igrade, dl, dr, ipvtng, iwork,
953  $ sparse )
954  mnsub = min( isub, jsub )
955  mxsub = max( isub, jsub )
956  a( mnsub-mxsub+kuu+1, mxsub ) = temp
957  230 CONTINUE
958  240 CONTINUE
959 *
960  ELSE IF( ipack.EQ.7 ) THEN
961 *
962  IF( isym.EQ.0 ) THEN
963  DO 260 j = 1, n
964  DO 250 i = j - kuu, j
965  temp = slatm3( m, n, i, j, isub, jsub, kl, ku,
966  $ idist, iseed, d, igrade, dl, dr, ipvtng,
967  $ iwork, sparse )
968  mnsub = min( isub, jsub )
969  mxsub = max( isub, jsub )
970  a( mnsub-mxsub+kuu+1, mxsub ) = temp
971  IF( i.LT.1 )
972  $ a( j-i+1+kuu, i+n ) = zero
973  IF( i.GE.1 .AND. mnsub.NE.mxsub )
974  $ a( mxsub-mnsub+1+kuu, mnsub ) = temp
975  250 CONTINUE
976  260 CONTINUE
977  ELSE IF( isym.EQ.1 ) THEN
978  DO 280 j = 1, n
979  DO 270 i = j - kuu, j + kll
980  temp = slatm3( m, n, i, j, isub, jsub, kl, ku,
981  $ idist, iseed, d, igrade, dl, dr, ipvtng,
982  $ iwork, sparse )
983  a( isub-jsub+kuu+1, jsub ) = temp
984  270 CONTINUE
985  280 CONTINUE
986  END IF
987 *
988  END IF
989 *
990  ELSE
991 *
992 * Use SLATM2
993 *
994  IF( ipack.EQ.0 ) THEN
995  IF( isym.EQ.0 ) THEN
996  DO 300 j = 1, n
997  DO 290 i = 1, j
998  a( i, j ) = slatm2( m, n, i, j, kl, ku, idist,
999  $ iseed, d, igrade, dl, dr, ipvtng,
1000  $ iwork, sparse )
1001  a( j, i ) = a( i, j )
1002  290 CONTINUE
1003  300 CONTINUE
1004  ELSE IF( isym.EQ.1 ) THEN
1005  DO 320 j = 1, n
1006  DO 310 i = 1, m
1007  a( i, j ) = slatm2( m, n, i, j, kl, ku, idist,
1008  $ iseed, d, igrade, dl, dr, ipvtng,
1009  $ iwork, sparse )
1010  310 CONTINUE
1011  320 CONTINUE
1012  END IF
1013 *
1014  ELSE IF( ipack.EQ.1 ) THEN
1015 *
1016  DO 340 j = 1, n
1017  DO 330 i = 1, j
1018  a( i, j ) = slatm2( m, n, i, j, kl, ku, idist, iseed,
1019  $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1020  IF( i.NE.j )
1021  $ a( j, i ) = zero
1022  330 CONTINUE
1023  340 CONTINUE
1024 *
1025  ELSE IF( ipack.EQ.2 ) THEN
1026 *
1027  DO 360 j = 1, n
1028  DO 350 i = 1, j
1029  a( j, i ) = slatm2( m, n, i, j, kl, ku, idist, iseed,
1030  $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1031  IF( i.NE.j )
1032  $ a( i, j ) = zero
1033  350 CONTINUE
1034  360 CONTINUE
1035 *
1036  ELSE IF( ipack.EQ.3 ) THEN
1037 *
1038  isub = 0
1039  jsub = 1
1040  DO 380 j = 1, n
1041  DO 370 i = 1, j
1042  isub = isub + 1
1043  IF( isub.GT.lda ) THEN
1044  isub = 1
1045  jsub = jsub + 1
1046  END IF
1047  a( isub, jsub ) = slatm2( m, n, i, j, kl, ku, idist,
1048  $ iseed, d, igrade, dl, dr, ipvtng,
1049  $ iwork, sparse )
1050  370 CONTINUE
1051  380 CONTINUE
1052 *
1053  ELSE IF( ipack.EQ.4 ) THEN
1054 *
1055  IF( isym.EQ.0 ) THEN
1056  DO 400 j = 1, n
1057  DO 390 i = 1, j
1058 *
1059 * Compute K = location of (I,J) entry in packed array
1060 *
1061  IF( i.EQ.1 ) THEN
1062  k = j
1063  ELSE
1064  k = n*( n+1 ) / 2 - ( n-i+1 )*( n-i+2 ) / 2 +
1065  $ j - i + 1
1066  END IF
1067 *
1068 * Convert K to (ISUB,JSUB) location
1069 *
1070  jsub = ( k-1 ) / lda + 1
1071  isub = k - lda*( jsub-1 )
1072 *
1073  a( isub, jsub ) = slatm2( m, n, i, j, kl, ku,
1074  $ idist, iseed, d, igrade, dl, dr,
1075  $ ipvtng, iwork, sparse )
1076  390 CONTINUE
1077  400 CONTINUE
1078  ELSE
1079  isub = 0
1080  jsub = 1
1081  DO 420 j = 1, n
1082  DO 410 i = j, m
1083  isub = isub + 1
1084  IF( isub.GT.lda ) THEN
1085  isub = 1
1086  jsub = jsub + 1
1087  END IF
1088  a( isub, jsub ) = slatm2( m, n, i, j, kl, ku,
1089  $ idist, iseed, d, igrade, dl, dr,
1090  $ ipvtng, iwork, sparse )
1091  410 CONTINUE
1092  420 CONTINUE
1093  END IF
1094 *
1095  ELSE IF( ipack.EQ.5 ) THEN
1096 *
1097  DO 440 j = 1, n
1098  DO 430 i = j - kuu, j
1099  IF( i.LT.1 ) THEN
1100  a( j-i+1, i+n ) = zero
1101  ELSE
1102  a( j-i+1, i ) = slatm2( m, n, i, j, kl, ku, idist,
1103  $ iseed, d, igrade, dl, dr, ipvtng,
1104  $ iwork, sparse )
1105  END IF
1106  430 CONTINUE
1107  440 CONTINUE
1108 *
1109  ELSE IF( ipack.EQ.6 ) THEN
1110 *
1111  DO 460 j = 1, n
1112  DO 450 i = j - kuu, j
1113  a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku, idist,
1114  $ iseed, d, igrade, dl, dr, ipvtng,
1115  $ iwork, sparse )
1116  450 CONTINUE
1117  460 CONTINUE
1118 *
1119  ELSE IF( ipack.EQ.7 ) THEN
1120 *
1121  IF( isym.EQ.0 ) THEN
1122  DO 480 j = 1, n
1123  DO 470 i = j - kuu, j
1124  a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku,
1125  $ idist, iseed, d, igrade, dl,
1126  $ dr, ipvtng, iwork, sparse )
1127  IF( i.LT.1 )
1128  $ a( j-i+1+kuu, i+n ) = zero
1129  IF( i.GE.1 .AND. i.NE.j )
1130  $ a( j-i+1+kuu, i ) = a( i-j+kuu+1, j )
1131  470 CONTINUE
1132  480 CONTINUE
1133  ELSE IF( isym.EQ.1 ) THEN
1134  DO 500 j = 1, n
1135  DO 490 i = j - kuu, j + kll
1136  a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku,
1137  $ idist, iseed, d, igrade, dl,
1138  $ dr, ipvtng, iwork, sparse )
1139  490 CONTINUE
1140  500 CONTINUE
1141  END IF
1142 *
1143  END IF
1144 *
1145  END IF
1146 *
1147 * 5) Scaling the norm
1148 *
1149  IF( ipack.EQ.0 ) THEN
1150  onorm = slange( 'M', m, n, a, lda, tempa )
1151  ELSE IF( ipack.EQ.1 ) THEN
1152  onorm = slansy( 'M', 'U', n, a, lda, tempa )
1153  ELSE IF( ipack.EQ.2 ) THEN
1154  onorm = slansy( 'M', 'L', n, a, lda, tempa )
1155  ELSE IF( ipack.EQ.3 ) THEN
1156  onorm = slansp( 'M', 'U', n, a, tempa )
1157  ELSE IF( ipack.EQ.4 ) THEN
1158  onorm = slansp( 'M', 'L', n, a, tempa )
1159  ELSE IF( ipack.EQ.5 ) THEN
1160  onorm = slansb( 'M', 'L', n, kll, a, lda, tempa )
1161  ELSE IF( ipack.EQ.6 ) THEN
1162  onorm = slansb( 'M', 'U', n, kuu, a, lda, tempa )
1163  ELSE IF( ipack.EQ.7 ) THEN
1164  onorm = slangb( 'M', n, kll, kuu, a, lda, tempa )
1165  END IF
1166 *
1167  IF( anorm.GE.zero ) THEN
1168 *
1169  IF( anorm.GT.zero .AND. onorm.EQ.zero ) THEN
1170 *
1171 * Desired scaling impossible
1172 *
1173  info = 5
1174  RETURN
1175 *
1176  ELSE IF( ( anorm.GT.one .AND. onorm.LT.one ) .OR.
1177  $ ( anorm.LT.one .AND. onorm.GT.one ) ) THEN
1178 *
1179 * Scale carefully to avoid over / underflow
1180 *
1181  IF( ipack.LE.2 ) THEN
1182  DO 510 j = 1, n
1183  CALL sscal( m, one / onorm, a( 1, j ), 1 )
1184  CALL sscal( m, anorm, a( 1, j ), 1 )
1185  510 CONTINUE
1186 *
1187  ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 ) THEN
1188 *
1189  CALL sscal( n*( n+1 ) / 2, one / onorm, a, 1 )
1190  CALL sscal( n*( n+1 ) / 2, anorm, a, 1 )
1191 *
1192  ELSE IF( ipack.GE.5 ) THEN
1193 *
1194  DO 520 j = 1, n
1195  CALL sscal( kll+kuu+1, one / onorm, a( 1, j ), 1 )
1196  CALL sscal( kll+kuu+1, anorm, a( 1, j ), 1 )
1197  520 CONTINUE
1198 *
1199  END IF
1200 *
1201  ELSE
1202 *
1203 * Scale straightforwardly
1204 *
1205  IF( ipack.LE.2 ) THEN
1206  DO 530 j = 1, n
1207  CALL sscal( m, anorm / onorm, a( 1, j ), 1 )
1208  530 CONTINUE
1209 *
1210  ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 ) THEN
1211 *
1212  CALL sscal( n*( n+1 ) / 2, anorm / onorm, a, 1 )
1213 *
1214  ELSE IF( ipack.GE.5 ) THEN
1215 *
1216  DO 540 j = 1, n
1217  CALL sscal( kll+kuu+1, anorm / onorm, a( 1, j ), 1 )
1218  540 CONTINUE
1219  END IF
1220 *
1221  END IF
1222 *
1223  END IF
1224 *
1225 * End of SLATMR
1226 *
real function slatm3(M, N, I, J, ISUB, JSUB, KL, KU, IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK, SPARSE)
SLATM3
Definition: slatm3.f:228
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
real function slansb(NORM, UPLO, N, K, AB, LDAB, WORK)
SLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix.
Definition: slansb.f:131
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:116
real function slansp(NORM, UPLO, N, AP, WORK)
SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.
Definition: slansp.f:116
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
real function slangb(NORM, N, KL, KU, AB, LDAB, WORK)
SLANGB returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slangb.f:126
real function slatm2(M, N, I, J, KL, KU, IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK, SPARSE)
SLATM2
Definition: slatm2.f:210
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slatm1(MODE, COND, IRSIGN, IDIST, ISEED, D, N, INFO)
SLATM1
Definition: slatm1.f:137
real function slansy(NORM, UPLO, N, A, LDA, WORK)
SLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.
Definition: slansy.f:124

Here is the call graph for this function:

Here is the caller graph for this function: