PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
slaset.f
Go to the documentation of this file.
1  SUBROUTINE slaset( UPLO, M, N, ALPHA, BETA, A, LDA )
2 *
3 * -- LAPACK auxiliary routine (version 3.2) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8  CHARACTER uplo
9  INTEGER lda, m, n
10  REAL alpha, beta
11 * ..
12 * .. Array Arguments ..
13  REAL a( lda, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * SLASET initializes an m-by-n matrix A to BETA on the diagonal and
20 * ALPHA on the offdiagonals.
21 *
22 * Arguments
23 * =========
24 *
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.
32 *
33 * M (input) INTEGER
34 * The number of rows of the matrix A. M >= 0.
35 *
36 * N (input) INTEGER
37 * The number of columns of the matrix A. N >= 0.
38 *
39 * ALPHA (input) REAL
40 * The constant to which the offdiagonal elements are to be set.
41 *
42 * BETA (input) REAL
43 * The constant to which the diagonal elements are to be set.
44 *
45 * A (input/output) REAL array, dimension (LDA,N)
46 * On exit, the leading m-by-n submatrix of A is set as follows:
47 *
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,
51 *
52 * and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).
53 *
54 * LDA (input) INTEGER
55 * The leading dimension of the array A. LDA >= max(1,M).
56 *
57 * =====================================================================
58 *
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 ..
70 *
71  IF( lsame( uplo, 'U' ) ) THEN
72 *
73 * Set the strictly upper triangular or trapezoidal part of the
74 * array to ALPHA.
75 *
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
81 *
82  ELSE IF( lsame( uplo, 'L' ) ) THEN
83 *
84 * Set the strictly lower triangular or trapezoidal part of the
85 * array to ALPHA.
86 *
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
92 *
93  ELSE
94 *
95 * Set the leading m-by-n submatrix to ALPHA.
96 *
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
103 *
104 * Set the first min(M,N) diagonal elements to BETA.
105 *
106  DO 70 i = 1, min( m, n )
107  a( i, i ) = beta
108  70 continue
109 *
110  return
111 *
112 * End of SLASET
113 *
114  END