enkimute / ganja.js

:triangular_ruler: Javascript Geometric Algebra Generator for Javascript, c++, c#, rust, python. (with operator overloading and algebraic literals) -
MIT License
1.52k stars 107 forks source link

Binary tree representations? #55

Open micahscopes opened 5 years ago

micahscopes commented 5 years ago

Okay first of all I'm really impressed by your work here... It's inspiring! I have lots of questions but will try to focus on one at a time, starting with this one:

How does your approach compare to the recent binary tree approaches described by Théry & Fuchs here and refined by Ahmad Hosny Eid here?

I noticed that ganja.js allows someone to use a generic Cayley table, so maybe it'd be a pretty complicated project to adopt the binary tree approach in ganja.js.

I'm impressed that your generator can handle that wonderful 15 dimensional Quadric Conformal Geometric Algebra. I've created my own algebraic code generation tools in Python with Sympy, but they rely on symbolic algebra libraries that aren't optimized for lots of dimensions. So that very nice Quadric Conformal Geometric Algebra has been off limits!

Bonus question: do you write the code by hand, or do you use some kind of compiler? It's very "concise"!

enkimute commented 5 years ago

Hi Micahscopes,

Thanks for the compliment !

Ganja.js currently has three (well 2.5) different generators. The first one provides support for flat multivectors with precompiled and unrolled operators. It is the default for dimension 6 or less. The second one provides graded storage and has its operators implemented using loops. It handles up to 32 dimensions (in theory). The third one is a symbolic extension of the graded generator that allows you to do simple symbolic computations - it is mostly used internally to generate GLSL code for OPNS rendering.

Other generators using binary trees, prefix trees (ala GARAMON), fully sparse or factorized approaches, as well as an optimal, compact, typed generator are still on my list :)

(Custom Cayley tables are currently only supported for the flat, precompiled generator, same goes for custom basis names - in the high-d setups neither of those make sense to support)

and I agree, Stephane's QCGA is beyond cool !

hehe "concise" - its been called worse :D - all by hand, yes.