4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_lsq_c
= "$Id$";
35 void init_lsq(t_lsq
*lsq
)
37 lsq
->yy
=lsq
->yx
=lsq
->xx
=lsq
->sx
=lsq
->sy
=0.0;
41 int npoints_lsq(t_lsq
*lsq
)
46 void done_lsq(t_lsq
*lsq
)
51 void add_lsq(t_lsq
*lsq
,real x
,real y
)
61 void get_lsq_ab(t_lsq
*lsq
,real
*a
,real
*b
)
70 (*a
)=(yx
-sx
*sy
)/(xx
-sx
*sx
);
74 real
aver_lsq(t_lsq
*lsq
)
77 fatal_error(0,"No points in distribution\n");
79 return (lsq
->sy
/lsq
->np
);
82 real
sigma_lsq(t_lsq
*lsq
)
85 fatal_error(0,"No points in distribution\n");
87 return sqrt(lsq
->yy
/lsq
->np
- sqr(lsq
->sy
/lsq
->np
));
90 real
error_lsq(t_lsq
*lsq
)
92 return sigma_lsq(lsq
)/sqrt(lsq
->np
);