Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2789_MathNetNumerics-Exploration/HeuristicLab.Algorithms.DataAnalysis.Experimental/sbart/dsdot.f @ 17456

Last change on this file since 17456 was 15457, checked in by gkronber, 7 years ago

#2789 added Finbarr O'Sullivan smoothing spline code

File size: 2.6 KB
Line 
1      DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
2*     .. Scalar Arguments ..
3      INTEGER INCX,INCY,N
4*     ..
5*     .. Array Arguments ..
6      REAL SX(*),SY(*)
7*     ..
8*
9*  AUTHORS
10*  =======
11*  Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
12*  Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
13*
14*  Purpose
15*  =======
16*  Compute the inner product of two vectors with extended
17*  precision accumulation and result.
18*
19*  Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
20*  DSDOT = sum for I = 0 to N-1 of  SX(LX+I*INCX) * SY(LY+I*INCY),
21*  where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
22*  defined in a similar way using INCY.
23*
24*  Arguments
25*  =========
26*
27*  N      (input) INTEGER
28*         number of elements in input vector(s)
29*
30*  SX     (input) REAL array, dimension(N)
31*         single precision vector with N elements
32*
33*  INCX   (input) INTEGER
34*          storage spacing between elements of SX
35*
36*  SY     (input) REAL array, dimension(N)
37*         single precision vector with N elements
38*
39*  INCY   (input) INTEGER
40*         storage spacing between elements of SY
41*
42*  DSDOT  (output) DOUBLE PRECISION
43*         DSDOT  double precision dot product (zero if N.LE.0)
44*
45*  REFERENCES
46*  ==========
47*     
48*  C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
49*  Krogh, Basic linear algebra subprograms for Fortran
50*  usage, Algorithm No. 539, Transactions on Mathematical
51*  Software 5, 3 (September 1979), pp. 308-323.
52*
53*  REVISION HISTORY  (YYMMDD)
54*  ==========================
55*
56*  791001  DATE WRITTEN
57*  890831  Modified array declarations.  (WRB)
58*  890831  REVISION DATE from Version 3.2
59*  891214  Prologue converted to Version 4.0 format.  (BAB)
60*  920310  Corrected definition of LX in DESCRIPTION.  (WRB)
61*  920501  Reformatted the REFERENCES section.  (WRB)
62*  070118  Reformat to LAPACK style (JL)
63*
64*  =====================================================================
65*
66*     .. Local Scalars ..
67      INTEGER I,KX,KY,NS
68*     ..
69*     .. Intrinsic Functions ..
70      INTRINSIC DBLE
71*     ..
72      DSDOT = 0.0D0
73      IF (N.LE.0) RETURN
74      IF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 20
75*
76*     Code for unequal or nonpositive increments.
77*
78      KX = 1
79      KY = 1
80      IF (INCX.LT.0) KX = 1 + (1-N)*INCX
81      IF (INCY.LT.0) KY = 1 + (1-N)*INCY
82      DO 10 I = 1,N
83          DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
84          KX = KX + INCX
85          KY = KY + INCY
86   10 CONTINUE
87      RETURN
88*
89*     Code for equal, positive, non-unit increments.
90*
91   20 NS = N*INCX
92      DO 30 I = 1,NS,INCX
93          DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
94   30 CONTINUE
95      RETURN
96      END
Note: See TracBrowser for help on using the repository browser.