Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2789 added Finbarr O'Sullivan smoothing spline code

File size: 1.3 KB
Line 
1      DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX)
2*     .. Scalar Arguments ..
3      INTEGER INCX,N
4*     ..
5*     .. Array Arguments ..
6      DOUBLE PRECISION DX(*)
7*     ..
8*
9*  Purpose
10*  =======
11*
12*     takes the sum of the absolute values.
13*     jack dongarra, linpack, 3/11/78.
14*     modified 3/93 to return if incx .le. 0.
15*     modified 12/3/93, array(1) declarations changed to array(*)
16*
17*
18*     .. Local Scalars ..
19      DOUBLE PRECISION DTEMP
20      INTEGER I,M,MP1,NINCX
21*     ..
22*     .. Intrinsic Functions ..
23      INTRINSIC DABS,MOD
24*     ..
25      DASUM = 0.0d0
26      DTEMP = 0.0d0
27      IF (N.LE.0 .OR. INCX.LE.0) RETURN
28      IF (INCX.EQ.1) GO TO 20
29*
30*        code for increment not equal to 1
31*
32      NINCX = N*INCX
33      DO 10 I = 1,NINCX,INCX
34          DTEMP = DTEMP + DABS(DX(I))
35   10 CONTINUE
36      DASUM = DTEMP
37      RETURN
38*
39*        code for increment equal to 1
40*
41*
42*        clean-up loop
43*
44   20 M = MOD(N,6)
45      IF (M.EQ.0) GO TO 40
46      DO 30 I = 1,M
47          DTEMP = DTEMP + DABS(DX(I))
48   30 CONTINUE
49      IF (N.LT.6) GO TO 60
50   40 MP1 = M + 1
51      DO 50 I = MP1,N,6
52          DTEMP = DTEMP + DABS(DX(I)) + DABS(DX(I+1)) + DABS(DX(I+2)) +
53     +            DABS(DX(I+3)) + DABS(DX(I+4)) + DABS(DX(I+5))
54   50 CONTINUE
55   60 DASUM = DTEMP
56      RETURN
57      END
Note: See TracBrowser for help on using the repository browser.