edu.stanford.nlp.optimization
Class AbstractCachingDiffFloatFunction

java.lang.Object
  extended by edu.stanford.nlp.optimization.AbstractCachingDiffFloatFunction
All Implemented Interfaces:
DiffFloatFunction, FloatFunction, HasFloatInitial
Direct Known Subclasses:
CRFLogConditionalObjectiveFloatFunction

public abstract class AbstractCachingDiffFloatFunction
extends Object
implements DiffFloatFunction, HasFloatInitial

Author:
Dan Klein

Field Summary
protected  float[] derivative
           
protected  float value
           
 
Constructor Summary
AbstractCachingDiffFloatFunction()
           
 
Method Summary
protected abstract  void calculate(float[] x)
          Calculate the value at x and the derivative and save them in the respective fields
protected  void copy(float[] y, float[] x)
           
 float[] derivativeAt(float[] x)
          Returns the first-derivative vector at the input location.
abstract  int domainDimension()
          Returns the number of dimensions in the function's domain
 float[] initial()
          Returns the intitial point in the domain (but not necessarily a feasible one).
 float valueAt(float[] x)
          Returns the value of the function at a single point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

derivative

protected float[] derivative

value

protected float value
Constructor Detail

AbstractCachingDiffFloatFunction

public AbstractCachingDiffFloatFunction()
Method Detail

domainDimension

public abstract int domainDimension()
Description copied from interface: FloatFunction
Returns the number of dimensions in the function's domain

Specified by:
domainDimension in interface FloatFunction
Returns:
the number of domain dimensions

calculate

protected abstract void calculate(float[] x)
Calculate the value at x and the derivative and save them in the respective fields


initial

public float[] initial()
Description copied from interface: HasFloatInitial
Returns the intitial point in the domain (but not necessarily a feasible one).

Specified by:
initial in interface HasFloatInitial
Returns:
a domain point

copy

protected void copy(float[] y,
                    float[] x)

valueAt

public float valueAt(float[] x)
Description copied from interface: FloatFunction
Returns the value of the function at a single point.

Specified by:
valueAt in interface FloatFunction
Parameters:
x - a double[] input
Returns:
the function value at the input

derivativeAt

public float[] derivativeAt(float[] x)
Description copied from interface: DiffFloatFunction
Returns the first-derivative vector at the input location.

Specified by:
derivativeAt in interface DiffFloatFunction
Parameters:
x - a double[] input vector
Returns:
the vector of first partial derivatives.


Stanford NLP Group