Skip to content

Commit 918fdce

Browse files
committed
implemented antigrade, antireverse, etc
1 parent d65fa80 commit 918fdce

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DirectSum"
22
uuid = "22fd7b30-a8c0-5bf2-aabe-97783860d07c"
33
authors = ["Michael Reed"]
4-
version = "0.8.7"
4+
version = "0.8.8"
55

66
[deps]
77
ComputedFieldTypes = "459fdd68-db75-56b8-8c15-d717a790f88e"

src/DirectSum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import Leibniz: parityrightnull, parityleftnull, parityrightnullpre, parityleftn
3939
import Leibniz: hasconformal, parval, TensorTerm, mixed, subs, sups, vio
4040

4141
import Leibniz: grade, order, options, metric, polymode, dyadmode, diffmode, diffvars
42-
import Leibniz: hasinf, hasorigin, norm, indices, isbasis, Bits, bits,
42+
import Leibniz: antigrade, hasinf, hasorigin, norm, indices, isbasis, Bits, bits,
4343
import Leibniz: isdyadic, isdual, istangent, involute, basis, alphanumv, alphanumw
4444

4545
import Leibniz: algebra_limit, sparse_limit, cache_limit, fill_limit

src/generic.jl

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
export basis, grade, order, options, metric, polymode, dyadmode, diffmode, diffvars
1616
export valuetype, value, hasinf, hasorigin, isorigin, norm, indices, tangent, isbasis,
17+
export antigrade, antireverse, antiinvolute, anticlifford
1718

1819
(M::Signature)(b::Int...) = Submanifold{M}(b)
1920
(M::DiagonalForm)(b::Int...) = Submanifold{M}(b)
@@ -96,6 +97,8 @@ end
9697
grade(t,G::Int) = grade(t,val(G))
9798
grade(t::TensorGraded{V,G},g::Val{G}) where {V,G} = t
9899
grade(t::TensorGraded{V,L},g::Val{G}) where {V,G,L} = Zero(V)
100+
antigrade(t,G::Int) = antigrade(t,val(G))
101+
antigrade(t::TensorAlgebra{V},::Val{G}) where {V,G} = grade(t,val(grade(V)-G))
99102

100103
@pure hasinf(::T) where T<:TensorBundle{N,M} where N where M = _hasinf(M)
101104
@pure hasinf(::Submanifold{M,N,S} where N) where {M,S} = hasinf(M) && isodd(S)
@@ -154,6 +157,7 @@ export involute, clifford
154157

155158
@pure grade_basis(v,::Submanifold{V,G,B} where G) where {V,B} = grade_basis(V,B)
156159
@pure grade(v,::Submanifold{V,G,B} where G) where {V,B} = grade(V,B)
160+
@pure antigrade(v,::Submanifold{V,G,B} where G) where {V,B} = antigrade(V,B)
157161

158162
@doc """
159163
~(ω::TensorAlgebra)
@@ -180,16 +184,39 @@ Involute of an element: ~ω = (-1)^grade(ω)*ω
180184
@doc """
181185
clifford(ω::TensorAlgebra)
182186
183-
Clifford conjugate of an element: clifford(ω) = involute(conj(ω))
187+
Clifford conjugate of an element: clifford(ω) = involute(reverse(ω))
184188
""" clifford
185189

190+
"""
191+
antireverse(ω::TensorAlgebra)
192+
193+
Anti-reverse of an element: ~ω = (-1)^(antigrade(ω)*(antigrade(ω)-1)/2)*ω
194+
""" antireverse
195+
196+
@doc """
197+
antiinvolute(ω::TensorAlgebra)
198+
199+
Anti-involute of an element: ~ω = (-1)^antigrade(ω)*ω
200+
""" antiinvolute
201+
202+
@doc """
203+
anticlifford(ω::TensorAlgebra)
204+
205+
Anti-clifford conjugate of an element: anticlifford(ω) = antiinvolute(antireverse(ω))
206+
""" anticlifford
207+
186208
for r (:reverse,:involute,:(Base.conj),:clifford)
187209
p = Symbol(:parity,r==:(Base.conj) ? :conj : r)
210+
ar = Symbol(:anti,r)
188211
@eval begin
189212
@pure function $r(b::Submanifold{V,G,B}) where {V,G,B}
190213
$p(grade(V,B)) ? Single{V}(-value(b),b) : b
191214
end
192215
$r(b::Single) = value(b) 0 ? Single(value(b),$r(basis(b))) : Zero(Manifold(b))
216+
@pure function $ar(b::Submanifold{V,G,B}) where {V,G,B}
217+
$p(antigrade(V,B)) ? Single{V}(-value(b),b) : b
218+
end
219+
$ar(b::Single) = value(b) 0 ? Single(value(b),$ar(basis(b))) : Zero(Manifold(b))
193220
end
194221
end
195222

0 commit comments

Comments
 (0)