| 1 |
*DECK SDSDOT |
| 2 |
REAL FUNCTION SDSDOT (N, SB, SX, INCX, SY, INCY) |
| 3 |
C***BEGIN PROLOGUE SDSDOT |
| 4 |
C***PURPOSE Compute the inner product of two vectors with extended |
| 5 |
C precision accumulation. |
| 6 |
C***LIBRARY SLATEC (BLAS) |
| 7 |
C***CATEGORY D1A4 |
| 8 |
C***TYPE SINGLE PRECISION (SDSDOT-S, CDCDOT-C) |
| 9 |
C***KEYWORDS BLAS, DOT PRODUCT, INNER PRODUCT, LINEAR ALGEBRA, VECTOR |
| 10 |
C***AUTHOR Lawson, C. L., (JPL) |
| 11 |
C Hanson, R. J., (SNLA) |
| 12 |
C Kincaid, D. R., (U. of Texas) |
| 13 |
C Krogh, F. T., (JPL) |
| 14 |
C***DESCRIPTION |
| 15 |
C |
| 16 |
C B L A S Subprogram |
| 17 |
C Description of Parameters |
| 18 |
C |
| 19 |
C --Input-- |
| 20 |
C N number of elements in input vector(s) |
| 21 |
C SB single precision scalar to be added to inner product |
| 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 SDSDOT single precision dot product (SB if N .LE. 0) |
| 29 |
C |
| 30 |
C Returns S.P. result with dot product accumulated in D.P. |
| 31 |
C SDSDOT = SB + 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 890531 Changed all specific intrinsics to generic. (WRB) |
| 43 |
C 890831 Modified array declarations. (WRB) |
| 44 |
C 890831 REVISION DATE from Version 3.2 |
| 45 |
C 891214 Prologue converted to Version 4.0 format. (BAB) |
| 46 |
C 920310 Corrected definition of LX in DESCRIPTION. (WRB) |
| 47 |
C 920501 Reformatted the REFERENCES section. (WRB) |
| 48 |
C***END PROLOGUE SDSDOT |
| 49 |
REAL SX(*), SY(*), SB |
| 50 |
DOUBLE PRECISION DSDOT |
| 51 |
C***FIRST EXECUTABLE STATEMENT SDSDOT |
| 52 |
DSDOT = SB |
| 53 |
IF (N .LE. 0) GO TO 30 |
| 54 |
IF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 40 |
| 55 |
C |
| 56 |
C Code for unequal or nonpositive increments. |
| 57 |
C |
| 58 |
KX = 1 |
| 59 |
KY = 1 |
| 60 |
IF (INCX .LT. 0) KX = 1+(1-N)*INCX |
| 61 |
IF (INCY .LT. 0) KY = 1+(1-N)*INCY |
| 62 |
DO 10 I = 1,N |
| 63 |
DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY)) |
| 64 |
KX = KX + INCX |
| 65 |
KY = KY + INCY |
| 66 |
10 CONTINUE |
| 67 |
30 SDSDOT = DSDOT |
| 68 |
RETURN |
| 69 |
C |
| 70 |
C Code for equal and positive increments. |
| 71 |
C |
| 72 |
40 NS = N*INCX |
| 73 |
DO 50 I = 1,NS,INCX |
| 74 |
DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I)) |
| 75 |
50 CONTINUE |
| 76 |
SDSDOT = DSDOT |
| 77 |
RETURN |
| 78 |
END |