LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE SLASET( UPLO, M, N, ALPHA, BETA, A, LDA ) 00002 * 00003 * -- LAPACK auxiliary routine (version 3.2) -- 00004 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00005 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER UPLO 00010 INTEGER LDA, M, N 00011 REAL ALPHA, BETA 00012 * .. 00013 * .. Array Arguments .. 00014 REAL A( LDA, * ) 00015 * .. 00016 * 00017 * Purpose 00018 * ======= 00019 * 00020 * SLASET initializes an m-by-n matrix A to BETA on the diagonal and 00021 * ALPHA on the offdiagonals. 00022 * 00023 * Arguments 00024 * ========= 00025 * 00026 * UPLO (input) CHARACTER*1 00027 * Specifies the part of the matrix A to be set. 00028 * = 'U': Upper triangular part is set; the strictly lower 00029 * triangular part of A is not changed. 00030 * = 'L': Lower triangular part is set; the strictly upper 00031 * triangular part of A is not changed. 00032 * Otherwise: All of the matrix A is set. 00033 * 00034 * M (input) INTEGER 00035 * The number of rows of the matrix A. M >= 0. 00036 * 00037 * N (input) INTEGER 00038 * The number of columns of the matrix A. N >= 0. 00039 * 00040 * ALPHA (input) REAL 00041 * The constant to which the offdiagonal elements are to be set. 00042 * 00043 * BETA (input) REAL 00044 * The constant to which the diagonal elements are to be set. 00045 * 00046 * A (input/output) REAL array, dimension (LDA,N) 00047 * On exit, the leading m-by-n submatrix of A is set as follows: 00048 * 00049 * if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n, 00050 * if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n, 00051 * otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j, 00052 * 00053 * and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n). 00054 * 00055 * LDA (input) INTEGER 00056 * The leading dimension of the array A. LDA >= max(1,M). 00057 * 00058 * ===================================================================== 00059 * 00060 * .. Local Scalars .. 00061 INTEGER I, J 00062 * .. 00063 * .. External Functions .. 00064 LOGICAL LSAME 00065 EXTERNAL LSAME 00066 * .. 00067 * .. Intrinsic Functions .. 00068 INTRINSIC MIN 00069 * .. 00070 * .. Executable Statements .. 00071 * 00072 IF( LSAME( UPLO, 'U' ) ) THEN 00073 * 00074 * Set the strictly upper triangular or trapezoidal part of the 00075 * array to ALPHA. 00076 * 00077 DO 20 J = 2, N 00078 DO 10 I = 1, MIN( J-1, M ) 00079 A( I, J ) = ALPHA 00080 10 CONTINUE 00081 20 CONTINUE 00082 * 00083 ELSE IF( LSAME( UPLO, 'L' ) ) THEN 00084 * 00085 * Set the strictly lower triangular or trapezoidal part of the 00086 * array to ALPHA. 00087 * 00088 DO 40 J = 1, MIN( M, N ) 00089 DO 30 I = J + 1, M 00090 A( I, J ) = ALPHA 00091 30 CONTINUE 00092 40 CONTINUE 00093 * 00094 ELSE 00095 * 00096 * Set the leading m-by-n submatrix to ALPHA. 00097 * 00098 DO 60 J = 1, N 00099 DO 50 I = 1, M 00100 A( I, J ) = ALPHA 00101 50 CONTINUE 00102 60 CONTINUE 00103 END IF 00104 * 00105 * Set the first min(M,N) diagonal elements to BETA. 00106 * 00107 DO 70 I = 1, MIN( M, N ) 00108 A( I, I ) = BETA 00109 70 CONTINUE 00110 * 00111 RETURN 00112 * 00113 * End of SLASET 00114 * 00115 END