Skip to content

Commit

Permalink
improved exp(::TensorGraded), fixed #71
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Jun 9, 2020
1 parent 4b45a9f commit 0127915
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/algebra.md
Expand Up @@ -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"∞∅++"
Expand Down
8 changes: 5 additions & 3 deletions src/composite.jl
Expand Up @@ -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)))))
Expand Down
9 changes: 8 additions & 1 deletion src/multivectors.jl
Expand Up @@ -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])
Expand Down Expand Up @@ -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))
Expand Down

2 comments on commit 0127915

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/16061

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.11 -m "<description of version>" 012791527c53ccdb08469b6d84d92f50a680fc79
git push origin v0.5.11

Please sign in to comment.