An open API service indexing awesome lists of open source software.

https://github.com/enhuiz/automatic-differentiation-machine


https://github.com/enhuiz/automatic-differentiation-machine

Last synced: 3 months ago
JSON representation

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