databionics.esom.neighborhood
Class CachedNeighborhood

java.lang.Object
  extended by databionics.esom.neighborhood.Neighborhood
      extended by databionics.esom.neighborhood.CachedNeighborhood
Direct Known Subclasses:
ConeNeighborhood, EpanechicovNeighborhood, GaussNeighborhood, MexicanHatNeighborhood

public abstract class CachedNeighborhood
extends Neighborhood

Abstract base class for neighborhood kernels with a cache of precalculated values. Subclasses have to override the calculate(int distance) method and might want to override the init() method. Make sure to call super.init() as the last command in init() to initialize the cache.


Field Summary
protected static org.apache.log4j.Logger log
          interface to log4j system
protected  cern.colt.matrix.DoubleMatrix1D weights
          cache with precalculated values of the weights
 
Fields inherited from class databionics.esom.neighborhood.Neighborhood
radius, scaling
 
Constructor Summary
CachedNeighborhood()
          Create a new neighborhood object
CachedNeighborhood(int radius, double scaling)
          Create a new neighborhood object
 
Method Summary
 double get(int distance)
          Get weight for distance from kernel center
 void init()
          Initialize the neighborhood.
 
Methods inherited from class databionics.esom.neighborhood.Neighborhood
calculate, setRadius, setScaling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
interface to log4j system


weights

protected cern.colt.matrix.DoubleMatrix1D weights
cache with precalculated values of the weights

Constructor Detail

CachedNeighborhood

public CachedNeighborhood()
Create a new neighborhood object


CachedNeighborhood

public CachedNeighborhood(int radius,
                          double scaling)
Create a new neighborhood object

Parameters:
radius - radius of kernel
scaling - scaling factor for all weights
Method Detail

init

public void init()
Initialize the neighborhood. Call this after setting radius and scaling

Specified by:
init in class Neighborhood

get

public double get(int distance)
Get weight for distance from kernel center

Overrides:
get in class Neighborhood
Parameters:
distance - distance on grid from center
Returns:
weight for this distance


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.