kusano 7d535a
#include "f2c.h"
kusano 7d535a
kusano 7d535a
/* Subroutine */ int claset_(char *uplo, integer *m, integer *n, complex *
kusano 7d535a
	alpha, complex *beta, complex *a, integer *lda)
kusano 7d535a
{
kusano 7d535a
/*  -- LAPACK auxiliary 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
       October 31, 1992   
kusano 7d535a
kusano 7d535a
kusano 7d535a
    Purpose   
kusano 7d535a
    =======   
kusano 7d535a
kusano 7d535a
    CLASET initializes a 2-D array A to BETA on the diagonal and   
kusano 7d535a
    ALPHA on the offdiagonals.   
kusano 7d535a
kusano 7d535a
    Arguments   
kusano 7d535a
    =========   
kusano 7d535a
kusano 7d535a
    UPLO    (input) CHARACTER*1   
kusano 7d535a
            Specifies the part of the matrix A to be set.   
kusano 7d535a
            = 'U':      Upper triangular part is set. The lower triangle 
kusano 7d535a
  
kusano 7d535a
                        is unchanged.   
kusano 7d535a
            = 'L':      Lower triangular part is set. The upper triangle 
kusano 7d535a
  
kusano 7d535a
                        is unchanged.   
kusano 7d535a
            Otherwise:  All of the matrix A is set.   
kusano 7d535a
kusano 7d535a
    M       (input) INTEGER   
kusano 7d535a
            On entry, M specifies the number of rows of A.   
kusano 7d535a
kusano 7d535a
    N       (input) INTEGER   
kusano 7d535a
            On entry, N specifies the number of columns of A.   
kusano 7d535a
kusano 7d535a
    ALPHA   (input) COMPLEX   
kusano 7d535a
            All the offdiagonal array elements are set to ALPHA.   
kusano 7d535a
kusano 7d535a
    BETA    (input) COMPLEX   
kusano 7d535a
            All the diagonal array elements are set to BETA.   
kusano 7d535a
kusano 7d535a
    A       (input/output) COMPLEX array, dimension (LDA,N)   
kusano 7d535a
            On entry, the m by n matrix A.   
kusano 7d535a
            On exit, A(i,j) = ALPHA, 1 <= i <= m, 1 <= j <= n, i.ne.j;   
kusano 7d535a
                     A(i,i) = BETA , 1 <= i <= min(m,n)   
kusano 7d535a
kusano 7d535a
    LDA     (input) INTEGER   
kusano 7d535a
            The leading dimension of the array A.  LDA >= max(1,M).   
kusano 7d535a
kusano 7d535a
    ===================================================================== 
kusano 7d535a
  
kusano 7d535a
kusano 7d535a
kusano 7d535a
    
kusano 7d535a
   Parameter adjustments   
kusano 7d535a
       Function Body */
kusano 7d535a
    /* System generated locals */
kusano 7d535a
    integer a_dim1, a_offset, i__1, i__2, i__3;
kusano 7d535a
    /* Local variables */
kusano 7d535a
    static integer i, j;
kusano 7d535a
    extern logical lsame_(char *, char *);
kusano 7d535a
kusano 7d535a
kusano 7d535a
kusano 7d535a
#define A(I,J) a[(I)-1 + ((J)-1)* ( *lda)]
kusano 7d535a
kusano 7d535a
    if (lsame_(uplo, "U")) {
kusano 7d535a
kusano 7d535a
/*        Set the diagonal to BETA and the strictly upper triangular 
kusano 7d535a
  
kusano 7d535a
          part of the array to ALPHA. */
kusano 7d535a
kusano 7d535a
	i__1 = *n;
kusano 7d535a
	for (j = 2; j <= *n; ++j) {
kusano 7d535a
/* Computing MIN */
kusano 7d535a
	    i__3 = j - 1;
kusano 7d535a
	    i__2 = min(i__3,*m);
kusano 7d535a
	    for (i = 1; i <= min(j-1,*m); ++i) {
kusano 7d535a
		i__3 = i + j * a_dim1;
kusano 7d535a
		A(i,j).r = alpha->r, A(i,j).i = alpha->i;
kusano 7d535a
/* L10: */
kusano 7d535a
	    }
kusano 7d535a
/* L20: */
kusano 7d535a
	}
kusano 7d535a
	i__1 = min(*n,*m);
kusano 7d535a
	for (i = 1; i <= min(*n,*m); ++i) {
kusano 7d535a
	    i__2 = i + i * a_dim1;
kusano 7d535a
	    A(i,i).r = beta->r, A(i,i).i = beta->i;
kusano 7d535a
/* L30: */
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    } else if (lsame_(uplo, "L")) {
kusano 7d535a
kusano 7d535a
/*        Set the diagonal to BETA and the strictly lower triangular 
kusano 7d535a
  
kusano 7d535a
          part of the array to ALPHA. */
kusano 7d535a
kusano 7d535a
	i__1 = min(*m,*n);
kusano 7d535a
	for (j = 1; j <= min(*m,*n); ++j) {
kusano 7d535a
	    i__2 = *m;
kusano 7d535a
	    for (i = j + 1; i <= *m; ++i) {
kusano 7d535a
		i__3 = i + j * a_dim1;
kusano 7d535a
		A(i,j).r = alpha->r, A(i,j).i = alpha->i;
kusano 7d535a
/* L40: */
kusano 7d535a
	    }
kusano 7d535a
/* L50: */
kusano 7d535a
	}
kusano 7d535a
	i__1 = min(*n,*m);
kusano 7d535a
	for (i = 1; i <= min(*n,*m); ++i) {
kusano 7d535a
	    i__2 = i + i * a_dim1;
kusano 7d535a
	    A(i,i).r = beta->r, A(i,i).i = beta->i;
kusano 7d535a
/* L60: */
kusano 7d535a
	}
kusano 7d535a
kusano 7d535a
    } else {
kusano 7d535a
kusano 7d535a
/*        Set the array to BETA on the diagonal and ALPHA on the   
kusano 7d535a
          offdiagonal. */
kusano 7d535a
kusano 7d535a
	i__1 = *n;
kusano 7d535a
	for (j = 1; j <= *n; ++j) {
kusano 7d535a
	    i__2 = *m;
kusano 7d535a
	    for (i = 1; i <= *m; ++i) {
kusano 7d535a
		i__3 = i + j * a_dim1;
kusano 7d535a
		A(i,j).r = alpha->r, A(i,j).i = alpha->i;
kusano 7d535a
/* L70: */
kusano 7d535a
	    }
kusano 7d535a
/* L80: */
kusano 7d535a
	}
kusano 7d535a
	i__1 = min(*m,*n);
kusano 7d535a
	for (i = 1; i <= min(*m,*n); ++i) {
kusano 7d535a
	    i__2 = i + i * a_dim1;
kusano 7d535a
	    A(i,i).r = beta->r, A(i,i).i = beta->i;
kusano 7d535a
/* L90: */
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    return 0;
kusano 7d535a
kusano 7d535a
/*     End of CLASET */
kusano 7d535a
kusano 7d535a
} /* claset_ */
kusano 7d535a