| 1 |
*DECK DSDOT |
| 2 |
DOUBLE PRECISION FUNCTION DSDOT (N, SX, INCX, SY, INCY) |
| 3 |
C***BEGIN PROLOGUE DSDOT |
| 4 |
C***PURPOSE Compute the inner product of two vectors with extended |
| 5 |
C precision accumulation and result. |
| 6 |
C***LIBRARY SLATEC (BLAS) |
| 7 |
C***CATEGORY D1A4 |
| 8 |
C***TYPE DOUBLE PRECISION (DSDOT-D, DCDOT-C) |
| 9 |
C***KEYWORDS BLAS, COMPLEX VECTORS, DOT PRODUCT, INNER PRODUCT, |
| 10 |
C LINEAR ALGEBRA, VECTOR |
| 11 |
C***AUTHOR Lawson, C. L., (JPL) |
| 12 |
C Hanson, R. J., (SNLA) |
| 13 |
C Kincaid, D. R., (U. of Texas) |
| 14 |
C Krogh, F. T., (JPL) |
| 15 |
C***DESCRIPTION |
| 16 |
C |
| 17 |
C B L A S Subprogram |
| 18 |
C Description of Parameters |
| 19 |
C |
| 20 |
C --Input-- |
| 21 |
C N number of elements in input vector(s) |
| 22 |
C SX single precision vector with N elements |
| 23 |
C INCX storage spacing between elements of SX |
| 24 |
C SY single precision vector with N elements |
| 25 |
C INCY storage spacing between elements of SY |
| 26 |
C |
| 27 |
C --Output-- |
| 28 |
C DSDOT double precision dot product (zero if N.LE.0) |
| 29 |
C |
| 30 |
C Returns D.P. dot product accumulated in D.P., for S.P. SX and SY |
| 31 |
C DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY), |
| 32 |
C where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is |
| 33 |
C defined in a similar way using INCY. |
| 34 |
C |
| 35 |
C***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T. |
| 36 |
C Krogh, Basic linear algebra subprograms for Fortran |
| 37 |
C usage, Algorithm No. 539, Transactions on Mathematical |
| 38 |
C Software 5, 3 (September 1979), pp. 308-323. |
| 39 |
C***ROUTINES CALLED (NONE) |
| 40 |
C***REVISION HISTORY (YYMMDD) |
| 41 |
C 791001 DATE WRITTEN |
| 42 |
C 890831 Modified array declarations. (WRB) |
| 43 |
C 890831 REVISION DATE from Version 3.2 |
| 44 |
C 891214 Prologue converted to Version 4.0 format. (BAB) |
| 45 |
C 920310 Corrected definition of LX in DESCRIPTION. (WRB) |
| 46 |
C 920501 Reformatted the REFERENCES section. (WRB) |
| 47 |
C***END PROLOGUE DSDOT |
| 48 |
REAL SX(*),SY(*) |
| 49 |
C***FIRST EXECUTABLE STATEMENT DSDOT |
| 50 |
DSDOT = 0.0D0 |
| 51 |
IF (N .LE. 0) RETURN |
| 52 |
IF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 20 |
| 53 |
C |
| 54 |
C Code for unequal or nonpositive increments. |
| 55 |
C |
| 56 |
KX = 1 |
| 57 |
KY = 1 |
| 58 |
IF (INCX .LT. 0) KX = 1+(1-N)*INCX |
| 59 |
IF (INCY .LT. 0) KY = 1+(1-N)*INCY |
| 60 |
DO 10 I = 1,N |
| 61 |
DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY)) |
| 62 |
KX = KX + INCX |
| 63 |
KY = KY + INCY |
| 64 |
10 CONTINUE |
| 65 |
RETURN |
| 66 |
C |
| 67 |
C Code for equal, positive, non-unit increments. |
| 68 |
C |
| 69 |
20 NS = N*INCX |
| 70 |
DO 30 I = 1,NS,INCX |
| 71 |
DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I)) |
| 72 |
30 CONTINUE |
| 73 |
RETURN |
| 74 |
END |