public abstract class AbstractCachingDiffFunction extends Object implements DiffFunction, HasInitial
Modifier and Type | Field and Description |
---|---|
protected double[] |
derivative |
protected Random |
generator |
protected double |
value |
Constructor and Description |
---|
AbstractCachingDiffFunction() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
calculate(double[] x)
Calculate the value at x and the derivative
and save them in the respective fields.
|
protected void |
clearCache()
Clears the cache in a way that doesn't require reallocation :-)
|
protected static void |
copy(double[] copy,
double[] orig) |
double[] |
derivativeAt(double[] x)
Returns the first-derivative vector at the input location.
|
void |
ensure(double[] x) |
double[] |
getDerivative() |
boolean |
gradientCheck() |
boolean |
gradientCheck(int numOfChecks,
int numOfRandomChecks,
double[] x) |
double[] |
initial()
Returns the intitial point in the domain (but not necessarily a feasible one).
|
double |
lastValue() |
double[] |
randomInitial() |
double |
valueAt(double[] x)
Returns the value of the function at a single point.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
domainDimension
protected double[] derivative
protected double value
protected Random generator
public boolean gradientCheck()
public boolean gradientCheck(int numOfChecks, int numOfRandomChecks, double[] x)
protected abstract void calculate(double[] x)
x
- The point at which to calculate the functionprotected void clearCache()
public double[] initial()
HasInitial
initial
in interface HasInitial
public double[] randomInitial()
protected static void copy(double[] copy, double[] orig)
public void ensure(double[] x)
public double valueAt(double[] x)
Function
public double[] derivativeAt(double[] x)
DiffFunction
derivativeAt
in interface DiffFunction
x
- a double[]
input vectorpublic double lastValue()
public double[] getDerivative()