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

#include <vdgl_OrthogRegress.h>

Inheritance diagram for vdgl_OrthogRegress:
Inheritance graph
[legend]

List of all members.

Public Types

typedef vdgl_ortho_regress base

Public Member Functions

 vdgl_OrthogRegress ()
 vdgl_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 16 of file vdgl_OrthogRegress.h.


Member Typedef Documentation

Definition at line 21 of file vdgl_OrthogRegress.h.


Constructor & Destructor Documentation

vdgl_OrthogRegress::vdgl_OrthogRegress ( ) [inline]

Definition at line 22 of file vdgl_OrthogRegress.h.

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

Definition at line 23 of file vdgl_OrthogRegress.h.


Member Function Documentation

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

Definition at line 38 of file vdgl_ortho_regress.h.

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

Definition at line 14 of file vdgl_ortho_regress.cxx.

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

Definition at line 19 of file vdgl_ortho_regress.cxx.

double vdgl_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 74 of file vdgl_ortho_regress.cxx.

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

Definition at line 25 of file vdgl_OrthogRegress.h.

void vdgl_OrthogRegress::Fit ( ) [inline]

Definition at line 26 of file vdgl_OrthogRegress.h.

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

Definition at line 58 of file vdgl_ortho_regress.h.

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

Definition at line 79 of file vdgl_ortho_regress.cxx.

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

Definition at line 60 of file vdgl_ortho_regress.h.

bool vdgl_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 106 of file vdgl_ortho_regress.cxx.

double vdgl_OrthogRegress::GetA ( ) const [inline]

Definition at line 27 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::GetB ( ) const [inline]

Definition at line 28 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::GetC ( ) const [inline]

Definition at line 29 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::GetCost ( ) const [inline]

Definition at line 30 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::GetEstCost ( ) const [inline]

Definition at line 31 of file vdgl_OrthogRegress.h.

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

Definition at line 24 of file vdgl_OrthogRegress.h.

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

Definition at line 46 of file vdgl_ortho_regress.h.

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

Definition at line 28 of file vdgl_ortho_regress.h.

void vdgl_OrthogRegress::Reset ( ) [inline]

Definition at line 33 of file vdgl_OrthogRegress.h.

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

Definition at line 24 of file vdgl_ortho_regress.cxx.

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

Definition at line 32 of file vdgl_OrthogRegress.h.


Member Data Documentation

double vdgl_OrthogRegress::a_ [private]

Definition at line 18 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::b_ [private]

Definition at line 18 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::c_ [private]

Definition at line 18 of file vdgl_OrthogRegress.h.

double vdgl_OrthogRegress::est_ [private]

Definition at line 19 of file vdgl_OrthogRegress.h.

unsigned vdgl_ortho_regress::S1 [inherited]

Definition at line 24 of file vdgl_ortho_regress.h.

double vdgl_ortho_regress::Sx [inherited]

Definition at line 25 of file vdgl_ortho_regress.h.

double vdgl_ortho_regress::Sxx [inherited]

Definition at line 26 of file vdgl_ortho_regress.h.

double vdgl_ortho_regress::Sxy [inherited]

Definition at line 26 of file vdgl_ortho_regress.h.

double vdgl_ortho_regress::Sy [inherited]

Definition at line 25 of file vdgl_ortho_regress.h.

double vdgl_ortho_regress::Syy [inherited]

Definition at line 26 of file vdgl_ortho_regress.h.


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