Skip to content

Commit

Permalink
created projective unsplitter norm and tidelift enterprise referral
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Nov 4, 2019
1 parent 6838f5f commit 2b4d96d
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ github: [chakravala]
patreon: dreamscatter
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: julia/Grassmann
tidelift: "julia/Grassmann"
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
custom: https://liberapay.com/chakravala
7 changes: 1 addition & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Reduce = "93e0c654-6965-5f22-aba9-9c1ae6b3c259"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
julia = "1"
Reduce = "1.2"
DirectSum = "0.4"
AbstractTensors = "0.3"
AbstractLattices = ">=0"
Combinatorics = ">=0"
ComputedFieldTypes = ">=0"
Leibniz = ">=0"
Requires = ">=0"
StaticArrays = ">=0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Additionally, the universal interoperability between different sub-algebras is e

* [Design, code generation](#design-code-generation)
* [Requirements](#requirements)
* [Grassmann for enterprise](#grassmann-for-enterprise)
* [Direct-sum yields VectorBundle parametric type polymorphism ⨁](#direct-sum-yields-vectorspace-parametric-type-polymorphism-)
* [Interoperability for TensorAlgebra{V}](#interoperability-for-tensoralgebrav)
* [Generating elements and geometric algebra Λ(V)](#generating-elements-and-geometric-algebra-λv)
Expand Down Expand Up @@ -57,7 +58,7 @@ It can be used to work with automatic differentiation and differential geometry,

```Julia
using Grassmann, Makie; @basis S"∞+++"
streamplot(vectorfield(exp((π/4)*(v12+v∞3),V(2,3,4),V(1,2,3)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
streamplot(vectorfield(exp((π/4)*(v12+v∞3)),V(2,3,4),V(1,2,3)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
```
![paper/img/wave.png](paper/img/wave.png)

Expand Down Expand Up @@ -89,6 +90,12 @@ The package is compatible via [Requires.jl](https://github.com/MikeInnes/Require
[GeometryTypes,jl](https://github.com/JuliaGeometry/GeometryTypes.jl),
[Makie.jl](https://github.com/JuliaPlots/Makie.jl).

## Grassmann for enterprise

Available as part of the Tidelift Subscription

The maintainers of Grassmann and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/julia-grassmann?utm_source=julia-grassmann&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

## Direct-sum yields `VectorBundle` parametric type polymorphism ⨁

The *DirectSum.jl* package is a work in progress providing the necessary tools to work with an arbitrary `Manifold` specified by an encoding.
Expand Down Expand Up @@ -326,7 +333,7 @@ Due to [GeometryTypes,jl](https://github.com/JuliaGeometry/GeometryTypes.jl) `Po
```Julia
using Grassmann, Makie
basis"2" # Euclidean
streamplot(vectorfield(v1*exp*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp((π/2)*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(v1*exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)
Expand All @@ -351,7 +358,7 @@ lines(points(f,V(3,4,5)))
```Julia
using Grassmann, Makie; @basis S"∞+++"
streamplot(vectorfield(exp((π/4)*(v12+v∞3),V(2,3,4)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
streamplot(vectorfield(exp((π/4)*(v12+v∞3)),V(2,3,4)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
```
![paper/img/orb.png](paper/img/orb.png)
Expand Down
10 changes: 5 additions & 5 deletions paper/paper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ \section{Leibniz operators and Grassmann's Hodge-DeRahm theory}
\end{align*}
\end{theorem}
\begin{proof}
$\partial\omega = \omega\cdot\nabla = \star(\star\omega\wedge\star^2\nabla) = (-1)^n(-1)^{nk}\star d\star\omega$.
$\partial\omega = \omega\cdot\nabla = \star\inv(\star\omega\wedge\star^2\nabla) = (-1)^n(-1)^{nk}\star d\star\omega$.


Then substitute this into $\int_M \omega\wedge(-1)^{mk+m+1}\star\star d\star\eta = (-1)^{km+m+1}(-1)^{(m-k+1)(k-1)}\int_M\omega\wedge d\star\eta$,
with identity $(-1)^{km+m+1}(-1)^{(m-k+1)(k-1)}=(-1)^k$ and
apply the identity $(-1)^{km+m+1}(-1)^{(m-k+1)(k-1)}=(-1)^k$ and
$ (-1)^k\int_M\omega\wedge d\star\eta = \int_M d(\omega\wedge\star\eta) - (-1)^{k-1}\omega\wedge d\star\eta = \int_M d\omega\wedge\star\eta$.
Stokes identity can be proved by relying on a variant of the \textit{common factor theorem} by Browne \cite{browne}.
\end{proof}
Expand Down Expand Up @@ -457,7 +457,7 @@ \section{Leibniz operators and Grassmann's Hodge-DeRahm theory}
\begin{lstlisting}[language = Julia]
using Grassmann, Makie
basis"2" # Euclidean
streamplot(vectorfield(v1*exp(π*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp(π*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp((π/2)*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)
streamplot(vectorfield(v1*exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)
Expand Down Expand Up @@ -511,7 +511,7 @@ \section{Leibniz operators and Grassmann's Hodge-DeRahm theory}
\end{align*}
having dimensional equivalence brought by the Grassmann-Poincare-Hodge complement duality,
\begin{align*}
\mc H^{n-p}M &\cong \frac{\ker(d\Omega^{n-p}M)}{\im{d\Omega^{n-p-1}M}}, & \dim\mc H^pM &= \dim\frac{\ker(\partial\Omega^pM)}{\im{\partial\Omega^{p+1}M}}
\mc H^{n-p}M &\cong \frac{\ker(d\Omega^{n-p}M)}{\im{d\Omega^{n-p+1}M}}, & \dim\mc H^pM &= \dim\frac{\ker(\partial\Omega^pM)}{\im{\partial\Omega^{p+1}M}}
\end{align*}
The rank of the grade $p$ boundary incidence operator is
$$ \text{rank}\gen{\partial\gen{M}_{p+1}}_p = \min\set{\dim\gen{\partial\gen{M}_{p+1}}_p,\dim\gen{M}_{p+1}} $$
Expand All @@ -527,7 +527,7 @@ \section{Leibniz operators and Grassmann's Hodge-DeRahm theory}

In Fig. 4, different possible discrete bivector topologies in a projective Riemann sphere setting are examined.
The figures are based on the product topology of two rotation bivectors.
When the Euclidean $\mb R^4$ basis is combined with projective geometric algebra, resulting one parameter Lie groups can be visualized in the form of a torus in $\mb R^3$.
When the Euclidean $\mb R^4$ basis is combined with projective geometric algebra, resulting one parameter Lie groups can be visualized as a fibration of a torus in $\mb R^3$.
When the fourth $v_\infty$ basis direction is rotated into the Minkowski plane, the double rotation becomes a helix with translational single rotation. In examples (b)$\sim$(c) the bivector is modulated.

\begin{figure}[t]
Expand Down
4 changes: 2 additions & 2 deletions src/Grassmann.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module Grassmann
# This file is part of Grassmann.jl. It is licensed under the GPL license
# Grassmann Copyright (C) 2019 Michael Reed

using Combinatorics, StaticArrays, Requires
using Combinatorics, StaticArrays, SparseArrays
using ComputedFieldTypes, AbstractLattices
using DirectSum, AbstractTensors
using DirectSum, AbstractTensors, Requires

export vectorspace, , ℝ, @V_str, @S_str, @D_str, Signature,DiagonalForm,SubManifold, value
import DirectSum: hasinf, hasorigin, mixedmode, dual, value, vectorspace, V0, , pre, vsn
Expand Down
57 changes: 56 additions & 1 deletion src/multivectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,61 @@ Base.copysign(x::Simplex{V,G,B,T},y::Simplex{V,G,B,T}) where {V,G,B,T} = Simplex
return A
end

# genfun
# Euclidean norm (unsplitter)

unsplitstart(g) = 1|((UInt(1)<<(g-1)-1)<<2)
unsplitend(g) = (UInt(1)<<g-1)<<2

const unsplitter_cache = SparseMatrixCSC{Float64,Int64}[]
@pure unsplitter_calc(n) = (n2=Int(n/2);sparse(1:n2,1:n2,1,n,n)+sparse(1:n2,(n2+1):n,-1/2,n,n)+sparse((n2+1):n,(n2+1):n,1/2,n,n)+sparse((n2+1):n,1:n2,1,n,n))
@pure function unsplitter(n::Int)
n2 = Int(n/2)
for k length(unsplitter_cache)+1:n2
push!(unsplitter_cache,unsplitter_calc(2k))
end
@inbounds unsplitter_cache[n2]
end
@pure unsplitter(n,g) = unsplitter(bladeindex(n,unsplitend(g))-bladeindex(n,unsplitstart(g)))

for implex (MSB...,Basis)
@eval begin
#norm(t::$implex) = norm(unsplitval(t))
function unsplitvalue(a::$implex{V,G}) where {V,G}
!(hasinf(V) && hasorigin(V)) && (return value(a))
#T = valuetype(a)
#$(insert_expr((:N,:t,:out),:mvec,:T,:(typeof((one(T)/(2one(T))))))...)
#out = copy(value(a,t))
return unsplitvalue(MChain(a))
end
end
end

for Chain MSC
@eval begin
#norm(t::$Chain) = norm(unsplitval(t))
function unsplitvalue(a::$Chain{T,V,G}) where {T,V,G}
!(hasinf(V) && hasorigin(V)) && (return value(a))
$(insert_expr((:N,:t,:out),:mvec,:T,:(typeof((one(T)/(2one(T))))))...)
out = copy(value(a,mvec(N,G,t)))
bi = bladeindex(N,unsplitstart(G)):bladeindex(N,unsplitend(G))-1
out[bi] = unsplitter(N,G)*out[bi]
return out
end
end
end

@eval begin
#norm(t::MultiVector) = norm(unsplitval(t))
function unsplitvalue(a::MultiVector{T,V}) where {T,V}
!(hasinf(V) && hasorigin(V)) && (return value(a))
$(insert_expr((:N,:t,:out),:mvec,:T,:(typeof((one(T)/(2one(T))))))...)
out = copy(value(a,mvec(N,t)))
for G 1:N-1
bi = basisindex(N,unsplitstart(G)):basisindex(N,unsplitend(G))-1
out[bi] = unsplitter(N,G)*out[bi]
end
return out
end
end

# genfun

2 comments on commit 2b4d96d

@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 updated: JuliaRegistries/General/4938

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 Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.3 -m "<description of version>" 2b4d96dedb98325ee0f1630dfa83f5a89507d364
git push origin v0.3.3

Please sign in to comment.