Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/nateseymour/unlogic

Math JIT Compiler and Graph Renderer
https://github.com/nateseymour/unlogic

cpp graphs jit llvm math opengl

Last synced: 3 months ago
JSON representation

Math JIT Compiler and Graph Renderer

Awesome Lists containing this project

README

        

# Unlogic
A math JIT compiler and graph generator.

## Examples

### JIT-Compiling and Running a Function
```c++
unlogic::Compiler compiler;
auto f = compiler.CompileFunction("f(x, y) := x * y");

ASSERT_EQ(f(2, 2), 4);
```

### Graphing a Function
```c++
sf::RenderTexture texture;
texture.create(1000, 1000);

unlogic::Graph graph("f(x) := x^2");

texture.Draw(graph);

sf::Image image = texture.getTexture().copyToImage();
std::vector buffer;
image.saveToMemory(buffer, "png");
```

### Sample Render



Rendered in `unlogic-cli` with:

```c++
unlogic::Graph graph({
"a(x) := sin(x)",
"b(x) := cos(x)",
"c(x) := tan(x)",
"d(x) := sqrt(x)",
"e(x) := log(x)",
});
```