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

Generic constructor fails for Signature "-+" #2

Open
karlwessel opened this issue Jun 16, 2019 · 4 comments
Open

Generic constructor fails for Signature "-+" #2

karlwessel opened this issue Jun 16, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@karlwessel
Copy link

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
@chakravala chakravala transferred this issue from chakravala/Grassmann.jl Jun 16, 2019
@chakravala chakravala added the enhancement New feature or request label Jun 16, 2019
@chakravala
Copy link
Owner

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.

@chakravala chakravala reopened this Jun 16, 2019
@chakravala chakravala changed the title Geometric product fails for Signature "-+" Generic constructor fails for Signature "-+" Jun 16, 2019
@karlwessel
Copy link
Author

Ah, I see! Is there some documentation on the difference between the D"-++" and the S"-++" constructor?

@chakravala
Copy link
Owner

chakravala commented Jun 16, 2019

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.

@karlwessel
Copy link
Author

Alright, knowing that I just have to explicitly use S"-+" instead of V"-+" works for me.

Thanks for the quick clarification!

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

No branches or pull requests

2 participants