|
kusano |
7d535a |
#include "f2c.h"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Subroutine */ int slaset_(char *uplo, integer *m, integer *n, real *alpha,
|
|
kusano |
7d535a |
real *beta, real *a, integer *lda)
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
/* -- LAPACK auxiliary routine (version 2.0) --
|
|
kusano |
7d535a |
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
|
|
kusano |
7d535a |
Courant Institute, Argonne National Lab, and Rice University
|
|
kusano |
7d535a |
October 31, 1992
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Purpose
|
|
kusano |
7d535a |
=======
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
SLASET initializes an m-by-n matrix A to BETA on the diagonal and
|
|
kusano |
7d535a |
ALPHA on the offdiagonals.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Arguments
|
|
kusano |
7d535a |
=========
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
UPLO (input) CHARACTER*1
|
|
kusano |
7d535a |
Specifies the part of the matrix A to be set.
|
|
kusano |
7d535a |
= 'U': Upper triangular part is set; the strictly lower
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
triangular part of A is not changed.
|
|
kusano |
7d535a |
= 'L': Lower triangular part is set; the strictly upper
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
triangular part of A is not changed.
|
|
kusano |
7d535a |
Otherwise: All of the matrix A is set.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
M (input) INTEGER
|
|
kusano |
7d535a |
The number of rows of the matrix A. M >= 0.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
N (input) INTEGER
|
|
kusano |
7d535a |
The number of columns of the matrix A. N >= 0.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
ALPHA (input) REAL
|
|
kusano |
7d535a |
The constant to which the offdiagonal elements are to be set.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
BETA (input) REAL
|
|
kusano |
7d535a |
The constant to which the diagonal elements are to be set.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A (input/output) REAL array, dimension (LDA,N)
|
|
kusano |
7d535a |
On exit, the leading m-by-n submatrix of A is set as follows:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n,
|
|
kusano |
7d535a |
if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n,
|
|
kusano |
7d535a |
otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j,
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n).
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
LDA (input) INTEGER
|
|
kusano |
7d535a |
The leading dimension of the array A. LDA >= max(1,M).
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
=====================================================================
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Parameter adjustments
|
|
kusano |
7d535a |
Function Body */
|
|
kusano |
7d535a |
/* System generated locals */
|
|
kusano |
7d535a |
integer a_dim1, a_offset, i__1, i__2, i__3;
|
|
kusano |
7d535a |
/* Local variables */
|
|
kusano |
7d535a |
static integer i, j;
|
|
kusano |
7d535a |
extern logical lsame_(char *, char *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#define A(I,J) a[(I)-1 + ((J)-1)* ( *lda)]
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (lsame_(uplo, "U")) {
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Set the strictly upper triangular or trapezoidal part of the
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
array to ALPHA. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 2; j <= *n; ++j) {
|
|
kusano |
7d535a |
/* Computing MIN */
|
|
kusano |
7d535a |
i__3 = j - 1;
|
|
kusano |
7d535a |
i__2 = min(i__3,*m);
|
|
kusano |
7d535a |
for (i = 1; i <= min(j-1,*m); ++i) {
|
|
kusano |
7d535a |
A(i,j) = *alpha;
|
|
kusano |
7d535a |
/* L10: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
/* L20: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} else if (lsame_(uplo, "L")) {
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Set the strictly lower triangular or trapezoidal part of the
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
array to ALPHA. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
i__1 = min(*m,*n);
|
|
kusano |
7d535a |
for (j = 1; j <= min(*m,*n); ++j) {
|
|
kusano |
7d535a |
i__2 = *m;
|
|
kusano |
7d535a |
for (i = j + 1; i <= *m; ++i) {
|
|
kusano |
7d535a |
A(i,j) = *alpha;
|
|
kusano |
7d535a |
/* L30: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
/* L40: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Set the leading m-by-n submatrix to ALPHA. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 1; j <= *n; ++j) {
|
|
kusano |
7d535a |
i__2 = *m;
|
|
kusano |
7d535a |
for (i = 1; i <= *m; ++i) {
|
|
kusano |
7d535a |
A(i,j) = *alpha;
|
|
kusano |
7d535a |
/* L50: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
/* L60: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Set the first min(M,N) diagonal elements to BETA. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
i__1 = min(*m,*n);
|
|
kusano |
7d535a |
for (i = 1; i <= min(*m,*n); ++i) {
|
|
kusano |
7d535a |
A(i,i) = *beta;
|
|
kusano |
7d535a |
/* L70: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
return 0;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* End of SLASET */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} /* slaset_ */
|
|
kusano |
7d535a |
|