This library allows you to perform automatic differentiation on functions defined on block diagrams using "overloaded" mathematical primitives. I quote overloaded because LabVIEW has no concept of overloading functions. However, within this library, I have recreated most of the mathematical primitives that operate on a Dual.lvclass. This class represents dual numbers where a dual number x = a + b*e, where e extends the real numbers by satisfying the following property: e*e = e^2 = 0.
For a great introduction to automatic differentiation, I recommend you track down the paper Automatic Differentiation, C++ Templates and Photogrammetry by Dan Piponi. There are quite a bit of automatic differentiation resources available since there are plenty of machine learning and other resources discussing the utility of automatic differentiation. It is also something pretty much every other programming language already has implementations and libraries for. In short, automatic differentiation performs differentiation of defined functions (functions that can include conditional statements and other programming paradigms) at a complexity only slightly higher than the complexity of computing the function to be differentiated. Secondly, automatic differentiation calculates the derivative accurate to machine precision of the underlying data type (double in this library's case) and the underlying mathematical primitives used. Thus, automatic differentiation is much more accurate than finite difference methods, which can struggle with certain classes of functions.
This library currently only implements forward-mode automatic differentiation. This is good for functions f : R^m -> R^n where m<<n. Reverse-mode is good for m>>n and is currently not implemented in this library. There are also various hybrid methods when n and m are closer to one another. Since differentiation is used in many algorithms, e.g., zero-finding algorithms which are used in many other algorithms, this library could provide a lot of benefit. Automatic differentiation is used heavily in machine learning and control applications within other programming languages.
I hope to continue research implementation schemes for automatic differentiation and implement them within this library. LabVIEW is actually a fantastic language for this due to its visual paradigm. Since automatic differentiation is best explained by created a computation graph and walking through it, LabVIEW provides a great grpahical representation of automatic differentiation implementations. It is dissapointing though that LabVIEW does not treat its datatypes as objects for which functions can be overloaded, which is common in many other languages (e.g., C++ and Haskell).
You can view the test functions and examples to get a feel for the library. There is an included PowerPoint that gives a very brief overview of automatic differentiation that I recommend starting with before browsing the code (if you are unfamiliar with automatic differentiation).
*******************************************************************************************************************
LabVIEW version: 2013
This code is provided license free and is free for use, duplication, forking, etc. without restriction.
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no even shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Do not use the code attached here in the .zip file. It is out of date. You can now install this functionality via the JKI VI Package Manager.