Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2789 added Finbarr O'Sullivan smoothing spline code

File size: 1.6 KB
Line 
1      REAL FUNCTION SDOT(N,SX,INCX,SY,INCY)
2*     .. Scalar Arguments ..
3      INTEGER INCX,INCY,N
4*     ..
5*     .. Array Arguments ..
6      REAL SX(*),SY(*)
7*     ..
8*
9*  Purpose
10*  =======
11*
12*     SDOT forms the dot product of two vectors.
13*     uses unrolled loops for increments equal to one.
14*
15*  Further Details
16*  ===============
17*
18*     jack dongarra, linpack, 3/11/78.
19*     modified 12/3/93, array(1) declarations changed to array(*)
20*
21*  =====================================================================
22*
23*     .. Local Scalars ..
24      REAL STEMP
25      INTEGER I,IX,IY,M,MP1
26*     ..
27*     .. Intrinsic Functions ..
28      INTRINSIC MOD
29*     ..
30      STEMP = 0.0e0
31      SDOT = 0.0e0
32      IF (N.LE.0) RETURN
33      IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
34*
35*        code for both increments equal to 1
36*
37*
38*        clean-up loop
39*
40         M = MOD(N,5)
41         IF (M.NE.0) THEN
42            DO I = 1,M
43               STEMP = STEMP + SX(I)*SY(I)
44            END DO
45            IF (N.LT.5) THEN
46               SDOT=STEMP
47            RETURN
48            END IF
49         END IF
50         MP1 = M + 1
51         DO I = MP1,N,5
52          STEMP = STEMP + SX(I)*SY(I) + SX(I+1)*SY(I+1) +
53     $            SX(I+2)*SY(I+2) + SX(I+3)*SY(I+3) + SX(I+4)*SY(I+4)
54         END DO
55      ELSE
56*
57*        code for unequal increments or equal increments
58*          not equal to 1
59*
60         IX = 1
61         IY = 1
62         IF (INCX.LT.0) IX = (-N+1)*INCX + 1
63         IF (INCY.LT.0) IY = (-N+1)*INCY + 1
64         DO I = 1,N
65            STEMP = STEMP + SX(IX)*SY(IY)
66            IX = IX + INCX
67            IY = IY + INCY
68         END DO
69      END IF
70      SDOT = STEMP
71      RETURN
72      END
Note: See TracBrowser for help on using the repository browser.