Some function moved to AliZDC
[u/mrichter/AliRoot.git] / GEANT321 / gstrag / gstint.F
... / ...
CommitLineData
1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1995/10/24 10:21:39 cernlib
6* Geant
7*
8*
9#include "geant321/pilot.h"
10*CMZ : 3.21/02 29/03/94 15.41.25 by S.Giani
11*-- Author :
12 FUNCTION GSTINT(X,A,F,N)
13*
14* Simple linear interpolation
15*
16 DIMENSION A(N),F(N)
17 DATA K1,K2,NO/0,0,0/
18*
19* Check (N==NO) & (A(K1)<X<A(K2))
20*
21 IF (N.NE.NO.OR.A(K1).GT.X.OR.X.GT.A(K2)) THEN
22*
23* Skip Unless N>1
24*
25 IF (N.LE.1) THEN
26 GSTINT=F(1)
27 GO TO 999
28 ENDIF
29 K1=1
30 K2=N
31 NO=N
32*
33* Loop over K2-K1>1
34*
35 10 K=(K1+K2)/2
36*
37* Check A(K)<X
38*
39 IF (A(K).LT.X) THEN
40 K1=K
41 ELSE
42 K2=K
43 END IF
44 IF(K2-K1.GT.1) GO TO 10
45 END IF
46 X1=A(K1)
47 X2=A(K2)
48 GSTINT=(F(K1)*(X-X2)+F(K2)*(X1-X))/(X1-X2)
49*
50 999 END