chakravala / Grassmann.jl

⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra

Home Page:https://grassmann.crucialflow.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Finish implementing dyadic tensor evaluation

eschnett opened this issue · comments

I am experimenting with mixedbasis to represent non-trivial metric tensors. (Is there a better way to represent them?) I receive these errors:

julia> using Grassmann
julia> S = S"-+++"
julia> @mixedbasis S

julia> v1w1(v1)
ERROR: MethodError: no method matching evaluate2(::SubManifold{v₁₂₃₄w¹²³⁴,2,0x0000000000000011}, ::SubManifold{⟨-++++---⟩*,1,0x0000000000000001})
Closest candidates are:
  evaluate2(::A, ::B) where {V, A<:TensorTerm{V,1}, B<:TensorTerm{V,1}} at /Users/eschnett/.julia/packages/DirectSum/Ng7R9/src/operations.jl:229
Stacktrace:
 [1] (::SubManifold{v₁₂₃₄w¹²³⁴,2,0x0000000000000011})(::SubManifold{⟨-++++---⟩*,1,0x0000000000000001}) at /Users/eschnett/.julia/packages/DirectSum/Ng7R9/src/operations.jl:249
 [2] interform at /Users/eschnett/.julia/packages/AbstractTensors/zchWS/src/AbstractTensors.jl:124 [inlined]
 [3] (::SubManifold{⟨-++++---⟩*,2,0x0000000000000011})(::SubManifold{⟨-+++⟩,1,0x0000000000000001}) at /Users/eschnett/.julia/packages/DirectSum/Ng7R9/src/operations.jl:255
 [4] top-level scope at REPL[10]:1
 [5] eval(::Module, ::Any) at ./boot.jl:331
 [6] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/eschnett/src/julia-1.4/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [7] run_backend(::REPL.REPLBackend) at /Users/eschnett/.julia/packages/Revise/C272c/src/Revise.jl:1075
 [8] top-level scope at none:0

It seems that operations are not defined on pure basis vectors, only on linear combinations of them. However:

julia> (-v1w1+v2w2)(v1)
ERROR: InexactError: Bool(-1)
Stacktrace:
 [1] Bool at ./float.jl:73 [inlined]
 [2] convert at ./number.jl:7 [inlined]
 [3] convert at ./essentials.jl:310 [inlined] (repeats 2 times)
 [4] setindex! at ./array.jl:826 [inlined]
 [5] dualform(::SubManifold{⟨-++++---⟩*,8,0x00000000000000ff}) at /Users/eschnett/.julia/dev/Grassmann/src/forms.jl:142
 [6] (::Chain{⟨-++++---⟩*,2,Int64,28})(::SubManifold{⟨-++++---⟩*,1,0x0000000000000001}) at /Users/eschnett/.julia/dev/Grassmann/src/forms.jl:187
 [7] interform at /Users/eschnett/.julia/packages/AbstractTensors/zchWS/src/AbstractTensors.jl:124 [inlined]
 [8] (::Chain{⟨-++++---⟩*,2,Int64,28})(::SubManifold{⟨-+++⟩,1,0x0000000000000001}) at /Users/eschnett/.julia/dev/Grassmann/src/forms.jl:176
 [9] top-level scope at REPL[11]:1
 [10] eval(::Module, ::Any) at ./boot.jl:331
 [11] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/eschnett/src/julia-1.4/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [12] run_backend(::REPL.REPLBackend) at /Users/eschnett/.julia/packages/Revise/C272c/src/Revise.jl:1075
 [13] top-level scope at none:0

The latter seems to happen in line 142 of forms.jl:

            @inbounds mV[Q] = (intlog(Y)+1,V[intlog(x)+1])

Should the second tuple element have an != 0 added to handle negative signatures?

Another issue (with a positive metric signature):

julia> using Grassmann
julia> @mixedbasis 2
julia> (1v1w1+0v2w2)(v12)
ERROR: StackOverflowError:
Stacktrace:
 [1] interform(::Chain{⟨++--⟩*,2,Int64,6}, ::SubManifold{⟨++--⟩*,2,0x0000000000000003}) at /Users/eschnett/.julia/packages/AbstractTensors/zchWS/src/AbstractTensors.jl:116
 [2] (::Chain{⟨++--⟩*,2,Int64,6})(::SubManifold{⟨++--⟩*,2,0x0000000000000003}) at /Users/eschnett/.julia/packages/Grassmann/9da5V/src/forms.jl:176
 ... (the last 2 lines are repeated 39990 more times)
 [79983] interform(::Chain{⟨++--⟩*,2,Int64,6}, ::SubManifold{⟨++--⟩*,2,0x0000000000000003}) at /Users/eschnett/.julia/packages/AbstractTensors/zchWS/src/AbstractTensors.jl:116

The tensor evaluation feature is not currently fully implemented, since it's not completely essential to do math with geometric algebra.

It is planned to eventually fully implement this, but it's not a high priority at the moment and requires a lot of detail work to get right for every type of basis (there are a lot of different nuances).

I can't give an exact timeline at the moment for when I'll finish implementing it, since I have a lot of other ideas I want to work on as well. There's a lot of stuff that can still be improved and added.

I think the error you got is due to the fact that I previously used a Bool there, but then I generalized it so it can take on values other than 1 and -1, which is why it expects currently a Bool. In other words, this feature has not been updated to the new format where no longer only use a Bool.