-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
implement left and right complements for ⋅,∨ products #3
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
=======================================
+ Coverage 24.92% 25.92% +1%
=======================================
Files 7 7
Lines 967 1022 +55
=======================================
+ Hits 241 265 +24
- Misses 726 757 +31
Continue to review full report at Codecov.
|
I'd have to look into Lengyels definition more closely (although I would like to note that picking overbar and underbar for 'left' and 'right' complement are not the most intuitive choices ;) ) Dorst has some details on various inner products in a separate article here : https://www.researchgate.net/publication/2842332_The_Inner_Products_of_Geometric_Algebra Gunn also has an alternate definition of duality, and thus the regressive product, in his work on PGA using a degenerate metric. (He uses Poincare duality). Ganja uses Poincare duality when dealing with the degenerate metric, and the left contraction inner product from Dorst. (although a symmetric inner product is also available) when I have some time I'll check the compatibility between Gunn's and Lengyels definition. |
Thanks for your comments @enkimute, after looking at Gunn's work on Poincare duality, I did some experimentation. So if I understand correctly, the point is that you are taking the dual of the complement. In julia> basis"++++"
(⟨++++⟩, v, v₁, v₂, v₃, v₄, v₁₂, v₁₃, v₁₄, v₂₃, v₂₄, v₃₄, v₁₂₃, v₁₂₄, v₁₃₄, v₂₃₄, v₁₂₃₄)
julia> Grassmann.complementleft(v1)' ∧ v1'
1w¹²³⁴
julia> (Grassmann.complementleft(v1) ∧ v1)'
1w¹²³⁴ As you can see, the dual Let's define a julia> norm(x) = Grassmann.complementright((Grassmann.complementleft(x)∧x)')'
norm (generic function with 1 method)
julia> norm(v1),norm(v2)
(1v, v) But now let's change the basis to the Minkowski example from above julia> basis"-+++"
(⟨-+++⟩, v, v₁, v₂, v₃, v₄, v₁₂, v₁₃, v₁₄, v₂₃, v₂₄, v₃₄, v₁₂₃, v₁₂₄, v₁₃₄, v₂₃₄, v₁₂₃₄)
julia> norm(v1),norm(v2)
(1v, -1v) We still have the same exact issue as before, apparently. Could you try to express your definitions of inner product using these operations Also, have you used the definition of Hodge duality before? |
f735530
to
365d3d0
Compare
365d3d0
to
5bb7fde
Compare
In the end, I resolved the issue by sticking to the method presented by Browne in Grassmann algebra, L = grade(a) + grade(b)
(-1)^(L*(L-ndims(V))) * complementright(complementright(a)∧complementright(b))) his formula for the regressive product is only in terms of
sticking to this method, I found I could make a very efficient interior product implementation, where I essentially skip over the required intermediate allocations and determine the parity in one step: function interior_calc(N,M,S,A,B)
γ = complement(N,B)
p,C,t = regressive_calc(N,M,S,A,γ)
return t ? p⊻parityright(S,B) : p, C, t
end which in turn depends on the parity calculation obtained from the function regressive_calc(N,M,S,A,B)
α,β = complement(N,A),complement(N,B)
if (count_ones(α&β)==0) && !(M ∈ (1,3,5,7,9,11) && isodd(α) && isodd(β))
C = α ⊻ β
L = count_ones(A)+count_ones(B)
pa,pb,pc = parityright(S,A),parityright(S,B),parityright(S,C)
return isodd(L*(L-N))⊻pa⊻pb⊻parity(N,S,α,β)⊻pc, complement(N,C), true
else
return false, zero(Bits), false
end
end however, since this is a rather cumbersome calculation requiring many micoseconds to compute a single boolean value for the parity.. I have opted to cache the value efficiently into the compiled code julia> using Grassmann; basis"-+++"
(⟨-+++⟩, v, v₁, v₂, v₃, v₄, v₁₂, v₁₃, v₁₄, v₂₃, v₂₄, v₃₄, v₁₂₃, v₁₂₄, v₁₃₄, v₂₃₄, v₁₂₃₄)
julia> @btime h = 2v1+v3
37.794 ns (3 allocations: 80 bytes)
2v₁ + 0v₂ + 1v₃ + 0v₄
julia> @btime h⋅h
105.948 ns (2 allocations: 160 bytes)
-3 and as a result I am getting good sub-microsecond results for high-performnace computing it would still be interesting to find out more about Lengyel's approach, but this one seems solid now by the way, @enkimute your GanjaCheatSheets helped me a lot from your blog :) |
That is a very interesting quote - I will read up on that, will have to check the way he defined the complement and figure out if this may provide a method that works for degenerate metrics in the same unified fashion.. Cool update ! and happy the cheat-sheets came in handy 👍 |
this is a work-in-progress for implementing the fully-generalized interior and regressive product #2
some help is required to fix the interaction between the metric and the interior product operations
Complement
The complement operations were implemented as two methods
with the extra definition
const ⋆ = complementright
for the Hodge star linear mapdetermining the basis value for the complement operation is a fairly simple bitwise operation
while the parity of the left and right operations are determined by the indices and metric
which I believe is the definition based on Browne's Grassmann algebra, where the parity is determined by the sum of the indices plus triangular number of the grade, in addition to the metric components
Regressive and Interior products
This leads to the definition of the Grassmann regressive product in terms of the complements
which is based on the left and right complements as discussed in AntiWedge or Regressive Product
and then the interior or inner product is defined similarly, with a modification
Issues and results
for the positive definite
VectorSpace
metric, this approach does seem to work successfullyso all of the products work as expected when dealing with Euclidean
+
only spaceshowever, when the Minkowski spacetime metric is used, some of the issues with the formulation show
as you can see, in this case the parity of the inner product is reversed from what it should be
this is a result due to the definition of the interior product in terms of the right and left complement
Request for help
please let me know if any of the geometric algebra enthusiasts out there (such as @waldyrious, @enkimute, @arsenovic, @hugohadfield, @joanlasenby could help clarify or figure out what the solution is to making this implementation work correctly in terms of the left and right complements
any comments, corrections, suggestions, or references are welcome