/src/igraph/vendor/lapack/dlaset.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -- translated by f2c (version 20191129). |
2 | | You must link the resulting object file with libf2c: |
3 | | on Microsoft Windows system, link with libf2c.lib; |
4 | | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
5 | | or, if you install libf2c.a in a standard place, with -lf2c -lm |
6 | | -- in that order, at the end of the command line, as in |
7 | | cc *.o -lf2c -lm |
8 | | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
9 | | |
10 | | http://www.netlib.org/f2c/libf2c.zip |
11 | | */ |
12 | | |
13 | | #include "f2c.h" |
14 | | |
15 | | /* > \brief \b DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given val |
16 | | ues. |
17 | | |
18 | | =========== DOCUMENTATION =========== |
19 | | |
20 | | Online html documentation available at |
21 | | http://www.netlib.org/lapack/explore-html/ |
22 | | |
23 | | > \htmlonly |
24 | | > Download DLASET + dependencies |
25 | | > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlaset. |
26 | | f"> |
27 | | > [TGZ]</a> |
28 | | > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlaset. |
29 | | f"> |
30 | | > [ZIP]</a> |
31 | | > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlaset. |
32 | | f"> |
33 | | > [TXT]</a> |
34 | | > \endhtmlonly |
35 | | |
36 | | Definition: |
37 | | =========== |
38 | | |
39 | | SUBROUTINE DLASET( UPLO, M, N, ALPHA, BETA, A, LDA ) |
40 | | |
41 | | CHARACTER UPLO |
42 | | INTEGER LDA, M, N |
43 | | DOUBLE PRECISION ALPHA, BETA |
44 | | DOUBLE PRECISION A( LDA, * ) |
45 | | |
46 | | |
47 | | > \par Purpose: |
48 | | ============= |
49 | | > |
50 | | > \verbatim |
51 | | > |
52 | | > DLASET initializes an m-by-n matrix A to BETA on the diagonal and |
53 | | > ALPHA on the offdiagonals. |
54 | | > \endverbatim |
55 | | |
56 | | Arguments: |
57 | | ========== |
58 | | |
59 | | > \param[in] UPLO |
60 | | > \verbatim |
61 | | > UPLO is CHARACTER*1 |
62 | | > Specifies the part of the matrix A to be set. |
63 | | > = 'U': Upper triangular part is set; the strictly lower |
64 | | > triangular part of A is not changed. |
65 | | > = 'L': Lower triangular part is set; the strictly upper |
66 | | > triangular part of A is not changed. |
67 | | > Otherwise: All of the matrix A is set. |
68 | | > \endverbatim |
69 | | > |
70 | | > \param[in] M |
71 | | > \verbatim |
72 | | > M is INTEGER |
73 | | > The number of rows of the matrix A. M >= 0. |
74 | | > \endverbatim |
75 | | > |
76 | | > \param[in] N |
77 | | > \verbatim |
78 | | > N is INTEGER |
79 | | > The number of columns of the matrix A. N >= 0. |
80 | | > \endverbatim |
81 | | > |
82 | | > \param[in] ALPHA |
83 | | > \verbatim |
84 | | > ALPHA is DOUBLE PRECISION |
85 | | > The constant to which the offdiagonal elements are to be set. |
86 | | > \endverbatim |
87 | | > |
88 | | > \param[in] BETA |
89 | | > \verbatim |
90 | | > BETA is DOUBLE PRECISION |
91 | | > The constant to which the diagonal elements are to be set. |
92 | | > \endverbatim |
93 | | > |
94 | | > \param[in,out] A |
95 | | > \verbatim |
96 | | > A is DOUBLE PRECISION array, dimension (LDA,N) |
97 | | > On exit, the leading m-by-n submatrix of A is set as follows: |
98 | | > |
99 | | > if UPLO = 'U', A(i,j) = ALPHA, 1<=i<=j-1, 1<=j<=n, |
100 | | > if UPLO = 'L', A(i,j) = ALPHA, j+1<=i<=m, 1<=j<=n, |
101 | | > otherwise, A(i,j) = ALPHA, 1<=i<=m, 1<=j<=n, i.ne.j, |
102 | | > |
103 | | > and, for all UPLO, A(i,i) = BETA, 1<=i<=min(m,n). |
104 | | > \endverbatim |
105 | | > |
106 | | > \param[in] LDA |
107 | | > \verbatim |
108 | | > LDA is INTEGER |
109 | | > The leading dimension of the array A. LDA >= max(1,M). |
110 | | > \endverbatim |
111 | | |
112 | | Authors: |
113 | | ======== |
114 | | |
115 | | > \author Univ. of Tennessee |
116 | | > \author Univ. of California Berkeley |
117 | | > \author Univ. of Colorado Denver |
118 | | > \author NAG Ltd. |
119 | | |
120 | | > \date September 2012 |
121 | | |
122 | | > \ingroup auxOTHERauxiliary |
123 | | |
124 | | ===================================================================== |
125 | | Subroutine */ int igraphdlaset_(char *uplo, integer *m, integer *n, doublereal * |
126 | | alpha, doublereal *beta, doublereal *a, integer *lda) |
127 | 0 | { |
128 | | /* System generated locals */ |
129 | 0 | integer a_dim1, a_offset, i__1, i__2, i__3; |
130 | | |
131 | | /* Local variables */ |
132 | 0 | integer i__, j; |
133 | 0 | extern logical igraphlsame_(char *, char *); |
134 | | |
135 | | |
136 | | /* -- LAPACK auxiliary routine (version 3.4.2) -- |
137 | | -- LAPACK is a software package provided by Univ. of Tennessee, -- |
138 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
139 | | September 2012 |
140 | | |
141 | | |
142 | | ===================================================================== |
143 | | |
144 | | |
145 | | Parameter adjustments */ |
146 | 0 | a_dim1 = *lda; |
147 | 0 | a_offset = 1 + a_dim1; |
148 | 0 | a -= a_offset; |
149 | | |
150 | | /* Function Body */ |
151 | 0 | if (igraphlsame_(uplo, "U")) { |
152 | | |
153 | | /* Set the strictly upper triangular or trapezoidal part of the |
154 | | array to ALPHA. */ |
155 | |
|
156 | 0 | i__1 = *n; |
157 | 0 | for (j = 2; j <= i__1; ++j) { |
158 | | /* Computing MIN */ |
159 | 0 | i__3 = j - 1; |
160 | 0 | i__2 = min(i__3,*m); |
161 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
162 | 0 | a[i__ + j * a_dim1] = *alpha; |
163 | | /* L10: */ |
164 | 0 | } |
165 | | /* L20: */ |
166 | 0 | } |
167 | |
|
168 | 0 | } else if (igraphlsame_(uplo, "L")) { |
169 | | |
170 | | /* Set the strictly lower triangular or trapezoidal part of the |
171 | | array to ALPHA. */ |
172 | |
|
173 | 0 | i__1 = min(*m,*n); |
174 | 0 | for (j = 1; j <= i__1; ++j) { |
175 | 0 | i__2 = *m; |
176 | 0 | for (i__ = j + 1; i__ <= i__2; ++i__) { |
177 | 0 | a[i__ + j * a_dim1] = *alpha; |
178 | | /* L30: */ |
179 | 0 | } |
180 | | /* L40: */ |
181 | 0 | } |
182 | |
|
183 | 0 | } else { |
184 | | |
185 | | /* Set the leading m-by-n submatrix to ALPHA. */ |
186 | |
|
187 | 0 | i__1 = *n; |
188 | 0 | for (j = 1; j <= i__1; ++j) { |
189 | 0 | i__2 = *m; |
190 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
191 | 0 | a[i__ + j * a_dim1] = *alpha; |
192 | | /* L50: */ |
193 | 0 | } |
194 | | /* L60: */ |
195 | 0 | } |
196 | 0 | } |
197 | | |
198 | | /* Set the first min(M,N) diagonal elements to BETA. */ |
199 | |
|
200 | 0 | i__1 = min(*m,*n); |
201 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
202 | 0 | a[i__ + i__ * a_dim1] = *beta; |
203 | | /* L70: */ |
204 | 0 | } |
205 | |
|
206 | 0 | return 0; |
207 | | |
208 | | /* End of DLASET */ |
209 | |
|
210 | 0 | } /* igraphdlaset_ */ |
211 | | |