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