LAPACK  3.10.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.

Download SLASET + dependencies [TGZ] [ZIP] [TXT]

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).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 109 of file slaset.f.

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