|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* -- translated by f2c (version 19940927).
|
|
kusano |
7d535a |
You must link the resulting object file with the libraries:
|
|
kusano |
7d535a |
-lf2c -lm (in that order)
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include "f2c.h"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
real sasum_(integer *n, real *sx, integer *incx)
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* System generated locals */
|
|
kusano |
7d535a |
integer i__1, i__2;
|
|
kusano |
7d535a |
real ret_val, r__1, r__2, r__3, r__4, r__5, r__6;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Local variables */
|
|
kusano |
7d535a |
static integer i, m, nincx;
|
|
kusano |
7d535a |
static real stemp;
|
|
kusano |
7d535a |
static integer mp1;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* takes the sum of the absolute values.
|
|
kusano |
7d535a |
uses unrolled loops for increment equal to one.
|
|
kusano |
7d535a |
jack dongarra, linpack, 3/11/78.
|
|
kusano |
7d535a |
modified 3/93 to return if incx .le. 0.
|
|
kusano |
7d535a |
modified 12/3/93, array(1) declarations changed to array(*)
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Parameter adjustments
|
|
kusano |
7d535a |
Function Body */
|
|
kusano |
7d535a |
#define SX(I) sx[(I)-1]
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
ret_val = 0.f;
|
|
kusano |
7d535a |
stemp = 0.f;
|
|
kusano |
7d535a |
if (*n <= 0 || *incx <= 0) {
|
|
kusano |
7d535a |
return ret_val;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (*incx == 1) {
|
|
kusano |
7d535a |
goto L20;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* code for increment not equal to 1 */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
nincx = *n * *incx;
|
|
kusano |
7d535a |
i__1 = nincx;
|
|
kusano |
7d535a |
i__2 = *incx;
|
|
kusano |
7d535a |
for (i = 1; *incx < 0 ? i >= nincx : i <= nincx; i += *incx) {
|
|
kusano |
7d535a |
stemp += (r__1 = SX(i), dabs(r__1));
|
|
kusano |
7d535a |
/* L10: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
ret_val = stemp;
|
|
kusano |
7d535a |
return ret_val;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* code for increment equal to 1
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
clean-up loop */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
L20:
|
|
kusano |
7d535a |
m = *n % 6;
|
|
kusano |
7d535a |
if (m == 0) {
|
|
kusano |
7d535a |
goto L40;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__2 = m;
|
|
kusano |
7d535a |
for (i = 1; i <= m; ++i) {
|
|
kusano |
7d535a |
stemp += (r__1 = SX(i), dabs(r__1));
|
|
kusano |
7d535a |
/* L30: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (*n < 6) {
|
|
kusano |
7d535a |
goto L60;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
L40:
|
|
kusano |
7d535a |
mp1 = m + 1;
|
|
kusano |
7d535a |
i__2 = *n;
|
|
kusano |
7d535a |
for (i = mp1; i <= *n; i += 6) {
|
|
kusano |
7d535a |
stemp = stemp + (r__1 = SX(i), dabs(r__1)) + (r__2 = SX(i + 1), dabs(
|
|
kusano |
7d535a |
r__2)) + (r__3 = SX(i + 2), dabs(r__3)) + (r__4 = SX(i + 3),
|
|
kusano |
7d535a |
dabs(r__4)) + (r__5 = SX(i + 4), dabs(r__5)) + (r__6 = SX(i +
|
|
kusano |
7d535a |
5), dabs(r__6));
|
|
kusano |
7d535a |
/* L50: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
L60:
|
|
kusano |
7d535a |
ret_val = stemp;
|
|
kusano |
7d535a |
return ret_val;
|
|
kusano |
7d535a |
} /* sasum_ */
|
|
kusano |
7d535a |
|