 LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ slaset()

 subroutine slaset ( character UPLO, integer M, integer N, real ALPHA, real BETA, real, dimension( lda, * ) A, integer LDA )

SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.

Purpose:
``` SLASET initializes an m-by-n matrix A to BETA on the diagonal and
ALPHA on the offdiagonals.```
Parameters
 [in] UPLO ``` UPLO is CHARACTER*1 Specifies the part of the matrix A to be set. = 'U': Upper triangular part is set; the strictly lower triangular part of A is not changed. = 'L': Lower triangular part is set; the strictly upper triangular part of A is not changed. Otherwise: All of the matrix A is set.``` [in] M ``` M is INTEGER The number of rows of the matrix A. M >= 0.``` [in] N ``` N is INTEGER The number of columns of the matrix A. N >= 0.``` [in] ALPHA ``` ALPHA is REAL The constant to which the offdiagonal elements are to be set.``` [in] BETA ``` BETA is REAL The constant to which the diagonal elements are to be set.``` [out] A ``` A is REAL array, dimension (LDA,N) On exit, the leading m-by-n submatrix of A is set as follows: if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n, if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n, otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j, and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).```
Date
December 2016

Definition at line 112 of file slaset.f.

112 *
113 * -- LAPACK auxiliary routine (version 3.7.0) --
114 * -- LAPACK is a software package provided by Univ. of Tennessee, --
115 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * December 2016
117 *
118 * .. Scalar Arguments ..
119  CHARACTER uplo
120  INTEGER lda, m, n
121  REAL alpha, beta
122 * ..
123 * .. Array Arguments ..
124  REAL a( lda, * )
125 * ..
126 *
127 * =====================================================================
128 *
129 * .. Local Scalars ..
130  INTEGER i, j
131 * ..
132 * .. External Functions ..
133  LOGICAL lsame
134  EXTERNAL lsame
135 * ..
136 * .. Intrinsic Functions ..
137  INTRINSIC min
138 * ..
139 * .. Executable Statements ..
140 *
141  IF( lsame( uplo, 'U' ) ) THEN
142 *
143 * Set the strictly upper triangular or trapezoidal part of the
144 * array to ALPHA.
145 *
146  DO 20 j = 2, n
147  DO 10 i = 1, min( j-1, m )
148  a( i, j ) = alpha
149  10 CONTINUE
150  20 CONTINUE
151 *
152  ELSE IF( lsame( uplo, 'L' ) ) THEN
153 *
154 * Set the strictly lower triangular or trapezoidal part of the
155 * array to ALPHA.
156 *
157  DO 40 j = 1, min( m, n )
158  DO 30 i = j + 1, m
159  a( i, j ) = alpha
160  30 CONTINUE
161  40 CONTINUE
162 *
163  ELSE
164 *
165 * Set the leading m-by-n submatrix to ALPHA.
166 *
167  DO 60 j = 1, n
168  DO 50 i = 1, m
169  a( i, j ) = alpha
170  50 CONTINUE
171  60 CONTINUE
172  END IF
173 *
174 * Set the first min(M,N) diagonal elements to BETA.
175 *
176  DO 70 i = 1, min( m, n )
177  a( i, i ) = beta
178  70 CONTINUE
179 *
180  RETURN
181 *
182 * End of SLASET
183 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55