org.apache.commons.nabla.forward.analysis
Class ClassDifferentiator

java.lang.Object
  extended by org.apache.commons.nabla.forward.analysis.ClassDifferentiator

public class ClassDifferentiator
extends Object

Differentiator for classes using forward mode.

This differentiator transforms classes implementing the UnivariateFunction interface and convert them to classes implementing the UnivariateDifferentiableFunction interface.

The differentiator creates a new class in the same package as the primitive class and which only preserve a private reference to the primitive instance. They access the current value of all necessary primitive instance fields thanks to reflection and bypassing access restrictions.

The original class bytecode is not changed at all.

Version:
$Id$

Constructor Summary
ClassDifferentiator(Class<? extends org.apache.commons.math3.analysis.UnivariateFunction> primitiveClass, Set<String> mathClasses)
          Simple constructor.
 
Method Summary
 void differentiateMethod(String name, String primitiveDesc, String derivativeDesc)
          Differentiate a method.
 org.objectweb.asm.tree.ClassNode getDerivedClass()
          Get the derived class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassDifferentiator

public ClassDifferentiator(Class<? extends org.apache.commons.math3.analysis.UnivariateFunction> primitiveClass,
                           Set<String> mathClasses)
                    throws DifferentiationException,
                           IOException
Simple constructor.

Parameters:
primitiveClass - primitive class
mathClasses - math implementation classes
Throws:
DifferentiationException - if class cannot be differentiated
IOException - if class cannot be read
Method Detail

differentiateMethod

public void differentiateMethod(String name,
                                String primitiveDesc,
                                String derivativeDesc)
                         throws DifferentiationException
Differentiate a method.

Parameters:
name - of the method
primitiveDesc - descriptor of the method in the primitive class
derivativeDesc - descriptor of the method in the derivative class
Throws:
DifferentiationException - if method cannot be differentiated

getDerivedClass

public org.objectweb.asm.tree.ClassNode getDerivedClass()
Get the derived class.

Returns:
derived class


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