Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2789_MathNetNumerics-Exploration/HeuristicLab.Algorithms.DataAnalysis.Experimental/sbart/saxpy.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.4 KB
Line 
1      SUBROUTINE SAXPY(N,SA,SX,INCX,SY,INCY)
2*     .. Scalar Arguments ..
3      REAL SA
4      INTEGER INCX,INCY,N
5*     ..
6*     .. Array Arguments ..
7      REAL SX(*),SY(*)
8*     ..
9*
10*  Purpose
11*  =======
12*
13*     SAXPY constant times a vector plus a vector.
14*     uses unrolled loop for increments equal to one.
15*     jack dongarra, linpack, 3/11/78.
16*     modified 12/3/93, array(1) declarations changed to array(*)
17*
18*
19*     .. Local Scalars ..
20      INTEGER I,IX,IY,M,MP1
21*     ..
22*     .. Intrinsic Functions ..
23      INTRINSIC MOD
24*     ..
25      IF (N.LE.0) RETURN
26      IF (SA.EQ.0.0) RETURN
27      IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20
28*
29*        code for unequal increments or equal increments
30*          not equal to 1
31*
32      IX = 1
33      IY = 1
34      IF (INCX.LT.0) IX = (-N+1)*INCX + 1
35      IF (INCY.LT.0) IY = (-N+1)*INCY + 1
36      DO 10 I = 1,N
37          SY(IY) = SY(IY) + SA*SX(IX)
38          IX = IX + INCX
39          IY = IY + INCY
40   10 CONTINUE
41      RETURN
42*
43*        code for both increments equal to 1
44*
45*
46*        clean-up loop
47*
48   20 M = MOD(N,4)
49      IF (M.EQ.0) GO TO 40
50      DO 30 I = 1,M
51          SY(I) = SY(I) + SA*SX(I)
52   30 CONTINUE
53      IF (N.LT.4) RETURN
54   40 MP1 = M + 1
55      DO 50 I = MP1,N,4
56          SY(I) = SY(I) + SA*SX(I)
57          SY(I+1) = SY(I+1) + SA*SX(I+1)
58          SY(I+2) = SY(I+2) + SA*SX(I+2)
59          SY(I+3) = SY(I+3) + SA*SX(I+3)
60   50 CONTINUE
61      RETURN
62      END
Note: See TracBrowser for help on using the repository browser.