|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.nabla.automatic.AutomaticDifferentiator
public class AutomaticDifferentiator
Automatic differentiator class based on bytecode analysis.
This class is an implementation of the UnivariateDifferentiator
interface that computes exact differentials completely automatically
and generate java classes and instances that compute the differential
of the function as if they were hand-coded and compiled.
The derivative bytecode created the first time an instance of a given class is differentiated is cached and will be reused if other instances of the same class are to be created later. The cache can also be dumped in a jar file for use in an application without bringing the full nabla library and its dependencies.
This differentiator can handle only pure bytecode methods and known methods
from math implementation classes like Math or
StrictMath. Pure bytecode methods are analyzed
and converted. Methods from math implementation classes are only recognized
by class and name and replaced by predefined derivative code.
FetchDifferentiator| Constructor Summary | |
|---|---|
AutomaticDifferentiator()
Simple constructor. |
|
| Method Summary | |
|---|---|
void |
addMathImplementation(java.lang.Class<?> mathClass)
Add an implementation class for mathematical functions. |
UnivariateDerivative |
differentiate(UnivariateDifferentiable d)
Create an implementation of a differential for a differentiable function. |
void |
dumpCache(java.io.OutputStream out)
Dump the cache into a stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AutomaticDifferentiator()
Build a AutomaticDifferentiator instance with an empty cache.
| Method Detail |
|---|
public void addMathImplementation(java.lang.Class<?> mathClass)
At construction, the differentiator considers only the Math and StrictMath
classes are math implementation classes. It may be useful to add
other class for example to add some missing functions like
inverse hyperbolic cosine that are not provided by the standard
java classes as of Java 1.6.
mathClass - implementation class for mathematical functionspublic void dumpCache(java.io.OutputStream out)
out - output stream where to dump the cache
public UnivariateDerivative differentiate(UnivariateDifferentiable d)
throws DifferentiationException
differentiable function.
differentiate in interface UnivariateDifferentiatord - differentiable function to differentiate
DifferentiationException - if the class cannot be differentiated
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||