diff --git a/docs/src/algebra.md b/docs/src/algebra.md index 21af34f..0360c10 100644 --- a/docs/src/algebra.md +++ b/docs/src/algebra.md @@ -342,7 +342,7 @@ These methods can be applied to any `MultiVector` simplicial complex. Let ``v_\pm^2 = \pm1`` be a basis with ``v_\infty = v_++v_-`` and ``v_\emptyset = (v_--v_+)/2`` An embedding space ``\mathbb R^{p+1,q+1}`` carrying the action from the group ``O(p+1,q+1)`` then has ``v_\infty^2 =0``, ``v_\emptyset^2 =0``, -``v_\infty \cdot v_\emptyset = 1``, and ``v_{\infty\emptyset}^2 = 1`` with +``v_\infty \cdot v_\emptyset = -1``, and ``v_{\infty\emptyset}^2 = 1`` with Minkowski plane ``v_{\infty\emptyset}`` having the Hestenes-Dirac-Clifford product properties, ```@repl ga using Grassmann; @basis S"∞∅++" diff --git a/src/composite.jl b/src/composite.jl index 5fcc660..9053990 100644 --- a/src/composite.jl +++ b/src/composite.jl @@ -57,10 +57,12 @@ end @inline unabs!(t::Expr) = (t.head == :call && t.args[1] == :abs) ? t.args[2] : t function Base.exp(t::T) where T<:TensorGraded - S = T<:SubManifold - i = T<:TensorTerm ? basis(t) : t + S,B = T<:SubManifold,T<:TensorTerm + i = B ? basis(t) : t sq = i*i - if isscalar(sq) + if B && isnull(t) + return one(V) + elseif isscalar(sq) hint = value(scalar(sq)) isnull(hint) && (return 1+t) grade(t)==0 && (return Simplex{Manifold(t)}(AbstractTensors.exp(value(S ? t : scalar(t))))) diff --git a/src/multivectors.jl b/src/multivectors.jl index e74842e..e10e11d 100644 --- a/src/multivectors.jl +++ b/src/multivectors.jl @@ -63,6 +63,11 @@ function (m::Chain{V,G,T})(i::Integer) where {V,G,T} Simplex{V,G,SubManifold{V}(indexbasis(ndims(V),G)[i]),T}(m[i]) end +Chain{V,1}(m::SMatrix{N,N}) where {V,N} = Chain{V,1}(Chain{V,1}.(getindex.(Ref(m),:,SVector{N}(1:N)))) +Chain{V,1,Chain{W,1}}(m::SMatrix{M,N}) where {V,W,M,N} = Chain{V,1}(Chain{W,1}.(getindex.(Ref(m),:,SVector{N}(1:N)))) + +Base.inv(m::Chain{V,1,<:Chain{W,1}}) where {V,W} = Chain{V,1,Chain{W,1}}(inv(SMatrix(m))) + function show(io::IO, m::Chain{V,G,T}) where {V,G,T} ib = indexbasis(ndims(V),G) @inbounds tmv = typeof(m.v[1]) @@ -123,7 +128,9 @@ function clearbundlecache!() end @pure bundle(::ChainBundle{V,G,T,P} where {V,G,T}) where P = P @pure deletebundle!(V) = deletebundle!(bundle(V)) -@pure deletebundle!(P::Int) = (bundle_cache[P] = [Chain{ℝ^0,0,Int}(SVector(0))]) +@pure function deletebundle!(P::Int) + bundle_cache[P] = [Chain{ℝ^0,0,Int}(SVector(0))] +end @pure isbundle(::ChainBundle) = true @pure isbundle(t) = false @pure ispoints(t) = isbundle(t) && rank(t) == 1 && !isbundle(Manifold(t))