kusano 7d535a
/*  -- translated by f2c (version 19940927).
kusano 7d535a
   You must link the resulting object file with the libraries:
kusano 7d535a
	-lf2c -lm   (in that order)
kusano 7d535a
*/
kusano 7d535a
kusano 7d535a
#include "f2c.h"
kusano 7d535a
kusano 7d535a
/* Table of constant values */
kusano 7d535a
kusano 7d535a
static integer c__0 = 0;
kusano 7d535a
static integer c__1 = 1;
kusano 7d535a
kusano 7d535a
/* Subroutine */ int clatmr_(integer *m, integer *n, char *dist, integer *
kusano 7d535a
	iseed, char *sym, complex *d, integer *mode, real *cond, complex *
kusano 7d535a
	dmax__, char *rsign, char *grade, complex *dl, integer *model, real *
kusano 7d535a
	condl, complex *dr, integer *moder, real *condr, char *pivtng, 
kusano 7d535a
	integer *ipivot, integer *kl, integer *ku, real *sparse, real *anorm, 
kusano 7d535a
	char *pack, complex *a, integer *lda, integer *iwork, integer *info)
kusano 7d535a
{
kusano 7d535a
    /* System generated locals */
kusano 7d535a
    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
kusano 7d535a
    real r__1, r__2;
kusano 7d535a
    doublereal d__1;
kusano 7d535a
    complex q__1, q__2;
kusano 7d535a
kusano 7d535a
    /* Builtin functions */
kusano 7d535a
    double c_abs(complex *);
kusano 7d535a
    void r_cnjg(complex *, complex *);
kusano 7d535a
kusano 7d535a
    /* Local variables */
kusano 7d535a
    static integer isub, jsub;
kusano 7d535a
    static real temp;
kusano 7d535a
    static integer isym, i, j, k, ipack;
kusano 7d535a
    extern logical lsame_(char *, char *);
kusano 7d535a
    static real tempa[1];
kusano 7d535a
    static complex ctemp;
kusano 7d535a
    static integer iisub, idist, jjsub, mnmin;
kusano 7d535a
    static logical dzero;
kusano 7d535a
    static integer mnsub;
kusano 7d535a
    static real onorm;
kusano 7d535a
    static integer mxsub, npvts;
kusano 7d535a
    extern /* Subroutine */ int clatm1_(integer *, real *, integer *, integer 
kusano 7d535a
	    *, integer *, complex *, integer *, integer *);
kusano 7d535a
    extern /* Complex */ VOID clatm2_(complex *, integer *, integer *, 
kusano 7d535a
	    integer *, integer *, integer *, integer *, integer *, integer *, 
kusano 7d535a
	    complex *, integer *, complex *, complex *, integer *, integer *, 
kusano 7d535a
	    real *), clatm3_(complex *, integer *, integer *, integer *, 
kusano 7d535a
	    integer *, integer *, integer *, integer *, integer *, integer *, 
kusano 7d535a
	    integer *, complex *, integer *, complex *, complex *, integer *, 
kusano 7d535a
	    integer *, real *);
kusano 7d535a
    static complex calpha;
kusano 7d535a
    extern doublereal clangb_(char *, integer *, integer *, integer *, 
kusano 7d535a
	    complex *, integer *, real *), clange_(char *, integer *, 
kusano 7d535a
	    integer *, complex *, integer *, real *);
kusano 7d535a
    static integer igrade;
kusano 7d535a
    extern doublereal clansb_(char *, char *, integer *, integer *, complex *,
kusano 7d535a
	     integer *, real *);
kusano 7d535a
    extern /* Subroutine */ int csscal_(integer *, real *, complex *, integer 
kusano 7d535a
	    *);
kusano 7d535a
    static logical fulbnd;
kusano 7d535a
    extern /* Subroutine */ int xerbla_(char *, integer *);
kusano 7d535a
    static logical badpvt;
kusano 7d535a
    extern doublereal clansp_(char *, char *, integer *, complex *, real *), clansy_(char *, char *, integer *, complex *, 
kusano 7d535a
	    integer *, real *);
kusano 7d535a
    static integer irsign, ipvtng, kll, kuu;
kusano 7d535a
kusano 7d535a
kusano 7d535a
/*  -- LAPACK test routine (version 2.0) --   
kusano 7d535a
       Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,   
kusano 7d535a
       Courant Institute, Argonne National Lab, and Rice University   
kusano 7d535a
       February 29, 1992   
kusano 7d535a
kusano 7d535a
kusano 7d535a
    Purpose   
kusano 7d535a
    =======   
kusano 7d535a
kusano 7d535a
       CLATMR generates random matrices of various types for testing   
kusano 7d535a
       LAPACK programs.   
kusano 7d535a
kusano 7d535a
       CLATMR operates by applying the following sequence of   
kusano 7d535a
       operations:   
kusano 7d535a
kusano 7d535a
         Generate a matrix A with random entries of distribution DIST   
kusano 7d535a
            which is symmetric if SYM='S', Hermitian if SYM='H', and   
kusano 7d535a
            nonsymmetric if SYM='N'.   
kusano 7d535a
kusano 7d535a
         Set the diagonal to D, where D may be input or   
kusano 7d535a
            computed according to MODE, COND, DMAX and RSIGN   
kusano 7d535a
            as described below.   
kusano 7d535a
kusano 7d535a
         Grade the matrix, if desired, from the left and/or right   
kusano 7d535a
            as specified by GRADE. The inputs DL, MODEL, CONDL, DR,   
kusano 7d535a
            MODER and CONDR also determine the grading as described   
kusano 7d535a
            below.   
kusano 7d535a
kusano 7d535a
         Permute, if desired, the rows and/or columns as specified by   
kusano 7d535a
            PIVTNG and IPIVOT.   
kusano 7d535a
kusano 7d535a
         Set random entries to zero, if desired, to get a random sparse   
kusano 7d535a
            matrix as specified by SPARSE.   
kusano 7d535a
kusano 7d535a
         Make A a band matrix, if desired, by zeroing out the matrix   
kusano 7d535a
            outside a band of lower bandwidth KL and upper bandwidth KU. 
kusano 7d535a
  
kusano 7d535a
kusano 7d535a
         Scale A, if desired, to have maximum entry ANORM.   
kusano 7d535a
kusano 7d535a
         Pack the matrix if desired. Options specified by PACK are:   
kusano 7d535a
            no packing   
kusano 7d535a
            zero out upper half (if symmetric or Hermitian)   
kusano 7d535a
            zero out lower half (if symmetric or Hermitian)   
kusano 7d535a
            store the upper half columnwise (if symmetric or Hermitian   
kusano 7d535a
                or square upper triangular)   
kusano 7d535a
            store the lower half columnwise (if symmetric or Hermitian   
kusano 7d535a
                or square lower triangular)   
kusano 7d535a
                same as upper half rowwise if symmetric   
kusano 7d535a
                same as conjugate upper half rowwise if Hermitian   
kusano 7d535a
            store the lower triangle in banded format   
kusano 7d535a
                (if symmetric or Hermitian)   
kusano 7d535a
            store the upper triangle in banded format   
kusano 7d535a
                (if symmetric or Hermitian)   
kusano 7d535a
            store the entire matrix in banded format   
kusano 7d535a
kusano 7d535a
       Note: If two calls to CLATMR differ only in the PACK parameter,   
kusano 7d535a
             they will generate mathematically equivalent matrices.   
kusano 7d535a
kusano 7d535a
             If two calls to CLATMR both have full bandwidth (KL = M-1   
kusano 7d535a
             and KU = N-1), and differ only in the PIVTNG and PACK   
kusano 7d535a
             parameters, then the matrices generated will differ only   
kusano 7d535a
             in the order of the rows and/or columns, and otherwise   
kusano 7d535a
             contain the same data. This consistency cannot be and   
kusano 7d535a
             is not maintained with less than full bandwidth.   
kusano 7d535a
kusano 7d535a
    Arguments   
kusano 7d535a
    =========   
kusano 7d535a
kusano 7d535a
    M      - INTEGER   
kusano 7d535a
             Number of rows of A. Not modified.   
kusano 7d535a
kusano 7d535a
    N      - INTEGER   
kusano 7d535a
             Number of columns of A. Not modified.   
kusano 7d535a
kusano 7d535a
    DIST   - CHARACTER*1   
kusano 7d535a
             On entry, DIST specifies the type of distribution to be used 
kusano 7d535a
  
kusano 7d535a
             to generate a random matrix .   
kusano 7d535a
             'U' => real and imaginary parts are independent   
kusano 7d535a
                    UNIFORM( 0, 1 )  ( 'U' for uniform )   
kusano 7d535a
             'S' => real and imaginary parts are independent   
kusano 7d535a
                    UNIFORM( -1, 1 ) ( 'S' for symmetric )   
kusano 7d535a
             'N' => real and imaginary parts are independent   
kusano 7d535a
                    NORMAL( 0, 1 )   ( 'N' for normal )   
kusano 7d535a
             'D' => uniform on interior of unit disk ( 'D' for disk )   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    ISEED  - INTEGER array, dimension (4)   
kusano 7d535a
             On entry ISEED specifies the seed of the random number   
kusano 7d535a
             generator. They should lie between 0 and 4095 inclusive,   
kusano 7d535a
             and ISEED(4) should be odd. The random number generator   
kusano 7d535a
             uses a linear congruential sequence limited to small   
kusano 7d535a
             integers, and so should produce machine independent   
kusano 7d535a
             random numbers. The values of ISEED are changed on   
kusano 7d535a
             exit, and can be used in the next call to CLATMR   
kusano 7d535a
             to continue the same random number sequence.   
kusano 7d535a
             Changed on exit.   
kusano 7d535a
kusano 7d535a
    SYM    - CHARACTER*1   
kusano 7d535a
             If SYM='S', generated matrix is symmetric.   
kusano 7d535a
             If SYM='H', generated matrix is Hermitian.   
kusano 7d535a
             If SYM='N', generated matrix is nonsymmetric.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    D      - COMPLEX array, dimension (min(M,N))   
kusano 7d535a
             On entry this array specifies the diagonal entries   
kusano 7d535a
             of the diagonal of A.  D may either be specified   
kusano 7d535a
             on entry, or set according to MODE and COND as described   
kusano 7d535a
             below. If the matrix is Hermitian, the real part of D   
kusano 7d535a
             will be taken. May be changed on exit if MODE is nonzero.   
kusano 7d535a
kusano 7d535a
    MODE   - INTEGER   
kusano 7d535a
             On entry describes how D is to be used:   
kusano 7d535a
             MODE = 0 means use D as input   
kusano 7d535a
             MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND   
kusano 7d535a
             MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND   
kusano 7d535a
             MODE = 3 sets D(I)=COND**(-(I-1)/(N-1))   
kusano 7d535a
             MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND)   
kusano 7d535a
             MODE = 5 sets D to random numbers in the range   
kusano 7d535a
                      ( 1/COND , 1 ) such that their logarithms   
kusano 7d535a
                      are uniformly distributed.   
kusano 7d535a
             MODE = 6 set D to random numbers from same distribution   
kusano 7d535a
                      as the rest of the matrix.   
kusano 7d535a
             MODE < 0 has the same meaning as ABS(MODE), except that   
kusano 7d535a
                the order of the elements of D is reversed.   
kusano 7d535a
             Thus if MODE is positive, D has entries ranging from   
kusano 7d535a
                1 to 1/COND, if negative, from 1/COND to 1,   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    COND   - REAL   
kusano 7d535a
             On entry, used as described under MODE above.   
kusano 7d535a
             If used, it must be >= 1. Not modified.   
kusano 7d535a
kusano 7d535a
    DMAX   - COMPLEX   
kusano 7d535a
             If MODE neither -6, 0 nor 6, the diagonal is scaled by   
kusano 7d535a
             DMAX / max(abs(D(i))), so that maximum absolute entry   
kusano 7d535a
             of diagonal is abs(DMAX). If DMAX is complex (or zero),   
kusano 7d535a
             diagonal will be scaled by a complex number (or zero).   
kusano 7d535a
kusano 7d535a
    RSIGN  - CHARACTER*1   
kusano 7d535a
             If MODE neither -6, 0 nor 6, specifies sign of diagonal   
kusano 7d535a
             as follows:   
kusano 7d535a
             'T' => diagonal entries are multiplied by a random complex   
kusano 7d535a
                    number uniformly distributed with absolute value 1   
kusano 7d535a
             'F' => diagonal unchanged   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    GRADE  - CHARACTER*1   
kusano 7d535a
             Specifies grading of matrix as follows:   
kusano 7d535a
             'N'  => no grading   
kusano 7d535a
             'L'  => matrix premultiplied by diag( DL )   
kusano 7d535a
                     (only if matrix nonsymmetric)   
kusano 7d535a
             'R'  => matrix postmultiplied by diag( DR )   
kusano 7d535a
                     (only if matrix nonsymmetric)   
kusano 7d535a
             'B'  => matrix premultiplied by diag( DL ) and   
kusano 7d535a
                           postmultiplied by diag( DR )   
kusano 7d535a
                     (only if matrix nonsymmetric)   
kusano 7d535a
             'H'  => matrix premultiplied by diag( DL ) and   
kusano 7d535a
                           postmultiplied by diag( CONJG(DL) )   
kusano 7d535a
                     (only if matrix Hermitian or nonsymmetric)   
kusano 7d535a
             'S'  => matrix premultiplied by diag( DL ) and   
kusano 7d535a
                           postmultiplied by diag( DL )   
kusano 7d535a
                     (only if matrix symmetric or nonsymmetric)   
kusano 7d535a
             'E'  => matrix premultiplied by diag( DL ) and   
kusano 7d535a
                           postmultiplied by inv( diag( DL ) )   
kusano 7d535a
                           ( 'S' for similarity )   
kusano 7d535a
                     (only if matrix nonsymmetric)   
kusano 7d535a
                     Note: if GRADE='S', then M must equal N.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    DL     - COMPLEX array, dimension (M)   
kusano 7d535a
             If MODEL=0, then on entry this array specifies the diagonal 
kusano 7d535a
  
kusano 7d535a
             entries of a diagonal matrix used as described under GRADE   
kusano 7d535a
             above. If MODEL is not zero, then DL will be set according   
kusano 7d535a
             to MODEL and CONDL, analogous to the way D is set according 
kusano 7d535a
  
kusano 7d535a
             to MODE and COND (except there is no DMAX parameter for DL). 
kusano 7d535a
  
kusano 7d535a
             If GRADE='E', then DL cannot have zero entries.   
kusano 7d535a
             Not referenced if GRADE = 'N' or 'R'. Changed on exit.   
kusano 7d535a
kusano 7d535a
    MODEL  - INTEGER   
kusano 7d535a
             This specifies how the diagonal array DL is to be computed, 
kusano 7d535a
  
kusano 7d535a
             just as MODE specifies how D is to be computed.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    CONDL  - REAL   
kusano 7d535a
             When MODEL is not zero, this specifies the condition number 
kusano 7d535a
  
kusano 7d535a
             of the computed DL.  Not modified.   
kusano 7d535a
kusano 7d535a
    DR     - COMPLEX array, dimension (N)   
kusano 7d535a
             If MODER=0, then on entry this array specifies the diagonal 
kusano 7d535a
  
kusano 7d535a
             entries of a diagonal matrix used as described under GRADE   
kusano 7d535a
             above. If MODER is not zero, then DR will be set according   
kusano 7d535a
             to MODER and CONDR, analogous to the way D is set according 
kusano 7d535a
  
kusano 7d535a
             to MODE and COND (except there is no DMAX parameter for DR). 
kusano 7d535a
  
kusano 7d535a
             Not referenced if GRADE = 'N', 'L', 'H' or 'S'.   
kusano 7d535a
             Changed on exit.   
kusano 7d535a
kusano 7d535a
    MODER  - INTEGER   
kusano 7d535a
             This specifies how the diagonal array DR is to be computed, 
kusano 7d535a
  
kusano 7d535a
             just as MODE specifies how D is to be computed.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    CONDR  - REAL   
kusano 7d535a
             When MODER is not zero, this specifies the condition number 
kusano 7d535a
  
kusano 7d535a
             of the computed DR.  Not modified.   
kusano 7d535a
kusano 7d535a
    PIVTNG - CHARACTER*1   
kusano 7d535a
             On entry specifies pivoting permutations as follows:   
kusano 7d535a
             'N' or ' ' => none.   
kusano 7d535a
             'L' => left or row pivoting (matrix must be nonsymmetric).   
kusano 7d535a
             'R' => right or column pivoting (matrix must be   
kusano 7d535a
                    nonsymmetric).   
kusano 7d535a
             'B' or 'F' => both or full pivoting, i.e., on both sides.   
kusano 7d535a
                           In this case, M must equal N   
kusano 7d535a
kusano 7d535a
             If two calls to CLATMR both have full bandwidth (KL = M-1   
kusano 7d535a
             and KU = N-1), and differ only in the PIVTNG and PACK   
kusano 7d535a
             parameters, then the matrices generated will differ only   
kusano 7d535a
             in the order of the rows and/or columns, and otherwise   
kusano 7d535a
             contain the same data. This consistency cannot be   
kusano 7d535a
             maintained with less than full bandwidth.   
kusano 7d535a
kusano 7d535a
    IPIVOT - INTEGER array, dimension (N or M)   
kusano 7d535a
             This array specifies the permutation used.  After the   
kusano 7d535a
             basic matrix is generated, the rows, columns, or both   
kusano 7d535a
             are permuted.   If, say, row pivoting is selected, CLATMR   
kusano 7d535a
             starts with the *last* row and interchanges the M-th and   
kusano 7d535a
             IPIVOT(M)-th rows, then moves to the next-to-last row,   
kusano 7d535a
             interchanging the (M-1)-th and the IPIVOT(M-1)-th rows,   
kusano 7d535a
             and so on.  In terms of "2-cycles", the permutation is   
kusano 7d535a
             (1 IPIVOT(1)) (2 IPIVOT(2)) ... (M IPIVOT(M))   
kusano 7d535a
             where the rightmost cycle is applied first.  This is the   
kusano 7d535a
             *inverse* of the effect of pivoting in LINPACK.  The idea   
kusano 7d535a
             is that factoring (with pivoting) an identity matrix   
kusano 7d535a
             which has been inverse-pivoted in this way should   
kusano 7d535a
             result in a pivot vector identical to IPIVOT.   
kusano 7d535a
             Not referenced if PIVTNG = 'N'. Not modified.   
kusano 7d535a
kusano 7d535a
    SPARSE - REAL   
kusano 7d535a
             On entry specifies the sparsity of the matrix if a sparse   
kusano 7d535a
             matrix is to be generated. SPARSE should lie between   
kusano 7d535a
             0 and 1. To generate a sparse matrix, for each matrix entry 
kusano 7d535a
  
kusano 7d535a
             a uniform ( 0, 1 ) random number x is generated and   
kusano 7d535a
             compared to SPARSE; if x is larger the matrix entry   
kusano 7d535a
             is unchanged and if x is smaller the entry is set   
kusano 7d535a
             to zero. Thus on the average a fraction SPARSE of the   
kusano 7d535a
             entries will be set to zero.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    KL     - INTEGER   
kusano 7d535a
             On entry specifies the lower bandwidth of the  matrix. For   
kusano 7d535a
             example, KL=0 implies upper triangular, KL=1 implies upper   
kusano 7d535a
             Hessenberg, and KL at least M-1 implies the matrix is not   
kusano 7d535a
             banded. Must equal KU if matrix is symmetric or Hermitian.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    KU     - INTEGER   
kusano 7d535a
             On entry specifies the upper bandwidth of the  matrix. For   
kusano 7d535a
             example, KU=0 implies lower triangular, KU=1 implies lower   
kusano 7d535a
             Hessenberg, and KU at least N-1 implies the matrix is not   
kusano 7d535a
             banded. Must equal KL if matrix is symmetric or Hermitian.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    ANORM  - REAL   
kusano 7d535a
             On entry specifies maximum entry of output matrix   
kusano 7d535a
             (output matrix will by multiplied by a constant so that   
kusano 7d535a
             its largest absolute entry equal ANORM)   
kusano 7d535a
             if ANORM is nonnegative. If ANORM is negative no scaling   
kusano 7d535a
             is done. Not modified.   
kusano 7d535a
kusano 7d535a
    PACK   - CHARACTER*1   
kusano 7d535a
             On entry specifies packing of matrix as follows:   
kusano 7d535a
             'N' => no packing   
kusano 7d535a
             'U' => zero out all subdiagonal entries   
kusano 7d535a
                    (if symmetric or Hermitian)   
kusano 7d535a
             'L' => zero out all superdiagonal entries   
kusano 7d535a
                    (if symmetric or Hermitian)   
kusano 7d535a
             'C' => store the upper triangle columnwise   
kusano 7d535a
                    (only if matrix symmetric or Hermitian or   
kusano 7d535a
                     square upper triangular)   
kusano 7d535a
             'R' => store the lower triangle columnwise   
kusano 7d535a
                    (only if matrix symmetric or Hermitian or   
kusano 7d535a
                     square lower triangular)   
kusano 7d535a
                    (same as upper half rowwise if symmetric)   
kusano 7d535a
                    (same as conjugate upper half rowwise if Hermitian)   
kusano 7d535a
             'B' => store the lower triangle in band storage scheme   
kusano 7d535a
                    (only if matrix symmetric or Hermitian)   
kusano 7d535a
             'Q' => store the upper triangle in band storage scheme   
kusano 7d535a
                    (only if matrix symmetric or Hermitian)   
kusano 7d535a
             'Z' => store the entire matrix in band storage scheme   
kusano 7d535a
                        (pivoting can be provided for by using this   
kusano 7d535a
                        option to store A in the trailing rows of   
kusano 7d535a
                        the allocated storage)   
kusano 7d535a
kusano 7d535a
             Using these options, the various LAPACK packed and banded   
kusano 7d535a
             storage schemes can be obtained:   
kusano 7d535a
             GB               - use 'Z'   
kusano 7d535a
             PB, HB or TB     - use 'B' or 'Q'   
kusano 7d535a
             PP, HP or TP     - use 'C' or 'R'   
kusano 7d535a
kusano 7d535a
             If two calls to CLATMR differ only in the PACK parameter,   
kusano 7d535a
             they will generate mathematically equivalent matrices.   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    A      - COMPLEX array, dimension (LDA,N)   
kusano 7d535a
             On exit A is the desired test matrix. Only those   
kusano 7d535a
             entries of A which are significant on output   
kusano 7d535a
             will be referenced (even if A is in packed or band   
kusano 7d535a
             storage format). The 'unoccupied corners' of A in   
kusano 7d535a
             band format will be zeroed out.   
kusano 7d535a
kusano 7d535a
    LDA    - INTEGER   
kusano 7d535a
             on entry LDA specifies the first dimension of A as   
kusano 7d535a
             declared in the calling program.   
kusano 7d535a
             If PACK='N', 'U' or 'L', LDA must be at least max ( 1, M ). 
kusano 7d535a
  
kusano 7d535a
             If PACK='C' or 'R', LDA must be at least 1.   
kusano 7d535a
             If PACK='B', or 'Q', LDA must be MIN ( KU+1, N )   
kusano 7d535a
             If PACK='Z', LDA must be at least KUU+KLL+1, where   
kusano 7d535a
             KUU = MIN ( KU, N-1 ) and KLL = MIN ( KL, N-1 )   
kusano 7d535a
             Not modified.   
kusano 7d535a
kusano 7d535a
    IWORK  - INTEGER array, dimension (N or M)   
kusano 7d535a
             Workspace. Not referenced if PIVTNG = 'N'. Changed on exit. 
kusano 7d535a
  
kusano 7d535a
kusano 7d535a
    INFO   - INTEGER   
kusano 7d535a
             Error parameter on exit:   
kusano 7d535a
               0 => normal return   
kusano 7d535a
              -1 => M negative or unequal to N and SYM='S' or 'H'   
kusano 7d535a
              -2 => N negative   
kusano 7d535a
              -3 => DIST illegal string   
kusano 7d535a
              -5 => SYM illegal string   
kusano 7d535a
              -7 => MODE not in range -6 to 6   
kusano 7d535a
              -8 => COND less than 1.0, and MODE neither -6, 0 nor 6   
kusano 7d535a
             -10 => MODE neither -6, 0 nor 6 and RSIGN illegal string   
kusano 7d535a
             -11 => GRADE illegal string, or GRADE='E' and   
kusano 7d535a
                    M not equal to N, or GRADE='L', 'R', 'B', 'S' or 'E' 
kusano 7d535a
  
kusano 7d535a
                    and SYM = 'H', or GRADE='L', 'R', 'B', 'H' or 'E'   
kusano 7d535a
                    and SYM = 'S'   
kusano 7d535a
             -12 => GRADE = 'E' and DL contains zero   
kusano 7d535a
             -13 => MODEL not in range -6 to 6 and GRADE= 'L', 'B', 'H', 
kusano 7d535a
  
kusano 7d535a
                    'S' or 'E'   
kusano 7d535a
             -14 => CONDL less than 1.0, GRADE='L', 'B', 'H', 'S' or 'E', 
kusano 7d535a
  
kusano 7d535a
                    and MODEL neither -6, 0 nor 6   
kusano 7d535a
             -16 => MODER not in range -6 to 6 and GRADE= 'R' or 'B'   
kusano 7d535a
             -17 => CONDR less than 1.0, GRADE='R' or 'B', and   
kusano 7d535a
                    MODER neither -6, 0 nor 6   
kusano 7d535a
             -18 => PIVTNG illegal string, or PIVTNG='B' or 'F' and   
kusano 7d535a
                    M not equal to N, or PIVTNG='L' or 'R' and SYM='S'   
kusano 7d535a
                    or 'H'   
kusano 7d535a
             -19 => IPIVOT contains out of range number and   
kusano 7d535a
                    PIVTNG not equal to 'N'   
kusano 7d535a
             -20 => KL negative   
kusano 7d535a
             -21 => KU negative, or SYM='S' or 'H' and KU not equal to KL 
kusano 7d535a
  
kusano 7d535a
             -22 => SPARSE not in range 0. to 1.   
kusano 7d535a
             -24 => PACK illegal string, or PACK='U', 'L', 'B' or 'Q'   
kusano 7d535a
                    and SYM='N', or PACK='C' and SYM='N' and either KL   
kusano 7d535a
                    not equal to 0 or N not equal to M, or PACK='R' and   
kusano 7d535a
                    SYM='N', and either KU not equal to 0 or N not equal 
kusano 7d535a
  
kusano 7d535a
                    to M   
kusano 7d535a
             -26 => LDA too small   
kusano 7d535a
               1 => Error return from CLATM1 (computing D)   
kusano 7d535a
               2 => Cannot scale diagonal to DMAX (max. entry is 0)   
kusano 7d535a
               3 => Error return from CLATM1 (computing DL)   
kusano 7d535a
               4 => Error return from CLATM1 (computing DR)   
kusano 7d535a
               5 => ANORM is positive, but matrix constructed prior to   
kusano 7d535a
                    attempting to scale it to have norm ANORM, is zero   
kusano 7d535a
kusano 7d535a
    ===================================================================== 
kusano 7d535a
  
kusano 7d535a
kusano 7d535a
kusano 7d535a
       1)      Decode and Test the input parameters.   
kusano 7d535a
               Initialize flags & seed.   
kusano 7d535a
kusano 7d535a
       Parameter adjustments */
kusano 7d535a
    --iseed;
kusano 7d535a
    --d;
kusano 7d535a
    --dl;
kusano 7d535a
    --dr;
kusano 7d535a
    --ipivot;
kusano 7d535a
    a_dim1 = *lda;
kusano 7d535a
    a_offset = a_dim1 + 1;
kusano 7d535a
    a -= a_offset;
kusano 7d535a
    --iwork;
kusano 7d535a
kusano 7d535a
    /* Function Body */
kusano 7d535a
    *info = 0;
kusano 7d535a
kusano 7d535a
/*     Quick return if possible */
kusano 7d535a
kusano 7d535a
    if (*m == 0 || *n == 0) {
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode DIST */
kusano 7d535a
kusano 7d535a
    if (lsame_(dist, "U")) {
kusano 7d535a
	idist = 1;
kusano 7d535a
    } else if (lsame_(dist, "S")) {
kusano 7d535a
	idist = 2;
kusano 7d535a
    } else if (lsame_(dist, "N")) {
kusano 7d535a
	idist = 3;
kusano 7d535a
    } else if (lsame_(dist, "D")) {
kusano 7d535a
	idist = 4;
kusano 7d535a
    } else {
kusano 7d535a
	idist = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode SYM */
kusano 7d535a
kusano 7d535a
    if (lsame_(sym, "H")) {
kusano 7d535a
	isym = 0;
kusano 7d535a
    } else if (lsame_(sym, "N")) {
kusano 7d535a
	isym = 1;
kusano 7d535a
    } else if (lsame_(sym, "S")) {
kusano 7d535a
	isym = 2;
kusano 7d535a
    } else {
kusano 7d535a
	isym = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode RSIGN */
kusano 7d535a
kusano 7d535a
    if (lsame_(rsign, "F")) {
kusano 7d535a
	irsign = 0;
kusano 7d535a
    } else if (lsame_(rsign, "T")) {
kusano 7d535a
	irsign = 1;
kusano 7d535a
    } else {
kusano 7d535a
	irsign = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode PIVTNG */
kusano 7d535a
kusano 7d535a
    if (lsame_(pivtng, "N")) {
kusano 7d535a
	ipvtng = 0;
kusano 7d535a
    } else if (lsame_(pivtng, " ")) {
kusano 7d535a
	ipvtng = 0;
kusano 7d535a
    } else if (lsame_(pivtng, "L")) {
kusano 7d535a
	ipvtng = 1;
kusano 7d535a
	npvts = *m;
kusano 7d535a
    } else if (lsame_(pivtng, "R")) {
kusano 7d535a
	ipvtng = 2;
kusano 7d535a
	npvts = *n;
kusano 7d535a
    } else if (lsame_(pivtng, "B")) {
kusano 7d535a
	ipvtng = 3;
kusano 7d535a
	npvts = min(*n,*m);
kusano 7d535a
    } else if (lsame_(pivtng, "F")) {
kusano 7d535a
	ipvtng = 3;
kusano 7d535a
	npvts = min(*n,*m);
kusano 7d535a
    } else {
kusano 7d535a
	ipvtng = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode GRADE */
kusano 7d535a
kusano 7d535a
    if (lsame_(grade, "N")) {
kusano 7d535a
	igrade = 0;
kusano 7d535a
    } else if (lsame_(grade, "L")) {
kusano 7d535a
	igrade = 1;
kusano 7d535a
    } else if (lsame_(grade, "R")) {
kusano 7d535a
	igrade = 2;
kusano 7d535a
    } else if (lsame_(grade, "B")) {
kusano 7d535a
	igrade = 3;
kusano 7d535a
    } else if (lsame_(grade, "E")) {
kusano 7d535a
	igrade = 4;
kusano 7d535a
    } else if (lsame_(grade, "H")) {
kusano 7d535a
	igrade = 5;
kusano 7d535a
    } else if (lsame_(grade, "S")) {
kusano 7d535a
	igrade = 6;
kusano 7d535a
    } else {
kusano 7d535a
	igrade = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decode PACK */
kusano 7d535a
kusano 7d535a
    if (lsame_(pack, "N")) {
kusano 7d535a
	ipack = 0;
kusano 7d535a
    } else if (lsame_(pack, "U")) {
kusano 7d535a
	ipack = 1;
kusano 7d535a
    } else if (lsame_(pack, "L")) {
kusano 7d535a
	ipack = 2;
kusano 7d535a
    } else if (lsame_(pack, "C")) {
kusano 7d535a
	ipack = 3;
kusano 7d535a
    } else if (lsame_(pack, "R")) {
kusano 7d535a
	ipack = 4;
kusano 7d535a
    } else if (lsame_(pack, "B")) {
kusano 7d535a
	ipack = 5;
kusano 7d535a
    } else if (lsame_(pack, "Q")) {
kusano 7d535a
	ipack = 6;
kusano 7d535a
    } else if (lsame_(pack, "Z")) {
kusano 7d535a
	ipack = 7;
kusano 7d535a
    } else {
kusano 7d535a
	ipack = -1;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Set certain internal parameters */
kusano 7d535a
kusano 7d535a
    mnmin = min(*m,*n);
kusano 7d535a
/* Computing MIN */
kusano 7d535a
    i__1 = *kl, i__2 = *m - 1;
kusano 7d535a
    kll = min(i__1,i__2);
kusano 7d535a
/* Computing MIN */
kusano 7d535a
    i__1 = *ku, i__2 = *n - 1;
kusano 7d535a
    kuu = min(i__1,i__2);
kusano 7d535a
kusano 7d535a
/*     If inv(DL) is used, check to see if DL has a zero entry. */
kusano 7d535a
kusano 7d535a
    dzero = FALSE_;
kusano 7d535a
    if (igrade == 4 && *model == 0) {
kusano 7d535a
	i__1 = *m;
kusano 7d535a
	for (i = 1; i <= i__1; ++i) {
kusano 7d535a
	    i__2 = i;
kusano 7d535a
	    if (dl[i__2].r == 0.f && dl[i__2].i == 0.f) {
kusano 7d535a
		dzero = TRUE_;
kusano 7d535a
	    }
kusano 7d535a
/* L10: */
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Check values in IPIVOT */
kusano 7d535a
kusano 7d535a
    badpvt = FALSE_;
kusano 7d535a
    if (ipvtng > 0) {
kusano 7d535a
	i__1 = npvts;
kusano 7d535a
	for (j = 1; j <= i__1; ++j) {
kusano 7d535a
	    if (ipivot[j] <= 0 || ipivot[j] > npvts) {
kusano 7d535a
		badpvt = TRUE_;
kusano 7d535a
	    }
kusano 7d535a
/* L20: */
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Set INFO if an error */
kusano 7d535a
kusano 7d535a
    if (*m < 0) {
kusano 7d535a
	*info = -1;
kusano 7d535a
    } else if (*m != *n && (isym == 0 || isym == 2)) {
kusano 7d535a
	*info = -1;
kusano 7d535a
    } else if (*n < 0) {
kusano 7d535a
	*info = -2;
kusano 7d535a
    } else if (idist == -1) {
kusano 7d535a
	*info = -3;
kusano 7d535a
    } else if (isym == -1) {
kusano 7d535a
	*info = -5;
kusano 7d535a
    } else if (*mode < -6 || *mode > 6) {
kusano 7d535a
	*info = -7;
kusano 7d535a
    } else if (*mode != -6 && *mode != 0 && *mode != 6 && *cond < 1.f) {
kusano 7d535a
	*info = -8;
kusano 7d535a
    } else if (*mode != -6 && *mode != 0 && *mode != 6 && irsign == -1) {
kusano 7d535a
	*info = -10;
kusano 7d535a
    } else if (igrade == -1 || igrade == 4 && *m != *n || (igrade == 1 || 
kusano 7d535a
	    igrade == 2 || igrade == 3 || igrade == 4 || igrade == 6) && isym 
kusano 7d535a
	    == 0 || (igrade == 1 || igrade == 2 || igrade == 3 || igrade == 4 
kusano 7d535a
	    || igrade == 5) && isym == 2) {
kusano 7d535a
	*info = -11;
kusano 7d535a
    } else if (igrade == 4 && dzero) {
kusano 7d535a
	*info = -12;
kusano 7d535a
    } else if ((igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5 || 
kusano 7d535a
	    igrade == 6) && (*model < -6 || *model > 6)) {
kusano 7d535a
	*info = -13;
kusano 7d535a
    } else if ((igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5 || 
kusano 7d535a
	    igrade == 6) && (*model != -6 && *model != 0 && *model != 6) && *
kusano 7d535a
	    condl < 1.f) {
kusano 7d535a
	*info = -14;
kusano 7d535a
    } else if ((igrade == 2 || igrade == 3) && (*moder < -6 || *moder > 6)) {
kusano 7d535a
	*info = -16;
kusano 7d535a
    } else if ((igrade == 2 || igrade == 3) && (*moder != -6 && *moder != 0 &&
kusano 7d535a
	     *moder != 6) && *condr < 1.f) {
kusano 7d535a
	*info = -17;
kusano 7d535a
    } else if (ipvtng == -1 || ipvtng == 3 && *m != *n || (ipvtng == 1 || 
kusano 7d535a
	    ipvtng == 2) && (isym == 0 || isym == 2)) {
kusano 7d535a
	*info = -18;
kusano 7d535a
    } else if (ipvtng != 0 && badpvt) {
kusano 7d535a
	*info = -19;
kusano 7d535a
    } else if (*kl < 0) {
kusano 7d535a
	*info = -20;
kusano 7d535a
    } else if (*ku < 0 || (isym == 0 || isym == 2) && *kl != *ku) {
kusano 7d535a
	*info = -21;
kusano 7d535a
    } else if (*sparse < 0.f || *sparse > 1.f) {
kusano 7d535a
	*info = -22;
kusano 7d535a
    } else if (ipack == -1 || (ipack == 1 || ipack == 2 || ipack == 5 || 
kusano 7d535a
	    ipack == 6) && isym == 1 || ipack == 3 && isym == 1 && (*kl != 0 
kusano 7d535a
	    || *m != *n) || ipack == 4 && isym == 1 && (*ku != 0 || *m != *n))
kusano 7d535a
	     {
kusano 7d535a
	*info = -24;
kusano 7d535a
    } else if ((ipack == 0 || ipack == 1 || ipack == 2) && *lda < max(1,*m) ||
kusano 7d535a
	     (ipack == 3 || ipack == 4) && *lda < 1 || (ipack == 5 || ipack ==
kusano 7d535a
	     6) && *lda < kuu + 1 || ipack == 7 && *lda < kll + kuu + 1) {
kusano 7d535a
	*info = -26;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    if (*info != 0) {
kusano 7d535a
	i__1 = -(*info);
kusano 7d535a
	xerbla_("CLATMR", &i__1);
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Decide if we can pivot consistently */
kusano 7d535a
kusano 7d535a
    fulbnd = FALSE_;
kusano 7d535a
    if (kuu == *n - 1 && kll == *m - 1) {
kusano 7d535a
	fulbnd = TRUE_;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Initialize random number generator */
kusano 7d535a
kusano 7d535a
    for (i = 1; i <= 4; ++i) {
kusano 7d535a
	iseed[i] = (i__1 = iseed[i], abs(i__1)) % 4096;
kusano 7d535a
/* L30: */
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    iseed[4] = (iseed[4] / 2 << 1) + 1;
kusano 7d535a
kusano 7d535a
/*     2)      Set up D, DL, and DR, if indicated.   
kusano 7d535a
kusano 7d535a
               Compute D according to COND and MODE */
kusano 7d535a
kusano 7d535a
    clatm1_(mode, cond, &irsign, &idist, &iseed[1], &d[1], &mnmin, info);
kusano 7d535a
    if (*info != 0) {
kusano 7d535a
	*info = 1;
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
    if (*mode != 0 && *mode != -6 && *mode != 6) {
kusano 7d535a
kusano 7d535a
/*        Scale by DMAX */
kusano 7d535a
kusano 7d535a
	temp = c_abs(&d[1]);
kusano 7d535a
	i__1 = mnmin;
kusano 7d535a
	for (i = 2; i <= i__1; ++i) {
kusano 7d535a
/* Computing MAX */
kusano 7d535a
	    r__1 = temp, r__2 = c_abs(&d[i]);
kusano 7d535a
	    temp = dmax(r__1,r__2);
kusano 7d535a
/* L40: */
kusano 7d535a
	}
kusano 7d535a
	if (temp == 0.f && (dmax__->r != 0.f || dmax__->i != 0.f)) {
kusano 7d535a
	    *info = 2;
kusano 7d535a
	    return 0;
kusano 7d535a
	}
kusano 7d535a
	if (temp != 0.f) {
kusano 7d535a
	    q__1.r = dmax__->r / temp, q__1.i = dmax__->i / temp;
kusano 7d535a
	    calpha.r = q__1.r, calpha.i = q__1.i;
kusano 7d535a
	} else {
kusano 7d535a
	    calpha.r = 1.f, calpha.i = 0.f;
kusano 7d535a
	}
kusano 7d535a
	i__1 = mnmin;
kusano 7d535a
	for (i = 1; i <= i__1; ++i) {
kusano 7d535a
	    i__2 = i;
kusano 7d535a
	    i__3 = i;
kusano 7d535a
	    q__1.r = calpha.r * d[i__3].r - calpha.i * d[i__3].i, q__1.i = 
kusano 7d535a
		    calpha.r * d[i__3].i + calpha.i * d[i__3].r;
kusano 7d535a
	    d[i__2].r = q__1.r, d[i__2].i = q__1.i;
kusano 7d535a
/* L50: */
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     If matrix Hermitian, make D real */
kusano 7d535a
kusano 7d535a
    if (isym == 0) {
kusano 7d535a
	i__1 = mnmin;
kusano 7d535a
	for (i = 1; i <= i__1; ++i) {
kusano 7d535a
	    i__2 = i;
kusano 7d535a
	    i__3 = i;
kusano 7d535a
	    d__1 = d[i__3].r;
kusano 7d535a
	    d[i__2].r = d__1, d[i__2].i = 0.f;
kusano 7d535a
/* L60: */
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Compute DL if grading set */
kusano 7d535a
kusano 7d535a
    if (igrade == 1 || igrade == 3 || igrade == 4 || igrade == 5 || igrade == 
kusano 7d535a
	    6) {
kusano 7d535a
	clatm1_(model, condl, &c__0, &idist, &iseed[1], &dl[1], m, info);
kusano 7d535a
	if (*info != 0) {
kusano 7d535a
	    *info = 3;
kusano 7d535a
	    return 0;
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Compute DR if grading set */
kusano 7d535a
kusano 7d535a
    if (igrade == 2 || igrade == 3) {
kusano 7d535a
	clatm1_(moder, condr, &c__0, &idist, &iseed[1], &dr[1], n, info);
kusano 7d535a
	if (*info != 0) {
kusano 7d535a
	    *info = 4;
kusano 7d535a
	    return 0;
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     3)     Generate IWORK if pivoting */
kusano 7d535a
kusano 7d535a
    if (ipvtng > 0) {
kusano 7d535a
	i__1 = npvts;
kusano 7d535a
	for (i = 1; i <= i__1; ++i) {
kusano 7d535a
	    iwork[i] = i;
kusano 7d535a
/* L70: */
kusano 7d535a
	}
kusano 7d535a
	if (fulbnd) {
kusano 7d535a
	    i__1 = npvts;
kusano 7d535a
	    for (i = 1; i <= i__1; ++i) {
kusano 7d535a
		k = ipivot[i];
kusano 7d535a
		j = iwork[i];
kusano 7d535a
		iwork[i] = iwork[k];
kusano 7d535a
		iwork[k] = j;
kusano 7d535a
/* L80: */
kusano 7d535a
	    }
kusano 7d535a
	} else {
kusano 7d535a
	    for (i = npvts; i >= 1; --i) {
kusano 7d535a
		k = ipivot[i];
kusano 7d535a
		j = iwork[i];
kusano 7d535a
		iwork[i] = iwork[k];
kusano 7d535a
		iwork[k] = j;
kusano 7d535a
/* L90: */
kusano 7d535a
	    }
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     4)      Generate matrices for each kind of PACKing   
kusano 7d535a
               Always sweep matrix columnwise (if symmetric, upper   
kusano 7d535a
               half only) so that matrix generated does not depend   
kusano 7d535a
               on PACK */
kusano 7d535a
kusano 7d535a
    if (fulbnd) {
kusano 7d535a
kusano 7d535a
/*        Use CLATM3 so matrices generated with differing PIVOTing onl
kusano 7d535a
y   
kusano 7d535a
          differ only in the order of their rows and/or columns. */
kusano 7d535a
kusano 7d535a
	if (ipack == 0) {
kusano 7d535a
	    if (isym == 0) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			i__3 = isub + jsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
			i__3 = jsub + isub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L100: */
kusano 7d535a
		    }
kusano 7d535a
/* L110: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			i__3 = isub + jsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
/* L120: */
kusano 7d535a
		    }
kusano 7d535a
/* L130: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 2) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			i__3 = isub + jsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
			i__3 = jsub + isub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
/* L140: */
kusano 7d535a
		    }
kusano 7d535a
/* L150: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 1) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &idist,
kusano 7d535a
			     &iseed[1], &d[1], &igrade, &dl[1], &dr[1], &
kusano 7d535a
			    ipvtng, &iwork[1], sparse);
kusano 7d535a
		    ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
		    mnsub = min(isub,jsub);
kusano 7d535a
		    mxsub = max(isub,jsub);
kusano 7d535a
		    if (mxsub == isub && isym == 0) {
kusano 7d535a
			i__3 = mnsub + mxsub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = mnsub + mxsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
		    }
kusano 7d535a
		    if (mnsub != mxsub) {
kusano 7d535a
			i__3 = mxsub + mnsub * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    }
kusano 7d535a
/* L160: */
kusano 7d535a
		}
kusano 7d535a
/* L170: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 2) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &idist,
kusano 7d535a
			     &iseed[1], &d[1], &igrade, &dl[1], &dr[1], &
kusano 7d535a
			    ipvtng, &iwork[1], sparse);
kusano 7d535a
		    ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
		    mnsub = min(isub,jsub);
kusano 7d535a
		    mxsub = max(isub,jsub);
kusano 7d535a
		    if (mxsub == jsub && isym == 0) {
kusano 7d535a
			i__3 = mxsub + mnsub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = mxsub + mnsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
		    }
kusano 7d535a
		    if (mnsub != mxsub) {
kusano 7d535a
			i__3 = mnsub + mxsub * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    }
kusano 7d535a
/* L180: */
kusano 7d535a
		}
kusano 7d535a
/* L190: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 3) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &idist,
kusano 7d535a
			     &iseed[1], &d[1], &igrade, &dl[1], &dr[1], &
kusano 7d535a
			    ipvtng, &iwork[1], sparse);
kusano 7d535a
		    ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
kusano 7d535a
/*                 Compute K = location of (ISUB,JSUB) ent
kusano 7d535a
ry in packed   
kusano 7d535a
                   array */
kusano 7d535a
kusano 7d535a
		    mnsub = min(isub,jsub);
kusano 7d535a
		    mxsub = max(isub,jsub);
kusano 7d535a
		    k = mxsub * (mxsub - 1) / 2 + mnsub;
kusano 7d535a
kusano 7d535a
/*                 Convert K to (IISUB,JJSUB) location */
kusano 7d535a
kusano 7d535a
		    jjsub = (k - 1) / *lda + 1;
kusano 7d535a
		    iisub = k - *lda * (jjsub - 1);
kusano 7d535a
kusano 7d535a
		    if (mxsub == isub && isym == 0) {
kusano 7d535a
			i__3 = iisub + jjsub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = iisub + jjsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
		    }
kusano 7d535a
/* L200: */
kusano 7d535a
		}
kusano 7d535a
/* L210: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 4) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &idist,
kusano 7d535a
			     &iseed[1], &d[1], &igrade, &dl[1], &dr[1], &
kusano 7d535a
			    ipvtng, &iwork[1], sparse);
kusano 7d535a
		    ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
kusano 7d535a
/*                 Compute K = location of (I,J) entry in 
kusano 7d535a
packed array */
kusano 7d535a
kusano 7d535a
		    mnsub = min(isub,jsub);
kusano 7d535a
		    mxsub = max(isub,jsub);
kusano 7d535a
		    if (mnsub == 1) {
kusano 7d535a
			k = mxsub;
kusano 7d535a
		    } else {
kusano 7d535a
			k = *n * (*n + 1) / 2 - (*n - mnsub + 1) * (*n - 
kusano 7d535a
				mnsub + 2) / 2 + mxsub - mnsub + 1;
kusano 7d535a
		    }
kusano 7d535a
kusano 7d535a
/*                 Convert K to (IISUB,JJSUB) location */
kusano 7d535a
kusano 7d535a
		    jjsub = (k - 1) / *lda + 1;
kusano 7d535a
		    iisub = k - *lda * (jjsub - 1);
kusano 7d535a
kusano 7d535a
		    if (mxsub == jsub && isym == 0) {
kusano 7d535a
			i__3 = iisub + jjsub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = iisub + jjsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
		    }
kusano 7d535a
/* L220: */
kusano 7d535a
		}
kusano 7d535a
/* L230: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 5) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
		    if (i < 1) {
kusano 7d535a
			i__3 = j - i + 1 + (i + *n) * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    } else {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			mnsub = min(isub,jsub);
kusano 7d535a
			mxsub = max(isub,jsub);
kusano 7d535a
			if (mxsub == jsub && isym == 0) {
kusano 7d535a
			    i__3 = mxsub - mnsub + 1 + mnsub * a_dim1;
kusano 7d535a
			    r_cnjg(&q__1, &ctemp);
kusano 7d535a
			    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			} else {
kusano 7d535a
			    i__3 = mxsub - mnsub + 1 + mnsub * a_dim1;
kusano 7d535a
			    a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
			}
kusano 7d535a
		    }
kusano 7d535a
/* L240: */
kusano 7d535a
		}
kusano 7d535a
/* L250: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 6) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
		    clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &idist,
kusano 7d535a
			     &iseed[1], &d[1], &igrade, &dl[1], &dr[1], &
kusano 7d535a
			    ipvtng, &iwork[1], sparse);
kusano 7d535a
		    ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
		    mnsub = min(isub,jsub);
kusano 7d535a
		    mxsub = max(isub,jsub);
kusano 7d535a
		    if (mxsub == isub && isym == 0) {
kusano 7d535a
			i__3 = mnsub - mxsub + kuu + 1 + mxsub * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &ctemp);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = mnsub - mxsub + kuu + 1 + mxsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
		    }
kusano 7d535a
/* L260: */
kusano 7d535a
		}
kusano 7d535a
/* L270: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 7) {
kusano 7d535a
kusano 7d535a
	    if (isym != 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			mnsub = min(isub,jsub);
kusano 7d535a
			mxsub = max(isub,jsub);
kusano 7d535a
			if (i < 1) {
kusano 7d535a
			    i__3 = j - i + 1 + kuu + (i + *n) * a_dim1;
kusano 7d535a
			    a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
			}
kusano 7d535a
			if (mxsub == isub && isym == 0) {
kusano 7d535a
			    i__3 = mnsub - mxsub + kuu + 1 + mxsub * a_dim1;
kusano 7d535a
			    r_cnjg(&q__1, &ctemp);
kusano 7d535a
			    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			} else {
kusano 7d535a
			    i__3 = mnsub - mxsub + kuu + 1 + mxsub * a_dim1;
kusano 7d535a
			    a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
			}
kusano 7d535a
			if (i >= 1 && mnsub != mxsub) {
kusano 7d535a
			    if (mnsub == isub && isym == 0) {
kusano 7d535a
				i__3 = mxsub - mnsub + 1 + kuu + mnsub * 
kusano 7d535a
					a_dim1;
kusano 7d535a
				r_cnjg(&q__1, &ctemp);
kusano 7d535a
				a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			    } else {
kusano 7d535a
				i__3 = mxsub - mnsub + 1 + kuu + mnsub * 
kusano 7d535a
					a_dim1;
kusano 7d535a
				a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
			    }
kusano 7d535a
			}
kusano 7d535a
/* L280: */
kusano 7d535a
		    }
kusano 7d535a
/* L290: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j + kll;
kusano 7d535a
		    for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
			clatm3_(&q__1, m, n, &i, &j, &isub, &jsub, kl, ku, &
kusano 7d535a
				idist, &iseed[1], &d[1], &igrade, &dl[1], &dr[
kusano 7d535a
				1], &ipvtng, &iwork[1], sparse);
kusano 7d535a
			ctemp.r = q__1.r, ctemp.i = q__1.i;
kusano 7d535a
			i__3 = isub - jsub + kuu + 1 + jsub * a_dim1;
kusano 7d535a
			a[i__3].r = ctemp.r, a[i__3].i = ctemp.i;
kusano 7d535a
/* L300: */
kusano 7d535a
		    }
kusano 7d535a
/* L310: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    } else {
kusano 7d535a
kusano 7d535a
/*        Use CLATM2 */
kusano 7d535a
kusano 7d535a
	if (ipack == 0) {
kusano 7d535a
	    if (isym == 0) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			i__3 = j + i * a_dim1;
kusano 7d535a
			r_cnjg(&q__1, &a[i + j * a_dim1]);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L320: */
kusano 7d535a
		    }
kusano 7d535a
/* L330: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L340: */
kusano 7d535a
		    }
kusano 7d535a
/* L350: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 2) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			i__3 = j + i * a_dim1;
kusano 7d535a
			i__4 = i + j * a_dim1;
kusano 7d535a
			a[i__3].r = a[i__4].r, a[i__3].i = a[i__4].i;
kusano 7d535a
/* L360: */
kusano 7d535a
		    }
kusano 7d535a
/* L370: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 1) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    i__3 = i + j * a_dim1;
kusano 7d535a
		    clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1], &
kusano 7d535a
			    d[1], &igrade, &dl[1], &dr[1], &ipvtng, &iwork[1],
kusano 7d535a
			     sparse);
kusano 7d535a
		    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    if (i != j) {
kusano 7d535a
			i__3 = j + i * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    }
kusano 7d535a
/* L380: */
kusano 7d535a
		}
kusano 7d535a
/* L390: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 2) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    if (isym == 0) {
kusano 7d535a
			i__3 = j + i * a_dim1;
kusano 7d535a
			clatm2_(&q__2, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			r_cnjg(&q__1, &q__2);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    } else {
kusano 7d535a
			i__3 = j + i * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
		    }
kusano 7d535a
		    if (i != j) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    }
kusano 7d535a
/* L400: */
kusano 7d535a
		}
kusano 7d535a
/* L410: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 3) {
kusano 7d535a
kusano 7d535a
	    isub = 0;
kusano 7d535a
	    jsub = 1;
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = 1; i <= i__2; ++i) {
kusano 7d535a
		    ++isub;
kusano 7d535a
		    if (isub > *lda) {
kusano 7d535a
			isub = 1;
kusano 7d535a
			++jsub;
kusano 7d535a
		    }
kusano 7d535a
		    i__3 = isub + jsub * a_dim1;
kusano 7d535a
		    clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1], &
kusano 7d535a
			    d[1], &igrade, &dl[1], &dr[1], &ipvtng, &iwork[1],
kusano 7d535a
			     sparse);
kusano 7d535a
		    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L420: */
kusano 7d535a
		}
kusano 7d535a
/* L430: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 4) {
kusano 7d535a
kusano 7d535a
	    if (isym == 0 || isym == 2) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = 1; i <= i__2; ++i) {
kusano 7d535a
kusano 7d535a
/*                    Compute K = location of (I,J) en
kusano 7d535a
try in packed array */
kusano 7d535a
kusano 7d535a
			if (i == 1) {
kusano 7d535a
			    k = j;
kusano 7d535a
			} else {
kusano 7d535a
			    k = *n * (*n + 1) / 2 - (*n - i + 1) * (*n - i + 
kusano 7d535a
				    2) / 2 + j - i + 1;
kusano 7d535a
			}
kusano 7d535a
kusano 7d535a
/*                    Convert K to (ISUB,JSUB) locatio
kusano 7d535a
n */
kusano 7d535a
kusano 7d535a
			jsub = (k - 1) / *lda + 1;
kusano 7d535a
			isub = k - *lda * (jsub - 1);
kusano 7d535a
kusano 7d535a
			i__3 = isub + jsub * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			if (isym == 0) {
kusano 7d535a
			    i__3 = isub + jsub * a_dim1;
kusano 7d535a
			    r_cnjg(&q__1, &a[isub + jsub * a_dim1]);
kusano 7d535a
			    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			}
kusano 7d535a
/* L440: */
kusano 7d535a
		    }
kusano 7d535a
/* L450: */
kusano 7d535a
		}
kusano 7d535a
	    } else {
kusano 7d535a
		isub = 0;
kusano 7d535a
		jsub = 1;
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = j; i <= i__2; ++i) {
kusano 7d535a
			++isub;
kusano 7d535a
			if (isub > *lda) {
kusano 7d535a
			    isub = 1;
kusano 7d535a
			    ++jsub;
kusano 7d535a
			}
kusano 7d535a
			i__3 = isub + jsub * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L460: */
kusano 7d535a
		    }
kusano 7d535a
/* L470: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 5) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
		    if (i < 1) {
kusano 7d535a
			i__3 = j - i + 1 + (i + *n) * a_dim1;
kusano 7d535a
			a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
		    } else {
kusano 7d535a
			if (isym == 0) {
kusano 7d535a
			    i__3 = j - i + 1 + i * a_dim1;
kusano 7d535a
			    clatm2_(&q__2, m, n, &i, &j, kl, ku, &idist, &
kusano 7d535a
				    iseed[1], &d[1], &igrade, &dl[1], &dr[1], 
kusano 7d535a
				    &ipvtng, &iwork[1], sparse);
kusano 7d535a
			    r_cnjg(&q__1, &q__2);
kusano 7d535a
			    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			} else {
kusano 7d535a
			    i__3 = j - i + 1 + i * a_dim1;
kusano 7d535a
			    clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &
kusano 7d535a
				    iseed[1], &d[1], &igrade, &dl[1], &dr[1], 
kusano 7d535a
				    &ipvtng, &iwork[1], sparse);
kusano 7d535a
			    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			}
kusano 7d535a
		    }
kusano 7d535a
/* L480: */
kusano 7d535a
		}
kusano 7d535a
/* L490: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 6) {
kusano 7d535a
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		i__2 = j;
kusano 7d535a
		for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
		    i__3 = i - j + kuu + 1 + j * a_dim1;
kusano 7d535a
		    clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1], &
kusano 7d535a
			    d[1], &igrade, &dl[1], &dr[1], &ipvtng, &iwork[1],
kusano 7d535a
			     sparse);
kusano 7d535a
		    a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L500: */
kusano 7d535a
		}
kusano 7d535a
/* L510: */
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else if (ipack == 7) {
kusano 7d535a
kusano 7d535a
	    if (isym != 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j;
kusano 7d535a
		    for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
			i__3 = i - j + kuu + 1 + j * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			if (i < 1) {
kusano 7d535a
			    i__3 = j - i + 1 + kuu + (i + *n) * a_dim1;
kusano 7d535a
			    a[i__3].r = 0.f, a[i__3].i = 0.f;
kusano 7d535a
			}
kusano 7d535a
			if (i >= 1 && i != j) {
kusano 7d535a
			    if (isym == 0) {
kusano 7d535a
				i__3 = j - i + 1 + kuu + i * a_dim1;
kusano 7d535a
				r_cnjg(&q__1, &a[i - j + kuu + 1 + j * a_dim1]
kusano 7d535a
					);
kusano 7d535a
				a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
			    } else {
kusano 7d535a
				i__3 = j - i + 1 + kuu + i * a_dim1;
kusano 7d535a
				i__4 = i - j + kuu + 1 + j * a_dim1;
kusano 7d535a
				a[i__3].r = a[i__4].r, a[i__3].i = a[i__4].i;
kusano 7d535a
			    }
kusano 7d535a
			}
kusano 7d535a
/* L520: */
kusano 7d535a
		    }
kusano 7d535a
/* L530: */
kusano 7d535a
		}
kusano 7d535a
	    } else if (isym == 1) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = j + kll;
kusano 7d535a
		    for (i = j - kuu; i <= i__2; ++i) {
kusano 7d535a
			i__3 = i - j + kuu + 1 + j * a_dim1;
kusano 7d535a
			clatm2_(&q__1, m, n, &i, &j, kl, ku, &idist, &iseed[1]
kusano 7d535a
				, &d[1], &igrade, &dl[1], &dr[1], &ipvtng, &
kusano 7d535a
				iwork[1], sparse);
kusano 7d535a
			a[i__3].r = q__1.r, a[i__3].i = q__1.i;
kusano 7d535a
/* L540: */
kusano 7d535a
		    }
kusano 7d535a
/* L550: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     5)      Scaling the norm */
kusano 7d535a
kusano 7d535a
    if (ipack == 0) {
kusano 7d535a
	onorm = clange_("M", m, n, &a[a_offset], lda, tempa);
kusano 7d535a
    } else if (ipack == 1) {
kusano 7d535a
	onorm = clansy_("M", "U", n, &a[a_offset], lda, tempa);
kusano 7d535a
    } else if (ipack == 2) {
kusano 7d535a
	onorm = clansy_("M", "L", n, &a[a_offset], lda, tempa);
kusano 7d535a
    } else if (ipack == 3) {
kusano 7d535a
	onorm = clansp_("M", "U", n, &a[a_offset], tempa);
kusano 7d535a
    } else if (ipack == 4) {
kusano 7d535a
	onorm = clansp_("M", "L", n, &a[a_offset], tempa);
kusano 7d535a
    } else if (ipack == 5) {
kusano 7d535a
	onorm = clansb_("M", "L", n, &kll, &a[a_offset], lda, tempa);
kusano 7d535a
    } else if (ipack == 6) {
kusano 7d535a
	onorm = clansb_("M", "U", n, &kuu, &a[a_offset], lda, tempa);
kusano 7d535a
    } else if (ipack == 7) {
kusano 7d535a
	onorm = clangb_("M", n, &kll, &kuu, &a[a_offset], lda, tempa);
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    if (*anorm >= 0.f) {
kusano 7d535a
kusano 7d535a
	if (*anorm > 0.f && onorm == 0.f) {
kusano 7d535a
kusano 7d535a
/*           Desired scaling impossible */
kusano 7d535a
kusano 7d535a
	    *info = 5;
kusano 7d535a
	    return 0;
kusano 7d535a
kusano 7d535a
	} else if (*anorm > 1.f && onorm < 1.f || *anorm < 1.f && onorm > 1.f)
kusano 7d535a
		 {
kusano 7d535a
kusano 7d535a
/*           Scale carefully to avoid over / underflow */
kusano 7d535a
kusano 7d535a
	    if (ipack <= 2) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    r__1 = 1.f / onorm;
kusano 7d535a
		    csscal_(m, &r__1, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
		    csscal_(m, anorm, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
/* L560: */
kusano 7d535a
		}
kusano 7d535a
kusano 7d535a
	    } else if (ipack == 3 || ipack == 4) {
kusano 7d535a
kusano 7d535a
		i__1 = *n * (*n + 1) / 2;
kusano 7d535a
		r__1 = 1.f / onorm;
kusano 7d535a
		csscal_(&i__1, &r__1, &a[a_offset], &c__1);
kusano 7d535a
		i__1 = *n * (*n + 1) / 2;
kusano 7d535a
		csscal_(&i__1, anorm, &a[a_offset], &c__1);
kusano 7d535a
kusano 7d535a
	    } else if (ipack >= 5) {
kusano 7d535a
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = kll + kuu + 1;
kusano 7d535a
		    r__1 = 1.f / onorm;
kusano 7d535a
		    csscal_(&i__2, &r__1, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
		    i__2 = kll + kuu + 1;
kusano 7d535a
		    csscal_(&i__2, anorm, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
/* L570: */
kusano 7d535a
		}
kusano 7d535a
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	} else {
kusano 7d535a
kusano 7d535a
/*           Scale straightforwardly */
kusano 7d535a
kusano 7d535a
	    if (ipack <= 2) {
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    r__1 = *anorm / onorm;
kusano 7d535a
		    csscal_(m, &r__1, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
/* L580: */
kusano 7d535a
		}
kusano 7d535a
kusano 7d535a
	    } else if (ipack == 3 || ipack == 4) {
kusano 7d535a
kusano 7d535a
		i__1 = *n * (*n + 1) / 2;
kusano 7d535a
		r__1 = *anorm / onorm;
kusano 7d535a
		csscal_(&i__1, &r__1, &a[a_offset], &c__1);
kusano 7d535a
kusano 7d535a
	    } else if (ipack >= 5) {
kusano 7d535a
kusano 7d535a
		i__1 = *n;
kusano 7d535a
		for (j = 1; j <= i__1; ++j) {
kusano 7d535a
		    i__2 = kll + kuu + 1;
kusano 7d535a
		    r__1 = *anorm / onorm;
kusano 7d535a
		    csscal_(&i__2, &r__1, &a[j * a_dim1 + 1], &c__1);
kusano 7d535a
/* L590: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     End of CLATMR */
kusano 7d535a
kusano 7d535a
    return 0;
kusano 7d535a
} /* clatmr_ */
kusano 7d535a