edu.jhu.bme.smile.commons.optimize
Class FunctionNumericND1DDifferentiation

java.lang.Object
  extended by edu.jhu.bme.smile.commons.optimize.FunctionNumericND1DDifferentiation
All Implemented Interfaces:
OptimizableNDContinuous

public class FunctionNumericND1DDifferentiation
extends java.lang.Object
implements OptimizableNDContinuous

A wrapper class used to facilitate getting derivatives of ND functions along each dimension individually

Author:
Yufeng Guo, Hanlin Wan

Field Summary
static double DEFAULT_STEP
           
static int DIFF_3_POINT
           
static int DIFF_5_POINT
           
static int DIFF_7_POINT
           
static int DIFF_9_POINT
           
static int DIFF_BAC_EULER
           
static int DIFF_FWD_EULER
           
 
Constructor Summary
FunctionNumericND1DDifferentiation(OptimizableNDContinuous function, int dim)
          Creates object to be used for getting a derivative of an ND function along 1-dimension, but contains the information to take more derivatives, along another other dimension as well.
FunctionNumericND1DDifferentiation(OptimizableNDContinuous function, int dim, double step, int method)
          Creates object to be used for getting a derivative of an ND function along 1-dimension, but contains the information to take more derivatives, along another other dimension as well.
 
Method Summary
 double getDerivative(double[] x)
          Gets the first derivative.
 double[] getDomainMax()
          Gets the domain maximum
 double[] getDomainMin()
          Gets the domain minimum
 double getDomainTolerance()
          Gets the tolerance
 int getNumberOfDimensions()
          Gets the number of dimensions
 double getValue(double[] x)
          Same as getDerivative.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIFF_FWD_EULER

public static final int DIFF_FWD_EULER
See Also:
Constant Field Values

DIFF_BAC_EULER

public static final int DIFF_BAC_EULER
See Also:
Constant Field Values

DIFF_3_POINT

public static final int DIFF_3_POINT
See Also:
Constant Field Values

DIFF_5_POINT

public static final int DIFF_5_POINT
See Also:
Constant Field Values

DIFF_7_POINT

public static final int DIFF_7_POINT
See Also:
Constant Field Values

DIFF_9_POINT

public static final int DIFF_9_POINT
See Also:
Constant Field Values

DEFAULT_STEP

public static final double DEFAULT_STEP
See Also:
Constant Field Values
Constructor Detail

FunctionNumericND1DDifferentiation

public FunctionNumericND1DDifferentiation(OptimizableNDContinuous function,
                                          int dim)
Creates object to be used for getting a derivative of an ND function along 1-dimension, but contains the information to take more derivatives, along another other dimension as well. Uses the default step of 1e-5 adn default method of 3 point.

Parameters:
function - function to be differentiated
dim - the dimension to take the derivative in

FunctionNumericND1DDifferentiation

public FunctionNumericND1DDifferentiation(OptimizableNDContinuous function,
                                          int dim,
                                          double step,
                                          int method)
Creates object to be used for getting a derivative of an ND function along 1-dimension, but contains the information to take more derivatives, along another other dimension as well.

Parameters:
function - function to be differentiated
dim - the dimension to take the derivative in
method - the differentiating method requested: 0,1,3,5,7, or 9. Default is 3.
Method Detail

getDerivative

public double getDerivative(double[] x)
Gets the first derivative. Dimension to take the derivative should have been set.

Parameters:
x - location to evaluate derivative at
Returns:
derivative at location x in the set dimension

getDomainMax

public double[] getDomainMax()
Gets the domain maximum

Specified by:
getDomainMax in interface OptimizableNDContinuous
Returns:
domain max

getDomainMin

public double[] getDomainMin()
Gets the domain minimum

Specified by:
getDomainMin in interface OptimizableNDContinuous
Returns:
domain min

getDomainTolerance

public double getDomainTolerance()
Gets the tolerance

Specified by:
getDomainTolerance in interface OptimizableNDContinuous
Returns:
tolerance

getNumberOfDimensions

public int getNumberOfDimensions()
Gets the number of dimensions

Specified by:
getNumberOfDimensions in interface OptimizableNDContinuous
Returns:
number of dimensions

getValue

public double getValue(double[] x)
Same as getDerivative.

Specified by:
getValue in interface OptimizableNDContinuous
Parameters:
x - the location to get the derivative.
Returns:
the derivative at location x