Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2789_MathNetNumerics-Exploration/HeuristicLab.Algorithms.DataAnalysis.Experimental/sbart/idamax.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: 1.1 KB
Line 
1      INTEGER FUNCTION IDAMAX(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*     finds the index of element having max. absolute value.
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 DMAX
20      INTEGER I,IX
21*     ..
22*     .. Intrinsic Functions ..
23      INTRINSIC DABS
24*     ..
25      IDAMAX = 0
26      IF (N.LT.1 .OR. INCX.LE.0) RETURN
27      IDAMAX = 1
28      IF (N.EQ.1) RETURN
29      IF (INCX.EQ.1) GO TO 20
30*
31*        code for increment not equal to 1
32*
33      IX = 1
34      DMAX = DABS(DX(1))
35      IX = IX + INCX
36      DO 10 I = 2,N
37          IF (DABS(DX(IX)).LE.DMAX) GO TO 5
38          IDAMAX = I
39          DMAX = DABS(DX(IX))
40    5     IX = IX + INCX
41   10 CONTINUE
42      RETURN
43*
44*        code for increment equal to 1
45*
46   20 DMAX = DABS(DX(1))
47      DO 30 I = 2,N
48          IF (DABS(DX(I)).LE.DMAX) GO TO 30
49          IDAMAX = I
50          DMAX = DABS(DX(I))
51   30 CONTINUE
52      RETURN
53      END
Note: See TracBrowser for help on using the repository browser.