https://github.com/enhuiz/automatic-differentiation-machine
https://github.com/enhuiz/automatic-differentiation-machine
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/enhuiz/automatic-differentiation-machine
- Owner: enhuiz
- Created: 2018-09-03T04:34:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-03T12:27:18.000Z (almost 7 years ago)
- Last Synced: 2025-01-07T18:29:21.927Z (5 months ago)
- Language: C++
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automatic Differentiation Machine
## Introduction
This is a toy automatic differentiation machine which parses expressions and then differentiate them according to different variables. Have fun!
## Build
```
$ mkdir build
$ cmake ..
$ make
```## Run Repl
```
$ build/repl
```## Run Test
```
$ python test/test.py
```## Use it in your code
```c++
#include "autodiff/core.h"using namespace std;
int main()
{
auto expr = "x^2 + 5";
auto parser = Parser();
auto graph = parser.Parse(expr);
graph.Set("x", 5);
cout << graph.Evaluate() << endl; // 30
cout << graph.Gradient("x") << endl; // 10
return 0;
}
```## References
- http://llvm.org/docs/index.html
- https://github.com/PanagiotisPtr/Reverse-Mode-Automatic-Differentiation-Cpp