exciting-0.9.218
[exciting.git] / src / LAPACK / dlaset.f
blobfc7bc2f548934d0d69b2c1d06035949688a96d31
1 SUBROUTINE DLASET( UPLO, M, N, ALPHA, BETA, A, LDA )
3 * -- LAPACK auxiliary routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
7 * .. Scalar Arguments ..
8 CHARACTER UPLO
9 INTEGER LDA, M, N
10 DOUBLE PRECISION ALPHA, BETA
11 * ..
12 * .. Array Arguments ..
13 DOUBLE PRECISION A( LDA, * )
14 * ..
16 * Purpose
17 * =======
19 * DLASET initializes an m-by-n matrix A to BETA on the diagonal and
20 * ALPHA on the offdiagonals.
22 * Arguments
23 * =========
25 * UPLO (input) CHARACTER*1
26 * Specifies the part of the matrix A to be set.
27 * = 'U': Upper triangular part is set; the strictly lower
28 * triangular part of A is not changed.
29 * = 'L': Lower triangular part is set; the strictly upper
30 * triangular part of A is not changed.
31 * Otherwise: All of the matrix A is set.
33 * M (input) INTEGER
34 * The number of rows of the matrix A. M >= 0.
36 * N (input) INTEGER
37 * The number of columns of the matrix A. N >= 0.
39 * ALPHA (input) DOUBLE PRECISION
40 * The constant to which the offdiagonal elements are to be set.
42 * BETA (input) DOUBLE PRECISION
43 * The constant to which the diagonal elements are to be set.
45 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
46 * On exit, the leading m-by-n submatrix of A is set as follows:
48 * if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n,
49 * if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n,
50 * otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j,
52 * and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).
54 * LDA (input) INTEGER
55 * The leading dimension of the array A. LDA >= max(1,M).
57 * =====================================================================
59 * .. Local Scalars ..
60 INTEGER I, J
61 * ..
62 * .. External Functions ..
63 LOGICAL LSAME
64 EXTERNAL LSAME
65 * ..
66 * .. Intrinsic Functions ..
67 INTRINSIC MIN
68 * ..
69 * .. Executable Statements ..
71 IF( LSAME( UPLO, 'U' ) ) THEN
73 * Set the strictly upper triangular or trapezoidal part of the
74 * array to ALPHA.
76 DO 20 J = 2, N
77 DO 10 I = 1, MIN( J-1, M )
78 A( I, J ) = ALPHA
79 10 CONTINUE
80 20 CONTINUE
82 ELSE IF( LSAME( UPLO, 'L' ) ) THEN
84 * Set the strictly lower triangular or trapezoidal part of the
85 * array to ALPHA.
87 DO 40 J = 1, MIN( M, N )
88 DO 30 I = J + 1, M
89 A( I, J ) = ALPHA
90 30 CONTINUE
91 40 CONTINUE
93 ELSE
95 * Set the leading m-by-n submatrix to ALPHA.
97 DO 60 J = 1, N
98 DO 50 I = 1, M
99 A( I, J ) = ALPHA
100 50 CONTINUE
101 60 CONTINUE
102 END IF
104 * Set the first min(M,N) diagonal elements to BETA.
106 DO 70 I = 1, MIN( M, N )
107 A( I, I ) = BETA
108 70 CONTINUE
110 RETURN
112 * End of DLASET