Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
osl_OrthogRegress Class Reference

#include <osl_OrthogRegress.h>

Inheritance diagram for osl_OrthogRegress:
Inheritance graph
[legend]

List of all members.

Public Types

typedef osl_ortho_regress base

Public Member Functions

 osl_OrthogRegress ()
 osl_OrthogRegress (double, double, double)
void IncrByXY (double x, double y)
void DecrByXY (double x, double y)
void Fit ()
double GetA () const
double GetB () const
double GetC () const
double GetCost () const
double GetEstCost () const
void SetEstCost (double v)
void Reset ()
void reset ()
void add_point (double x, double y)
void add_points (double const *, double const *, unsigned)
void add_points (float const *, float const *, unsigned)
void remove_point (double x, double y)
void remove_points (double const *, double const *, unsigned)
void remove_points (float const *, float const *, unsigned)
double cost (double a, double b, double c) const
 The problem is to minimize total squared distance to the line u.x + d = 0, ie.
double rms_cost (double a, double b, double c) const
bool fit (double *a, double *b, double *c) const
bool fit_constrained (double x, double y, double *a, double *b, double *c) const

Public Attributes

unsigned S1
double Sx
double Sy
double Sxx
double Sxy
double Syy

Protected Member Functions

bool fit (double &a, double &b, double &c) const
bool fit_constrained (double x, double y, double &a, double &b, double &c) const
 The problem is to minimize total squared distance from a line passing through a given point x_0 :

Private Attributes

double a_
double b_
double c_
double est_

Detailed Description

Definition at line 17 of file osl_OrthogRegress.h.


Member Typedef Documentation

Definition at line 20 of file osl_OrthogRegress.h.


Constructor & Destructor Documentation

osl_OrthogRegress::osl_OrthogRegress ( ) [inline]

Definition at line 21 of file osl_OrthogRegress.h.

osl_OrthogRegress::osl_OrthogRegress ( double  ,
double  ,
double   
) [inline]

Definition at line 22 of file osl_OrthogRegress.h.


Member Function Documentation

void osl_ortho_regress::add_point ( double  x,
double  y 
) [inline, inherited]

Definition at line 42 of file osl_ortho_regress.h.

void osl_ortho_regress::add_points ( double const *  x,
double const *  y,
unsigned  n 
) [inherited]

Definition at line 15 of file osl_ortho_regress.cxx.

void osl_ortho_regress::add_points ( float const *  x,
float const *  y,
unsigned  n 
) [inherited]

Definition at line 20 of file osl_ortho_regress.cxx.

double osl_ortho_regress::cost ( double  a,
double  b,
double  c 
) const [inherited]

The problem is to minimize total squared distance to the line u.x + d = 0, ie.

: minimize | u.x_i + d |^2 subject to |u|=1

Writing x_i = xbar + y_i, where xbar is the centroid of the point set, the sum becomes | u.(x_i - xbar) |^2 + S1 | u.xbar + d |^2 , so that the optimal line must pass through the centroid. To find u, we find the eigenvector of the scatter matrix M = (x_i - xbar)*(x_i - xbar)^t which has least eigenvalue.

Definition at line 75 of file osl_ortho_regress.cxx.

void osl_OrthogRegress::DecrByXY ( double  x,
double  y 
) [inline]

Definition at line 24 of file osl_OrthogRegress.h.

void osl_OrthogRegress::Fit ( ) [inline]

Definition at line 25 of file osl_OrthogRegress.h.

bool osl_ortho_regress::fit ( double *  a,
double *  b,
double *  c 
) const [inline, inherited]

Definition at line 62 of file osl_ortho_regress.h.

bool osl_ortho_regress::fit ( double &  a,
double &  b,
double &  c 
) const [protected, inherited]

Definition at line 80 of file osl_ortho_regress.cxx.

bool osl_ortho_regress::fit_constrained ( double  x,
double  y,
double *  a,
double *  b,
double *  c 
) const [inline, inherited]

Definition at line 64 of file osl_ortho_regress.h.

bool osl_ortho_regress::fit_constrained ( double  x,
double  y,
double &  a,
double &  b,
double &  c 
) const [protected, inherited]

The problem is to minimize total squared distance from a line passing through a given point x_0 :

minimize | u.x_i + d |^2 subject to |u|=1 u.x_0 + d = 0

But u.x_i + d = u.(x_i - x_0), so that we have to minimize u^t M u , where M = (x_i - x_0)*(x_i - x_0)^t. This is solved by taking the eigenvector of M of least eigenvalue.

Definition at line 107 of file osl_ortho_regress.cxx.

double osl_OrthogRegress::GetA ( ) const [inline]

Definition at line 26 of file osl_OrthogRegress.h.

double osl_OrthogRegress::GetB ( ) const [inline]

Definition at line 27 of file osl_OrthogRegress.h.

double osl_OrthogRegress::GetC ( ) const [inline]

Definition at line 28 of file osl_OrthogRegress.h.

double osl_OrthogRegress::GetCost ( ) const [inline]

Definition at line 29 of file osl_OrthogRegress.h.

double osl_OrthogRegress::GetEstCost ( ) const [inline]

Definition at line 30 of file osl_OrthogRegress.h.

void osl_OrthogRegress::IncrByXY ( double  x,
double  y 
) [inline]

Definition at line 23 of file osl_OrthogRegress.h.

void osl_ortho_regress::remove_point ( double  x,
double  y 
) [inline, inherited]

Definition at line 50 of file osl_ortho_regress.h.

void osl_ortho_regress::remove_points ( double const *  ,
double const *  ,
unsigned   
) [inherited]
void osl_ortho_regress::remove_points ( float const *  ,
float const *  ,
unsigned   
) [inherited]
void osl_ortho_regress::reset ( ) [inline, inherited]

Definition at line 32 of file osl_ortho_regress.h.

void osl_OrthogRegress::Reset ( ) [inline]

Definition at line 32 of file osl_OrthogRegress.h.

double osl_ortho_regress::rms_cost ( double  a,
double  b,
double  c 
) const [inherited]

Definition at line 25 of file osl_ortho_regress.cxx.

void osl_OrthogRegress::SetEstCost ( double  v) [inline]

Definition at line 31 of file osl_OrthogRegress.h.


Member Data Documentation

double osl_OrthogRegress::a_ [private]

Definition at line 35 of file osl_OrthogRegress.h.

double osl_OrthogRegress::b_ [private]

Definition at line 35 of file osl_OrthogRegress.h.

double osl_OrthogRegress::c_ [private]

Definition at line 35 of file osl_OrthogRegress.h.

double osl_OrthogRegress::est_ [private]

Definition at line 36 of file osl_OrthogRegress.h.

unsigned osl_ortho_regress::S1 [inherited]

Definition at line 28 of file osl_ortho_regress.h.

double osl_ortho_regress::Sx [inherited]

Definition at line 29 of file osl_ortho_regress.h.

double osl_ortho_regress::Sxx [inherited]

Definition at line 30 of file osl_ortho_regress.h.

double osl_ortho_regress::Sxy [inherited]

Definition at line 30 of file osl_ortho_regress.h.

double osl_ortho_regress::Sy [inherited]

Definition at line 29 of file osl_ortho_regress.h.

double osl_ortho_regress::Syy [inherited]

Definition at line 30 of file osl_ortho_regress.h.


The documentation for this class was generated from the following file: