DirectSum.jl
DirectSum.jl copied to clipboard
Generic constructor fails for Signature "-+"
The geometric product works like expected for the commonly used algebra with signature "-+++":
julia> using Grassmann
julia> basis"-+++"
(⟨-+++⟩, v, v₁, v₂, v₃, v₄, v₁₂, v₁₃, v₁₄, v₂₃, v₂₄, v₃₄, v₁₂₃, v₁₂₄, v₁₃₄, v₂₃₄, v₁₂₃₄)
julia> v1*v1
-1v
However, it does not work for algebras with more uncommon signatures like "-+" or "-++":
julia> basis"-+"
(⟨-,+⟩, v, v₁, v₂, v₁₂)
julia> v1*v1
ERROR: MethodError: no method matching abs(::Symbol)
Closest candidates are:
abs(::Bool) at bool.jl:91
abs(::Float16) at float.jl:520
abs(::Float32) at float.jl:521
...
Stacktrace:
[1] parityinner(::UInt64, ::UInt64, ::DiagonalForm{2,0,1,0}) at .julia/packages/Grassmann/H9Zog/src/parity.jl:96
[2] *(::Basis{⟨-,+⟩,1,0x0000000000000001}, ::Basis{⟨-,+⟩,1,0x0000000000000001}) at .julia/packages/Grassmann/H9Zog/src/algebra.jl:150
[3] top-level scope at none:0
julia> basis"-++"
(⟨-,++⟩, v, v₁, v₂, v₁₂)
julia> v1*v1
ERROR: MethodError: no method matching abs(::Symbol)
Closest candidates are:
abs(::Bool) at bool.jl:91
abs(::Float16) at float.jl:520
abs(::Float32) at float.jl:521
...
Stacktrace:
[1] parityinner(::UInt64, ::UInt64, ::DiagonalForm{2,0,2,0}) at .julia/packages/Grassmann/H9Zog/src/parity.jl:96
[2] *(::Basis{⟨-,++⟩,1,0x0000000000000001}, ::Basis{⟨-,++⟩,1,0x0000000000000001}) at .julia/packages/Grassmann/H9Zog/src/algebra.jl:150
[3] top-level scope at none:0
You are mistaken, the geometric product works for all the algebras
julia> using Grassmann
julia> @basis S"-+"
(⟨-+⟩, v, v₁, v₂, v₁₂)
julia> v1*v2
v₁₂
julia> @basis S"-++"
(⟨-++⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)
julia> v1*v2
v₁₂
that version of the constructor relies on V"..." which defers to either D"..." or S"..." and for the input value of -+ and -++ the V"..." constructor selects D"..."
Look closely at the error you posted ⟨-,++⟩ is the vector space, which is what you get with
julia> D"-++"
⟨-,++⟩
julia> S"-++"
⟨-++⟩
This is merely an issue with the default generic constructor of DirectSum and has nothing to do with Grassmann package. In an ambiguity, a specific constructor must be used.
Ah, I see! Is there some documentation on the difference between the D"-++" and the S"-++" constructor?
No, it's not documented yet and there are going to be more variations coming into existence.
D is for DiagonalForm and S for Signature type.. however more types are coming
Therefore, it's still an open problem. However, the constructor issue is not my primary concern right now, although I have been aware of it already. This package is still going to change a lot before I take another look at the generic constructor issue.
Alright, knowing that I just have to explicitly use S"-+" instead of V"-+" works for me.
Thanks for the quick clarification!