| 1 |
/* ./src_f77/sdot.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
doublereal sdot_(integer *n, real *sx, integer *incx, real *sy, integer *incy) |
| 9 |
{ |
| 10 |
/* System generated locals */ |
| 11 |
integer i__1; |
| 12 |
real ret_val; |
| 13 |
|
| 14 |
/* Local variables */ |
| 15 |
static integer i__, m, ix, iy, mp1; |
| 16 |
static real stemp; |
| 17 |
|
| 18 |
|
| 19 |
/* forms the dot product of two vectors. */ |
| 20 |
/* uses unrolled loops for increments equal to one. */ |
| 21 |
/* jack dongarra, linpack, 3/11/78. */ |
| 22 |
/* modified 12/3/93, array(1) declarations changed to array(*) */ |
| 23 |
|
| 24 |
|
| 25 |
/* Parameter adjustments */ |
| 26 |
--sy; |
| 27 |
--sx; |
| 28 |
|
| 29 |
/* Function Body */ |
| 30 |
stemp = 0.f; |
| 31 |
ret_val = 0.f; |
| 32 |
if (*n <= 0) { |
| 33 |
return ret_val; |
| 34 |
} |
| 35 |
if (*incx == 1 && *incy == 1) { |
| 36 |
goto L20; |
| 37 |
} |
| 38 |
|
| 39 |
/* code for unequal increments or equal increments */ |
| 40 |
/* not equal to 1 */ |
| 41 |
|
| 42 |
ix = 1; |
| 43 |
iy = 1; |
| 44 |
if (*incx < 0) { |
| 45 |
ix = (-(*n) + 1) * *incx + 1; |
| 46 |
} |
| 47 |
if (*incy < 0) { |
| 48 |
iy = (-(*n) + 1) * *incy + 1; |
| 49 |
} |
| 50 |
i__1 = *n; |
| 51 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 52 |
stemp += sx[ix] * sy[iy]; |
| 53 |
ix += *incx; |
| 54 |
iy += *incy; |
| 55 |
/* L10: */ |
| 56 |
} |
| 57 |
ret_val = stemp; |
| 58 |
return ret_val; |
| 59 |
|
| 60 |
/* code for both increments equal to 1 */ |
| 61 |
|
| 62 |
|
| 63 |
/* clean-up loop */ |
| 64 |
|
| 65 |
L20: |
| 66 |
m = *n % 5; |
| 67 |
if (m == 0) { |
| 68 |
goto L40; |
| 69 |
} |
| 70 |
i__1 = m; |
| 71 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 72 |
stemp += sx[i__] * sy[i__]; |
| 73 |
/* L30: */ |
| 74 |
} |
| 75 |
if (*n < 5) { |
| 76 |
goto L60; |
| 77 |
} |
| 78 |
L40: |
| 79 |
mp1 = m + 1; |
| 80 |
i__1 = *n; |
| 81 |
for (i__ = mp1; i__ <= i__1; i__ += 5) { |
| 82 |
stemp = stemp + sx[i__] * sy[i__] + sx[i__ + 1] * sy[i__ + 1] + sx[ |
| 83 |
i__ + 2] * sy[i__ + 2] + sx[i__ + 3] * sy[i__ + 3] + sx[i__ + |
| 84 |
4] * sy[i__ + 4]; |
| 85 |
/* L50: */ |
| 86 |
} |
| 87 |
L60: |
| 88 |
ret_val = stemp; |
| 89 |
return ret_val; |
| 90 |
} /* sdot_ */ |
| 91 |
|