|
kusano |
2b45e8 |
*DECK DSDOT
|
|
kusano |
2b45e8 |
DOUBLE PRECISION FUNCTION DSDOTF (N, SX, INCX, SY, INCY)
|
|
kusano |
2b45e8 |
C***BEGIN PROLOGUE DSDOT
|
|
kusano |
2b45e8 |
C***PURPOSE Compute the inner product of two vectors with extended
|
|
kusano |
2b45e8 |
C precision accumulation and result.
|
|
kusano |
2b45e8 |
C***LIBRARY SLATEC (BLAS)
|
|
kusano |
2b45e8 |
C***CATEGORY D1A4
|
|
kusano |
2b45e8 |
C***TYPE DOUBLE PRECISION (DSDOT-D, DCDOT-C)
|
|
kusano |
2b45e8 |
C***KEYWORDS BLAS, COMPLEX VECTORS, DOT PRODUCT, INNER PRODUCT,
|
|
kusano |
2b45e8 |
C LINEAR ALGEBRA, VECTOR
|
|
kusano |
2b45e8 |
C***AUTHOR Lawson, C. L., (JPL)
|
|
kusano |
2b45e8 |
C Hanson, R. J., (SNLA)
|
|
kusano |
2b45e8 |
C Kincaid, D. R., (U. of Texas)
|
|
kusano |
2b45e8 |
C Krogh, F. T., (JPL)
|
|
kusano |
2b45e8 |
C***DESCRIPTION
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C B L A S Subprogram
|
|
kusano |
2b45e8 |
C Description of Parameters
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C --Input--
|
|
kusano |
2b45e8 |
C N number of elements in input vector(s)
|
|
kusano |
2b45e8 |
C SX single precision vector with N elements
|
|
kusano |
2b45e8 |
C INCX storage spacing between elements of SX
|
|
kusano |
2b45e8 |
C SY single precision vector with N elements
|
|
kusano |
2b45e8 |
C INCY storage spacing between elements of SY
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C --Output--
|
|
kusano |
2b45e8 |
C DSDOT double precision dot product (zero if N.LE.0)
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
|
|
kusano |
2b45e8 |
C DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY),
|
|
kusano |
2b45e8 |
C where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
|
|
kusano |
2b45e8 |
C defined in a similar way using INCY.
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
|
|
kusano |
2b45e8 |
C Krogh, Basic linear algebra subprograms for Fortran
|
|
kusano |
2b45e8 |
C usage, Algorithm No. 539, Transactions on Mathematical
|
|
kusano |
2b45e8 |
C Software 5, 3 (September 1979), pp. 308-323.
|
|
kusano |
2b45e8 |
C***ROUTINES CALLED (NONE)
|
|
kusano |
2b45e8 |
C***REVISION HISTORY (YYMMDD)
|
|
kusano |
2b45e8 |
C 791001 DATE WRITTEN
|
|
kusano |
2b45e8 |
C 890831 Modified array declarations. (WRB)
|
|
kusano |
2b45e8 |
C 890831 REVISION DATE from Version 3.2
|
|
kusano |
2b45e8 |
C 891214 Prologue converted to Version 4.0 format. (BAB)
|
|
kusano |
2b45e8 |
C 920310 Corrected definition of LX in DESCRIPTION. (WRB)
|
|
kusano |
2b45e8 |
C 920501 Reformatted the REFERENCES section. (WRB)
|
|
kusano |
2b45e8 |
C***END PROLOGUE DSDOT
|
|
kusano |
2b45e8 |
REAL SX(*),SY(*)
|
|
kusano |
2b45e8 |
C***FIRST EXECUTABLE STATEMENT DSDOT
|
|
kusano |
2b45e8 |
DSDOTF = 0.0D0
|
|
kusano |
2b45e8 |
IF (N .LE. 0) RETURN
|
|
kusano |
2b45e8 |
IF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 20
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C Code for unequal or nonpositive increments.
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
KX = 1
|
|
kusano |
2b45e8 |
KY = 1
|
|
kusano |
2b45e8 |
IF (INCX .LT. 0) KX = 1+(1-N)*INCX
|
|
kusano |
2b45e8 |
IF (INCY .LT. 0) KY = 1+(1-N)*INCY
|
|
kusano |
2b45e8 |
DO 10 I = 1,N
|
|
kusano |
2b45e8 |
DSDOTF = DSDOTF + DBLE(SX(KX))*DBLE(SY(KY))
|
|
kusano |
2b45e8 |
KX = KX + INCX
|
|
kusano |
2b45e8 |
KY = KY + INCY
|
|
kusano |
2b45e8 |
10 CONTINUE
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
C Code for equal, positive, non-unit increments.
|
|
kusano |
2b45e8 |
C
|
|
kusano |
2b45e8 |
20 NS = N*INCX
|
|
kusano |
2b45e8 |
DO 30 I = 1,NS,INCX
|
|
kusano |
2b45e8 |
DSDOTF = DSDOTF + DBLE(SX(I))*DBLE(SY(I))
|
|
kusano |
2b45e8 |
30 CONTINUE
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END
|