Class ForwardModeDifferentiator

  extended by org.apache.commons.nabla.forward.ForwardModeDifferentiator
All Implemented Interfaces:

public class ForwardModeDifferentiator
extends Object
implements org.apache.commons.math3.analysis.differentiation.UnivariateFunctionDifferentiator

Algorithmic differentiator class in forward mode based on bytecode analysis.

This class is an implementation of the UnivariateFunctionDifferentiator 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, StrictMath or FastMath. 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.

See Also:

Constructor Summary
          Simple constructor.
Method Summary
 void addMathImplementation(Class<?> mathClass)
          Add an implementation class for mathematical functions.
 org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction differentiate(org.apache.commons.math3.analysis.UnivariateFunction d)
 void dumpCache(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 ForwardModeDifferentiator()
Simple constructor.

Build a ForwardAlgorithmicDifferentiator instance with an empty cache.

Method Detail


public void addMathImplementation(Class<?> mathClass)
Add an implementation class for mathematical functions.

At construction, the differentiator considers only the Math and StrictMath classes are math implementation classes. It may be useful to add other classes 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 functions


public void dumpCache(OutputStream out)
Dump the cache into a stream.

out - output stream where to dump the cache


public org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction differentiate(org.apache.commons.math3.analysis.UnivariateFunction d)

Specified by:
differentiate in interface org.apache.commons.math3.analysis.differentiation.UnivariateFunctionDifferentiator

Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.