 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

◆ claset()

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

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

Purpose:
CLASET initializes a 2-D array 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 lower triangle is unchanged. = 'L': Lower triangular part is set. The upper triangle is unchanged. Otherwise: All of the matrix A is set. [in] M M is INTEGER On entry, M specifies the number of rows of A. [in] N N is INTEGER On entry, N specifies the number of columns of A. [in] ALPHA ALPHA is COMPLEX All the offdiagonal array elements are set to ALPHA. [in] BETA BETA is COMPLEX All the diagonal array elements are set to BETA. [out] A A is COMPLEX array, dimension (LDA,N) On entry, the m by n matrix A. On exit, A(i,j) = ALPHA, 1 <= i <= m, 1 <= j <= n, i.ne.j; 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).

Definition at line 105 of file claset.f.

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