Skip to content

Commit 8fc6ac2

Browse files
committed
re-organized code definitions
1 parent 76bcb4f commit 8fc6ac2

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ environment:
66
- julia_version: 1.3
77
- julia_version: 1.4
88
- julia_version: 1.5
9+
- julia_version: 1.6
910
- julia_version: nightly
1011

1112
platform:

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ julia:
1111
- 1.3
1212
- 1.4
1313
- 1.5
14+
- 1.6
1415
- nightly
1516
matrix:
1617
allow_failures:

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.7.6"
4+
version = "0.7.7"
55

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

src/DirectSum.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ for A ∈ (Signature,DiagonalForm,SubManifold)
292292
end
293293
end
294294

295+
# conversions
296+
297+
@pure Manifold(V::SubManifold{M}) where M = (t=typeof(M);t<:SubManifold||t<:Int ? M : V)
298+
@pure Signature(V::SubManifold{M,N} where M) where N = Signature{N,options(V)}(Vector(signbit.(V[:])),diffvars(V),diffmode(V))
299+
@pure Signature(V::DiagonalForm{N,M}) where {N,M} = Signature{N,M}(Vector(signbit.(V[:])))
300+
@pure DiagonalForm(V::Signature{N,M}) where {N,M} = DiagonalForm{N,M}([t ? -1 : 1 for tV[:]])
301+
302+
# indices
303+
304+
#@pure supblade(N,S,B) = bladeindex(N,expandbits(N,S,B))
305+
#@pure supmulti(N,S,B) = basisindex(N,expandbits(N,S,B))
306+
295307
@inline indices(b::SubManifold{V}) where V = indices(UInt(b),mdims(V))
296308

297309
shift_indices(V::M,b::UInt) where M<:TensorBundle = shift_indices!(V,copy(indices(b,mdims(V))))
@@ -409,6 +421,13 @@ for Field ∈ Fields
409421
end
410422
end
411423

424+
for M (:Signature,:DiagonalForm,:SubManifold)
425+
@eval begin
426+
@inline (V::$M)(s::LinearAlgebra.UniformScaling{T}) where T = Simplex{V}(T<:Bool ? (s.λ ? 1 : -1) : s.λ,getbasis(V,(one(T)<<(mdims(V)-diffvars(V)))-1))
427+
(W::$M)(b::Simplex) = Simplex{W}(value(b),W(basis(b)))
428+
end
429+
end
430+
412431
include("generic.jl")
413432
include("operations.jl")
414433
include("basis.jl")

src/operations.jl

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ end
6161
end
6262
for M (0,4)
6363
@eval begin
64-
@pure function Base.:^(v::T,i::I) where T<:TensorBundle{N,$M,S} where {N,S,I<:Integer}
64+
@pure function Base.:^(v::T,i::I) where T<:TensorBundle{N,$M} where {N,I<:Integer}
6565
iszero(i) && (return V0)
6666
let V = v
6767
for k 2:i
@@ -154,23 +154,6 @@ end
154154
end
155155
end
156156

157-
# conversions
158-
159-
@pure Manifold(V::SubManifold{M}) where M = (t=typeof(M);t<:SubManifold||t<:Int ? M : V)
160-
@pure Signature(V::SubManifold{M,N} where M) where N = Signature{N,options(V)}(Vector(signbit.(V[:])),diffvars(V),diffmode(V))
161-
@pure Signature(V::DiagonalForm{N,M}) where {N,M} = Signature{N,M}(Vector(signbit.(V[:])))
162-
@pure DiagonalForm(V::Signature{N,M}) where {N,M} = DiagonalForm{N,M}([t ? -1 : 1 for tV[:]])
163-
164-
for M (:Signature,:DiagonalForm,:SubManifold)
165-
@eval begin
166-
@inline (V::$M)(s::LinearAlgebra.UniformScaling{T}) where T = Simplex{V}(T<:Bool ? (s.λ ? 1 : -1) : s.λ,getbasis(V,(one(T)<<(mdims(V)-diffvars(V)))-1))
167-
(W::$M)(b::Simplex) = Simplex{W}(value(b),W(basis(b)))
168-
end
169-
end
170-
171-
#@pure supblade(N,S,B) = bladeindex(N,expandbits(N,S,B))
172-
#@pure supmulti(N,S,B) = basisindex(N,expandbits(N,S,B))
173-
174157
## Basis forms
175158

176159
@pure evaluate1(a::A,b::B) where {A<:TensorTerm{V,1},B<:TensorTerm{V,1}} where V = evaluate1(V,UInt(a),UInt(b))

0 commit comments

Comments
 (0)