Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A .NET library that provides fast, accurate and automatic differentiation (computes derivative / gradient) of mathematical functions.

License

NotificationsYou must be signed in to change notification settings

alexshtf/autodiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppVeyor CINuGet Package
Build StatusNuGet

A library that provides moderately fast, accurate, and automatic differentiation (computes derivative / gradient) of mathematical functions.

AutoDiff provides a simple and intuitive API for computing function gradients/derivatives along with a fast algorithm for performing the computation. Such computations are mainly useful in iterative numerical optimization scenarios.

Code example

usingAutoDiff;classProgram{publicstaticvoidMain(string[]args){// define variablesvarx=newVariable();vary=newVariable();varz=newVariable();// define our functionvarfunc=(x+y)*TermBuilder.Exp(z+x*y);// prepare arrays needed for evaluation/differentiationVariable[]vars={x,y,z};double[]values={1,2,-3};// evaluate func at (1, 2, -3)doublevalue=func.Evaluate(vars,values);// calculate the gradient at (1, 2, -3)double[]gradient=func.Differentiate(vars,values);// print resultsConsole.WriteLine("The value at (1, 2, -3) is "+value);Console.WriteLine("The gradient at (1, 2, -3) is ({0}, {1}, {2})",gradient[0],gradient[1],gradient[2]);}}

Documentation

TheDocumentation contains some basic tutorials, we have anarticle on CodeProject, and finally source code contains some code examples in addition to the code of the library itself.

Motivation

There are many open and commercial .NET libraries that have numeric optimization as one of their features (for example,Microsoft Solver Foundation,AlgLib,Extreme Optimization,CenterSpace NMath) . Most of them require the user to be able to evaluate the function and the function's gradient. This library tries to save the work in manually developing the function's gradient and coding it.Once the developer defines his/her function, the AutoDiff library can automatically evaluate and differentiate this function at any point. This allowseasy development and prototyping of applications which require numerical optimization.

Features

  • Moderate execution speeds. We aim computing agradient within no more than 50 times the duration offunction evaluation by manually tuned code.
  • Composition of functions using arithmetic operators, Exp, Log, Power and user-defined unary and binary functions.
  • Function gradient evaluation at specified points
  • Function value evaluation at specified points
  • Computes gradients using Reverse-Mode AD algorithm inlinear time, which is substantially faster than numerical gradient approximation for multivariate functions.

Using in research papers

If you like the library and it helps you publish a research paper, please cite the paper I originally wrote the library forgeosemantic.bib

Used by

About

A .NET library that provides fast, accurate and automatic differentiation (computes derivative / gradient) of mathematical functions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp