LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlaset()

subroutine dlaset ( character uplo,
integer m,
integer n,
double precision alpha,
double precision beta,
double precision, dimension( lda, * ) a,
integer lda )

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

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

Purpose:
!>
!> DLASET 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 DOUBLE PRECISION
!>          The constant to which the offdiagonal elements are to be set.
!> 
[in]BETA
!>          BETA is DOUBLE PRECISION
!>          The constant to which the diagonal elements are to be set.
!> 
[out]A
!>          A is DOUBLE PRECISION 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 107 of file dlaset.f.

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