Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometric multiplication for bivectors #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AnIrishDuck
Copy link

Add a GeometricMul trait for geometric multiplication. Implement it for vector.gmul(vector) and bivector.gmul(bivector).

Ideally it'd be implemented across all types, which I may get to. I wanted to double check that this is an agreeable direction first.

Also, fixed an apparent bug in the Div impl for bivectors. I also think there's a bug in the dot method of bivectors, but am less confident on that. I'm working on double checking against literature / other libraries.

The test here uses quickcheck; I've found property-based testing to be nice for "abstract" math libraries. It also demonstrates the utility of defining the geometric product across types. It's theoretically possible to generate a multiplicative inverse for anything in G3. Specifically, in rust, all we need is something that implements GeometricMul and has a reverse.

If this looks good, I'll work on adding a Reverse trait next. I can then easily add property tests to check inversion of other types. This may catch further errors, like the div issue in bivectors.

@fu5ha
Copy link
Owner

fu5ha commented Jul 8, 2022

Hey, thanks for working on this. I've looked over it a couple times and thought it over in my head. I am not sure that this is the direction I want to take the library or not. The trait-with-associated-types style is not really where it started, and though I definitely want to have a more "real" geometric multiplication (and other associated geometric algebra methods) in the future, I've sort of been filing these under the "to-add-in-GA-rewrite" category. Unfortunately, since most of my development bandwidth is taken up by work these days, I'm not sure when that will happen either 😓

@AnIrishDuck
Copy link
Author

No worries! This wasn't much work; I'm definitely glad to know early in the process.

In the interim, I've started thinking about whether it makes more sense to add onto / create an extension library for nalgebra instead. Bivector operations in particular are super useful for my current hobby domain (orbital transfer calculations).

Hope you can find more time to work on this library, but I know how that goes with work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants