ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/linregr.h
Revision: 2.4
Committed: Tue Feb 25 02:47:21 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.3: +2 -57 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

# Content
1 /* RCSid $Id$ */
2 /*
3 * Header file for linear regression calculation.
4 */
5
6 #include "copyright.h"
7
8 typedef struct {
9 double xs, ys, xxs, yys, xys;
10 int n;
11 } LRSUM;
12
13 typedef struct {
14 double slope, intercept, correlation;
15 } LRLIN;
16
17 #define lrpoint(x,y,l) ((l)->xs+=(x),(l)->ys+=(y),(l)->xxs+=(x)*(x), \
18 (l)->yys+=(y)*(y),(l)->xys+=(x)*(y),++(l)->n)
19
20 #define lrxavg(l) ((l)->xs/(l)->n)
21 #define lryavg(l) ((l)->ys/(l)->n)
22 #define lrxvar(l) (((l)->xxs-(l)->xs*(l)->xs/(l)->n)/(l)->n)
23 #define lryvar(l) (((l)->yys-(l)->ys*(l)->ys/(l)->n)/(l)->n)
24 #define lrxdev(l) sqrt(((l)->xxs-(l)->xs*(l)->xs/(l)->n)/((l)->n-1))
25 #define lrydev(l) sqrt(((l)->yys-(l)->ys*(l)->ys/(l)->n)/((l)->n-1))
26
27 #ifdef NOPROTO
28
29 extern void lrclear();
30 extern int flrpoint();
31 extern int lrfit();
32
33 #else
34
35 extern void lrclear(LRSUM *l);
36 extern int flrpoint(double x, double y, LRSUM *l);
37 extern int lrfit(LRLIN *r, LRSUM *l);
38
39 #endif