Line | |
---|
1 | /***************************************************************************
|
---|
2 | linearregression.h - description
|
---|
3 | -------------------
|
---|
4 | begin : Tue Apr 8 2003
|
---|
5 | copyright : (C) 2003 by Martin Merck
|
---|
6 | email : merck@astro.uni-wuerzburg.de
|
---|
7 | ***************************************************************************/
|
---|
8 |
|
---|
9 | /***************************************************************************
|
---|
10 | * *
|
---|
11 | * This program is free software; you can redistribute it and/or modify *
|
---|
12 | * it under the terms of the GNU General Public License as published by *
|
---|
13 | * the Free Software Foundation; either version 2 of the License, or *
|
---|
14 | * (at your option) any later version. *
|
---|
15 | * *
|
---|
16 | ***************************************************************************/
|
---|
17 |
|
---|
18 | #ifndef LINEARREGRESSION_H
|
---|
19 | #define LINEARREGRESSION_H
|
---|
20 |
|
---|
21 |
|
---|
22 | /**Performs a linear regression through the points given.
|
---|
23 | *@author Martin Merck
|
---|
24 | */
|
---|
25 |
|
---|
26 | class LinearRegression
|
---|
27 | {
|
---|
28 | public:
|
---|
29 | LinearRegression();
|
---|
30 | ~LinearRegression();
|
---|
31 | void reset();
|
---|
32 | void addPoint( int p_iX, int p_iY );
|
---|
33 | void addPoint( double p_dX, double p_dY );
|
---|
34 | bool isValid() { return( ( m_iNum > 1 ) ? true : false ); };
|
---|
35 | double getAxis();
|
---|
36 | double getSlope();
|
---|
37 |
|
---|
38 | private:
|
---|
39 | double m_dSX; // Sum over all X
|
---|
40 | double m_dSY; // Sum over all Y
|
---|
41 | double m_dSXY; // Sum over all X * Y
|
---|
42 | double m_dSXX; // Sum over all X^2
|
---|
43 | int m_iNum;
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.