ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/linregr.h
Revision: 2.5
Committed: Fri Jun 6 16:38:47 2003 UTC (20 years, 11 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 2.4: +11 -8 lines
Log Message:
*** empty log message ***

File Contents

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