Error for geometric product of null basis and negative origin
karlwessel opened this issue · comments
I get an error for the geometric product of v∅
and -v∞
:
julia> using Grassmann
julia> @basis S"∞∅+"
(⟨∞∅+⟩, v, v∞, v∅, v₁, v∞∅, v∞₁, v∅₁, v∞∅₁)
julia> v∅*v∞
-1 - 1v∞∅
julia> v∅*(-v∞)
ERROR: MethodError: no method matching SValue{⟨∞∅+⟩,G,B,T} where T where B where G(::Int64, ::MultiVector{Int64,⟨∞∅+⟩,8})
Closest candidates are:
SValue{⟨∞∅+⟩,G,B,T} where T where B where G(::T) where {V, T} at .julia/packages/Grassmann/H9Zog/src/multivectors.jl:97
SValue{⟨∞∅+⟩,G,B,T} where T where B where G(::Any, ::SValue{V,G,B,T} where T where B) where {V, G} at .julia/packages/Grassmann/H9Zog/src/multivectors.jl:90
SValue{⟨∞∅+⟩,G,B,T} where T where B where G(::Any, ::MValue{V,G,B,T} where T where B) where {V, G} at .julia/packages/Grassmann/H9Zog/src/multivectors.jl:91
...
Stacktrace:
[1] *(::Basis{⟨∞∅+⟩,1,0x0000000000000002}, ::SValue{⟨∞∅+⟩,1,v∞,Int64}) at .julia/packages/Grassmann/H9Zog/src/algebra.jl:157
[2] top-level scope at none:0
Ah yes, that's because the product is supposed to be a MultiVector
but an SValue
is expected
julia> v∅*basis(-v∞)
-1 - 1v∞∅
julia> SValue{V}(-1,ans)
ERROR: MethodError: no method matching SValue{⟨∞∅+⟩,G,B,T} where T where B where G(::Int64, ::MultiVector{Int64,⟨∞∅+⟩,8})
Closest candidates are:
and the definition of the product is expecting the SValue
instead of MultiVector
value
*(a::Basis{V},b::SValue{V}) where V = SValue{V}(b.v,a*basis(b))
the fix will have to require a creative way of adapting the code without introducing type instability
By now it didn't happen anywhere in any useful or productive code I use.
Only in a generic testcase I've written to check the basic properties of an algebra. So no real hurry from my side at the moment for the fix.
You're welcome to help increase the test coverage with runtests.jl
@karlwessel this issue has now been resolved
julia> (-v∞) * v∅
1 - 1v∞∅
julia> v∞ * (-v∅)
1 - 1v∞∅
all your tests are now passing
Thanks for fixing, and sorry for the slow response!
With this issue fixed the associativity and distributivity tests now also pass for Vectorspace S"∞∅+"
. I therefore added PR #36 which enables those tests.