Geometric multiplication for bivectors #146
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a
GeometricMul
trait for geometric multiplication. Implement it forvector.gmul(vector)
andbivector.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 thedot
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 areverse
.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 thediv
issue in bivectors.