Skip to content

NateSeymour/unlogic

Repository files navigation

Unlogic

A math JIT compiler and graph generator.

Examples

JIT-Compiling and Running a Function

unlogic::Compiler compiler;
auto f = compiler.CompileFunction<double, double>("f(x, y) := x * y");

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

Graphing a Function

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<sf::Uint8> buffer;
image.saveToMemory(buffer, "png");

Sample Render

Rendered in unlogic-cli with:

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

About

Math JIT Compiler and Graph Renderer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published