Investigate whether the left and right contraction overloads are safe
See original GitHub issuegalgebra uses a < b
to mean left_contract(a, b)
. I’m worried that this doesn’t work properly:
Quoting the python docs about the comparison ops:
There are no swapped-argument versions of these methods (to be used when the left argument does not support the operation but the right argument does); rather, lt()` and gt() are each other’s reflection
If the operands are of different types, and right operand’s type is a direct or indirect subclass of the left operand’s type, the reflected method of the right operand has priority, otherwise the left operand’s method has priority.
What this means is that obj < mv
and mv > obj
are indistinguishable if obj
does not take part in the comparison.
From dorst, the rule for converting a left to right contraction is:
So by identity, left_contract(obj, mv) == right_contract(mv.rev(), obj.rev()).rev()
However, the python rules allow the rewrite left_contract(obj, mv) == right_contract(mv, obj)
.
Can we guarantee this is always true?
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (8 by maintainers)
Top GitHub Comments
At this point I suggest we continue this conversation at the Grassman.jl repository.
The intent of this issue was to flag a potentially dangerous use of python operator overload semantics, not to question the operators of geometric Algebra.
I haven’t read the John Browne book, looks interesting though. I’ll add it to my stack.
@chakravala it seems your definition of contraction in Grassmann.jl is different from the one used in Geometric Algebra. Nothing wrong with that and I don’t want to get into a discussion about which one is “right”.
This particular issue we are discussing here is for a Geometric Algebra library, galgebra.
The current Geometric Algebra definition of contractions should be used here, not the Grassmann Algebra/Grassmann.jl/John Browne’s definition. Unless the contributers to galgebra decide otherwise.