LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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.

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

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

Definition at line 108 of file claset.f.

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