| 1 |
/* ./src_f77/dsdot.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 |
/* DECK DSDOT */ |
| 9 |
doublereal dsdot_(integer *n, real *sx, integer *incx, real *sy, integer * |
| 10 |
incy) |
| 11 |
{ |
| 12 |
/* System generated locals */ |
| 13 |
integer i__1, i__2; |
| 14 |
doublereal ret_val; |
| 15 |
|
| 16 |
/* Local variables */ |
| 17 |
static integer i__, ns, kx, ky; |
| 18 |
|
| 19 |
/* ***BEGIN PROLOGUE DSDOT */ |
| 20 |
/* ***PURPOSE Compute the inner product of two vectors with extended */ |
| 21 |
/* precision accumulation and result. */ |
| 22 |
/* ***LIBRARY SLATEC (BLAS) */ |
| 23 |
/* ***CATEGORY D1A4 */ |
| 24 |
/* ***TYPE DOUBLE PRECISION (DSDOT-D, DCDOT-C) */ |
| 25 |
/* ***KEYWORDS BLAS, COMPLEX VECTORS, DOT PRODUCT, INNER PRODUCT, */ |
| 26 |
/* LINEAR ALGEBRA, VECTOR */ |
| 27 |
/* ***AUTHOR Lawson, C. L., (JPL) */ |
| 28 |
/* Hanson, R. J., (SNLA) */ |
| 29 |
/* Kincaid, D. R., (U. of Texas) */ |
| 30 |
/* Krogh, F. T., (JPL) */ |
| 31 |
/* ***DESCRIPTION */ |
| 32 |
|
| 33 |
/* B L A S Subprogram */ |
| 34 |
/* Description of Parameters */ |
| 35 |
|
| 36 |
/* --Input-- */ |
| 37 |
/* N number of elements in input vector(s) */ |
| 38 |
/* SX single precision vector with N elements */ |
| 39 |
/* INCX storage spacing between elements of SX */ |
| 40 |
/* SY single precision vector with N elements */ |
| 41 |
/* INCY storage spacing between elements of SY */ |
| 42 |
|
| 43 |
/* --Output-- */ |
| 44 |
/* DSDOT double precision dot product (zero if N.LE.0) */ |
| 45 |
|
| 46 |
/* Returns D.P. dot product accumulated in D.P., for S.P. SX and SY */ |
| 47 |
/* DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY), */ |
| 48 |
/* where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is */ |
| 49 |
/* defined in a similar way using INCY. */ |
| 50 |
|
| 51 |
/* ***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T. */ |
| 52 |
/* Krogh, Basic linear algebra subprograms for Fortran */ |
| 53 |
/* usage, Algorithm No. 539, Transactions on Mathematical */ |
| 54 |
/* Software 5, 3 (September 1979), pp. 308-323. */ |
| 55 |
/* ***ROUTINES CALLED (NONE) */ |
| 56 |
/* ***REVISION HISTORY (YYMMDD) */ |
| 57 |
/* 791001 DATE WRITTEN */ |
| 58 |
/* 890831 Modified array declarations. (WRB) */ |
| 59 |
/* 890831 REVISION DATE from Version 3.2 */ |
| 60 |
/* 891214 Prologue converted to Version 4.0 format. (BAB) */ |
| 61 |
/* 920310 Corrected definition of LX in DESCRIPTION. (WRB) */ |
| 62 |
/* 920501 Reformatted the REFERENCES section. (WRB) */ |
| 63 |
/* ***END PROLOGUE DSDOT */ |
| 64 |
/* ***FIRST EXECUTABLE STATEMENT DSDOT */ |
| 65 |
/* Parameter adjustments */ |
| 66 |
--sy; |
| 67 |
--sx; |
| 68 |
|
| 69 |
/* Function Body */ |
| 70 |
ret_val = 0.; |
| 71 |
if (*n <= 0) { |
| 72 |
return ret_val; |
| 73 |
} |
| 74 |
if (*incx == *incy && *incx > 0) { |
| 75 |
goto L20; |
| 76 |
} |
| 77 |
|
| 78 |
/* Code for unequal or nonpositive increments. */ |
| 79 |
|
| 80 |
kx = 1; |
| 81 |
ky = 1; |
| 82 |
if (*incx < 0) { |
| 83 |
kx = (1 - *n) * *incx + 1; |
| 84 |
} |
| 85 |
if (*incy < 0) { |
| 86 |
ky = (1 - *n) * *incy + 1; |
| 87 |
} |
| 88 |
i__1 = *n; |
| 89 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 90 |
ret_val += (doublereal) sx[kx] * (doublereal) sy[ky]; |
| 91 |
kx += *incx; |
| 92 |
ky += *incy; |
| 93 |
/* L10: */ |
| 94 |
} |
| 95 |
return ret_val; |
| 96 |
|
| 97 |
/* Code for equal, positive, non-unit increments. */ |
| 98 |
|
| 99 |
L20: |
| 100 |
ns = *n * *incx; |
| 101 |
i__1 = ns; |
| 102 |
i__2 = *incx; |
| 103 |
for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { |
| 104 |
ret_val += (doublereal) sx[i__] * (doublereal) sy[i__]; |
| 105 |
/* L30: */ |
| 106 |
} |
| 107 |
return ret_val; |
| 108 |
} /* dsdot_ */ |
| 109 |
|