More volume overlaps corrected
[u/mrichter/AliRoot.git] / ISAJET / code / lstsq.F
CommitLineData
0795afa3 1#include "isajet/pilot.h"
2 SUBROUTINE LSTSQ(X,Y,NPT,A,B)
3C
4C DO LEAST SQUARE FIT TO A STRAIGHT LINE Y=A+B*X
5C
6#include "isajet/itapes.inc"
7 DIMENSION X(NPT),Y(NPT)
8 SUM1=0
9 SUM2=0
10 SUM3=0
11 SUM4=0
12 DO 1 I=1,NPT
13 SUM1=SUM1+X(I)
14 SUM2=SUM2+Y(I)
15 SUM3=SUM3+X(I)**2
16 SUM4=SUM4+X(I)*Y(I)
17 1 CONTINUE
18 B=(SUM2*SUM1-SUM4*NPT)/(SUM1**2-SUM3*NPT)
19 A=(SUM2-B*SUM1)/NPT
20 RETURN
21 END