dlaset.c
Go to the documentation of this file.
00001 /* dlaset.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int dlaset_(char *uplo, integer *m, integer *n, doublereal *
00017         alpha, doublereal *beta, doublereal *a, integer *lda)
00018 {
00019     /* System generated locals */
00020     integer a_dim1, a_offset, i__1, i__2, i__3;
00021 
00022     /* Local variables */
00023     integer i__, j;
00024     extern logical lsame_(char *, char *);
00025 
00026 
00027 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00028 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00029 /*     November 2006 */
00030 
00031 /*     .. Scalar Arguments .. */
00032 /*     .. */
00033 /*     .. Array Arguments .. */
00034 /*     .. */
00035 
00036 /*  Purpose */
00037 /*  ======= */
00038 
00039 /*  DLASET initializes an m-by-n matrix A to BETA on the diagonal and */
00040 /*  ALPHA on the offdiagonals. */
00041 
00042 /*  Arguments */
00043 /*  ========= */
00044 
00045 /*  UPLO    (input) CHARACTER*1 */
00046 /*          Specifies the part of the matrix A to be set. */
00047 /*          = 'U':      Upper triangular part is set; the strictly lower */
00048 /*                      triangular part of A is not changed. */
00049 /*          = 'L':      Lower triangular part is set; the strictly upper */
00050 /*                      triangular part of A is not changed. */
00051 /*          Otherwise:  All of the matrix A is set. */
00052 
00053 /*  M       (input) INTEGER */
00054 /*          The number of rows of the matrix A.  M >= 0. */
00055 
00056 /*  N       (input) INTEGER */
00057 /*          The number of columns of the matrix A.  N >= 0. */
00058 
00059 /*  ALPHA   (input) DOUBLE PRECISION */
00060 /*          The constant to which the offdiagonal elements are to be set. */
00061 
00062 /*  BETA    (input) DOUBLE PRECISION */
00063 /*          The constant to which the diagonal elements are to be set. */
00064 
00065 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00066 /*          On exit, the leading m-by-n submatrix of A is set as follows: */
00067 
00068 /*          if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n, */
00069 /*          if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n, */
00070 /*          otherwise,     A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j, */
00071 
00072 /*          and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n). */
00073 
00074 /*  LDA     (input) INTEGER */
00075 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00076 
00077 /* ===================================================================== */
00078 
00079 /*     .. Local Scalars .. */
00080 /*     .. */
00081 /*     .. External Functions .. */
00082 /*     .. */
00083 /*     .. Intrinsic Functions .. */
00084 /*     .. */
00085 /*     .. Executable Statements .. */
00086 
00087     /* Parameter adjustments */
00088     a_dim1 = *lda;
00089     a_offset = 1 + a_dim1;
00090     a -= a_offset;
00091 
00092     /* Function Body */
00093     if (lsame_(uplo, "U")) {
00094 
00095 /*        Set the strictly upper triangular or trapezoidal part of the */
00096 /*        array to ALPHA. */
00097 
00098         i__1 = *n;
00099         for (j = 2; j <= i__1; ++j) {
00100 /* Computing MIN */
00101             i__3 = j - 1;
00102             i__2 = min(i__3,*m);
00103             for (i__ = 1; i__ <= i__2; ++i__) {
00104                 a[i__ + j * a_dim1] = *alpha;
00105 /* L10: */
00106             }
00107 /* L20: */
00108         }
00109 
00110     } else if (lsame_(uplo, "L")) {
00111 
00112 /*        Set the strictly lower triangular or trapezoidal part of the */
00113 /*        array to ALPHA. */
00114 
00115         i__1 = min(*m,*n);
00116         for (j = 1; j <= i__1; ++j) {
00117             i__2 = *m;
00118             for (i__ = j + 1; i__ <= i__2; ++i__) {
00119                 a[i__ + j * a_dim1] = *alpha;
00120 /* L30: */
00121             }
00122 /* L40: */
00123         }
00124 
00125     } else {
00126 
00127 /*        Set the leading m-by-n submatrix to ALPHA. */
00128 
00129         i__1 = *n;
00130         for (j = 1; j <= i__1; ++j) {
00131             i__2 = *m;
00132             for (i__ = 1; i__ <= i__2; ++i__) {
00133                 a[i__ + j * a_dim1] = *alpha;
00134 /* L50: */
00135             }
00136 /* L60: */
00137         }
00138     }
00139 
00140 /*     Set the first min(M,N) diagonal elements to BETA. */
00141 
00142     i__1 = min(*m,*n);
00143     for (i__ = 1; i__ <= i__1; ++i__) {
00144         a[i__ + i__ * a_dim1] = *beta;
00145 /* L70: */
00146     }
00147 
00148     return 0;
00149 
00150 /*     End of DLASET */
00151 
00152 } /* dlaset_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:46