Giter VIP home page Giter VIP logo

alglbraic's Introduction

ALGLBRAIC!

A python library and CLI utility for generating libraries of algebraic GLSL functions.

Featuring included generators:

  • complex-numbers
  • dual-numbers
  • quaternions
  • clifford-algebras

Examples of generated GLSL code can be found in the examples/ directory.

CLI usage examples

Quaternions

> algl quaternions

Output to a directory

> algl --out ./glsl/ clifford-algebra cga2d '1 1 1 -1'

A more complex example

In this example we use the complex-numbers and clifford-algebra generators together in sequence to generate functions for a Clifford algebra with the complex numbers as its base ring:

> algl --glslify --out ./glsl/ complex-numbers clifford-algebra --base C GAComplex '1 1 1 -1'

The --base option passed to the clifford-algebra generator specifies that the base struct for this Clifford algebra should be C, the name of the struct outputted by complex-numbers.

The --glslify option passed at the beginning creates an index.glsl file with glslify-import directives for importing all of the generated glslify files in the order they were generated.

CLI help

Use the --help option!

> algl --help
> algl <COMMAND> --help

You might be wondering...

What about other algebras?

I made alglbraic with geometric algebra in mind but the underlying library is flexible enough to generate GLSL code for any algebra you can get SymPy to print. If you're interested in other algebras I recommend reading the code in alglbraic/algebras.

What about performance?

The code generated by this library is not optimized in any special way! It just bakes out all of the math into GLSL code. If you find it to be quick that's only because it's running on the GPU and everything is happening in parallel.

Big algebras?

This tool probably isn't a good fit for generic computations of operations for algebras with more than 32 or maybe 64 basis dimensions.

Development

To get started you'll need to install Poetry.

Install dependencies

> poetry shell

followed by

> poetry install

Tests

> pytest

or:

> ptw

Updating snapshots

If you change something in a way that breaks the snapshots, the only way I've found to update them is by carefully deleting the snapshot file for the thing that's changed and re-running pytest.

alglbraic's People

Contributors

micahscopes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.