|
Canola
0.8.D001
|
#include <polyfit.h>
Public Types | |
| enum | solve_t { solve_ok, solve_singular, solve_insufficient } |
Public Member Functions | |
| virtual | ~polyfit () |
| polyfit (int order=1) | |
| void | enter (double x, double y) |
| solve_t | solve (void) |
| double | coefficient (int n) |
| double | evaluate (double x) |
| void | print (void) const |
| bool | enough_points (void) const |
Private Types | |
| typedef long double | data_t |
Private Member Functions | |
| data_t ** | mat_alloc () |
| void | mat_dump (data_t **data) |
| void | mat_free (data_t **data) |
| polyfit () | |
| polyfit (const polyfit &) | |
| polyfit & | operator= (const polyfit &) |
Private Attributes | |
| unsigned int | rows |
| unsigned int | cols |
| data_t * | coefficients |
| data_t ** | matrix |
Static Private Attributes | |
| static data_t | epsilon = 1e-8 |
The polyfit class is used to represent the state of a least squares polynomial curve fit.
typedef long double polyfit::data_t [private] |
| enum polyfit::solve_t |
| polyfit::~polyfit | ( | ) | [virtual] |
The destructor.
Definition at line 28 of file polyfit.cc.
| polyfit::polyfit | ( | int | order = 1 | ) |
The constructor.
| order | The desired order of polynomial; 1 is linear, 2 is quadratic, etc. |
Definition at line 37 of file polyfit.cc.
| polyfit::polyfit | ( | ) | [private] |
The default constructor. Do not use.
| polyfit::polyfit | ( | const polyfit & | ) | [private] |
The copy constructor. Do not use.
| double polyfit::coefficient | ( | int | n | ) |
The coefficient method is used to obtain the nth coefficient of the polynomial. Will only produce valid results after the solve method has been called.
| n | The number of the coefficient of interest, corresponding to the x**n term. |
Definition at line 194 of file polyfit.cc.
| bool polyfit::enough_points | ( | void | ) | const [inline] |
| void polyfit::enter | ( | double | x, |
| double | y | ||
| ) |
The enter method is used to add another point to the scatter plot being solved to fit a polynomial.
| x | The X coordinate of the point |
| y | The Y coordinate of the point |
Definition at line 49 of file polyfit.cc.
| double polyfit::evaluate | ( | double | x | ) |
The evaluate method is used to evaluate the fitted polynomial, at the given coordinate.
| x | The X coordinate of interest. |
Definition at line 203 of file polyfit.cc.
| polyfit::data_t ** polyfit::mat_alloc | ( | void | ) | [private] |
| void polyfit::mat_dump | ( | data_t ** | data | ) | [private] |
The mat_dump method is used to print a prepresentation of the matrix to the standard output. Only usefil for debugging.
| data | The matrix to be printed. |
Definition at line 232 of file polyfit.cc.
| void polyfit::mat_free | ( | data_t ** | data | ) | [private] |
The mat_free method is used to release the memory consumed by a matrix.
| data | The matrix to be released. |
Definition at line 245 of file polyfit.cc.
| void polyfit::print | ( | void | ) | const |
The print method is used to print the polynomial to the standard output. Mostly only useful for debugging.
Definition at line 257 of file polyfit.cc.
| polyfit::solve_t polyfit::solve | ( | void | ) |
The solve method is used to solve the point set to produce a polynomial, once all of the points have been entered using the enter method.
Definition at line 68 of file polyfit.cc.
data_t* polyfit::coefficients [private] |
unsigned int polyfit::cols [private] |
polyfit::data_t polyfit::epsilon = 1e-8 [static, private] |
data_t** polyfit::matrix [private] |
unsigned int polyfit::rows [private] |
1.7.6.1