Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/nateseymour/unlogic
- Owner: NateSeymour
- Created: 2024-05-23T23:34:12.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-31T18:04:57.000Z (3 months ago)
- Last Synced: 2024-10-31T19:18:04.544Z (3 months ago)
- Topics: cpp, graphs, jit, llvm, math, opengl
- Language: C++
- Homepage:
- Size: 441 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)",
});
```