chakravala / Grassmann.jl

@@ -128,7 +128,7 @@
Loading
128 128
129 129
function Chain(val::𝕂,v::SubManifold{V,G}) where {V,G,𝕂}
130 130
    N = mdims(V)
131 -
    Chain{V,G}(setblade!(zeros(mvec(N,G,𝕂)),val,bits(v),Val(N)))
131 +
    Chain{V,G}(setblade!(zeros(mvec(N,G,𝕂)),val,UInt(v),Val(N)))
132 132
end
133 133
Chain(v::SubManifold) = Chain(one(Int),v)
134 134
Chain(v::Simplex) = Chain(v.v,basis(v))
@@ -137,7 +137,7 @@
Loading
137 137
Chain{V,G,T,X}(x::Simplex{V,0}) where {V,G,T,X} = Chain{V,G}(zeros(mvec(mdims(V),G,T)))
138 138
function Chain{V,0,T,X}(x::Simplex{V,0,v}) where {V,T,X,v}
139 139
    N = mdims(V)
140 -
    Chain{V,0}(setblade!(zeros(mvec(N,0,T)),value(x),bits(v),Val(N)))
140 +
    Chain{V,0}(setblade!(zeros(mvec(N,0,T)),value(x),UInt(v),Val(N)))
141 141
end
142 142
143 143
getindex(m::Chain,i::T) where T<:AbstractVector{<:SubManifold} = getindex.(m,i)
@@ -149,14 +149,14 @@
Loading
149 149
end
150 150
151 151
function ==(a::Chain{V,G},b::T) where T<:TensorTerm{V,G} where {V,G}
152 -
    i = bladeindex(mdims(V),bits(basis(b)))
152 +
    i = bladeindex(mdims(V),UInt(basis(b)))
153 153
    @inbounds a[i] == value(b) && (prod(a[1:i-1].==0) && prod(a[i+1:end].==0))
154 154
end
155 155
==(a::T,b::Chain{V}) where T<:TensorTerm{V} where V = b==a
156 156
==(a::Chain{V},b::T) where T<:TensorTerm{V} where V = prod(0==value(b).==value(a))
157 157
158 158
function isapprox(a::Chain{V,G},b::T) where T<:TensorTerm{V,G} where {V,G}
159 -
    i = bladeindex(mdims(V),bits(basis(b)))
159 +
    i = bladeindex(mdims(V),UInt(basis(b)))
160 160
    @inbounds a[i] β‰ˆ value(b) && (prod(a[1:i-1].==0) && prod(a[i+1:end].==0))
161 161
end
162 162
isapprox(a::T,b::Chain{V}) where T<:TensorTerm{V} where V = b==a
@@ -201,6 +201,7 @@
Loading
201 201
@pure iscell(t) = isbundle(t) && islocal(Manifold(t))
202 202
203 203
@pure Manifold(::ChainBundle{V}) where V = V
204 +
@pure Manifold(::Type{<:ChainBundle{V}}) where V = V
204 205
@pure Manifold(::Vector{<:Chain{V}}) where V = V
205 206
@pure LinearAlgebra.rank(M::ChainBundle{V,G} where V) where G = G
206 207
@pure grade(::ChainBundle{V}) where V = grade(V)
@@ -312,7 +313,7 @@
Loading
312 313
end
313 314
==(a::Chain{V,G,T},b::MultiVector{V,S}) where {V,S,G,T} = b == a
314 315
function ==(a::MultiVector{V,S} where S,b::T) where T<:TensorTerm{V,G} where {V,G}
315 -
    i = basisindex(mdims(V),bits(basis(b)))
316 +
    i = basisindex(mdims(V),UInt(basis(b)))
316 317
    @inbounds a.v[i] == value(b) && prod(a.v[1:i-1] .== 0) && prod(a.v[i+1:end] .== 0)
317 318
end
318 319
==(a::T,b::MultiVector{V,S} where S) where T<:TensorTerm{V} where V = b==a
@@ -325,7 +326,7 @@
Loading
325 326
326 327
function MultiVector(val::T,v::SubManifold{V,G}) where {V,T,G}
327 328
    N = mdims(V)
328 -
    MultiVector{V}(setmulti!(zeros(mvec(N,T)),val,bits(v),Val{N}()))
329 +
    MultiVector{V}(setmulti!(zeros(mvec(N,T)),val,UInt(v),Val{N}()))
329 330
end
330 331
MultiVector(v::SubManifold{V,G}) where {V,G} = MultiVector(one(Int),v)
331 332
for var ∈ ((:V,:T),(:T,))

@@ -144,7 +144,7 @@
Loading
144 144
end
145 145
@pure parity(v::Int,a::UInt,b::UInt) = parity(v,metric(v),a,b)
146 146
@pure parity(v::T,a::UInt,b::UInt) where T<:Manifold = parity(Signature(v),a,b)
147 -
@pure parity(a::SubManifold{V,G,B},b::SubManifold{V,L,C}) where {V,G,B,L,C} = parity(V,bits(a),bits(b))
147 +
@pure parity(a::SubManifold{V,G,B},b::SubManifold{V,L,C}) where {V,G,B,L,C} = parity(V,UInt(a),UInt(b))
148 148
149 149
### parity product caches
150 150
@@ -171,8 +171,8 @@
Loading
171 171
                for k ∈ length($extra[N][S])+1:m1
172 172
                    @inbounds push!($extra[N][S],Dict{UInt,Dict{UInt,Dict{UInt,$T}}}())
173 173
                end
174 -
                @inbounds !haskey($extra[N][S][m1],s) && push!($extra[N][S][m1],s=>Dict{Bits,Dict{Bits,$T}}())
175 -
                @inbounds !haskey($extra[N][S][m1][s],a) && push!($extra[N][S][m1][s],a=>Dict{Bits,$T}())
174 +
                @inbounds !haskey($extra[N][S][m1],s) && push!($extra[N][S][m1],s=>Dict{UInt,Dict{UInt,$T}}())
175 +
                @inbounds !haskey($extra[N][S][m1][s],a) && push!($extra[N][S][m1][s],a=>Dict{UInt,$T}())
176 176
                @inbounds !haskey($extra[N][S][m1][s][a],b) && push!($extra[N][S][m1][s][a],b=>$calc(V,a,b))
177 177
                @inbounds $extra[N][S][m1][s][a][b]
178 178
            else
@@ -196,7 +196,7 @@
Loading
196 196
                @inbounds $cache[n][S][m1][s][a1][b+1]
197 197
            end
198 198
        end
199 -
        @pure $par(a::SubManifold{V,G,B},b::SubManifold{V,L,C}) where {V,G,B,L,C} = $par(V,bits(a),bits(b))
199 +
        @pure $par(a::SubManifold{V,G,B},b::SubManifold{V,L,C}) where {V,G,B,L,C} = $par(V,UInt(a),UInt(b))
200 200
    end
201 201
end
202 202
@@ -212,7 +212,7 @@
Loading
212 212
213 213
for (op,other) ∈ ((:angular,:radial),(:radial,:angular))
214 214
    @eval begin
215 -
        $op(t::T) where T<:TensorTerm{V,G} where {V,G} = basisindex(mdims(V),bits(basis(t))) ∈ $op(V,G) ? t : zero(V)
215 +
        $op(t::T) where T<:TensorTerm{V,G} where {V,G} = basisindex(mdims(V),UInt(basis(t))) ∈ $op(V,G) ? t : zero(V)
216 216
        function $op(t::Chain{V,G,T}) where {V,G,T}
217 217
            out = copy(value(t,mvec(mdims(V),G,T)))
218 218
            for k ∈ $other(V,G)

@@ -568,6 +568,14 @@
Loading
568 568
    end
569 569
end
570 570
571 +
function area(m::Vector{<:Chain})
572 +
    S = m[end]∧m[1]
573 +
    for i ∈ 1:length(m)-1
574 +
        S += m[i]∧m[i+1]
575 +
    end
576 +
    return value(abs(⋆(S))/2)
577 +
end
578 +
571 579
initedges(p::ChainBundle) = Chain{p,1}.(1:length(p)-1,2:length(p))
572 580
initedges(r::R) where R<:AbstractVector = initedges(ChainBundle(initpoints(r)))
573 581
function initmesh(r::R) where R<:AbstractVector
@@ -642,7 +650,7 @@
Loading
642 650
    (T = promote_type(TA, Chain{V,G,𝕂,X}); mul!(similar(x, T, size(adjA, 1)), adjA, x, 2, 0))
643 651
*(transA::LinearAlgebra.Transpose{<:Any,<:SparseMatrixCSC{TA,S}}, x::StridedVector{Chain{V,G,𝕂,X}}) where {TA,S,V,G,𝕂,X} =
644 652
    (T = promote_type(TA, Chain{V,G,𝕂,X}); mul!(similar(x, T, size(transA, 1)), transA, x, 1, 0))
645 -
if VERSION >= v"1.4"
653 +
if VERSION >= v"1.4" && VERSION < v"1.6"
646 654
    *(adjA::LinearAlgebra.Adjoint{<:Any,<:SparseMatrixCSC{TA,S}}, B::SparseArrays.AdjOrTransStridedOrTriangularMatrix{Chain{V,G,𝕂,X}}) where {TA,S,V,G,𝕂,X} =
647 655
        (T = promote_type(TA, Chain{V,G,𝕂,X}); mul!(similar(B, T, (size(adjA, 1), size(B, 2))), adjA, B, 1, 0))
648 656
    *(transA::LinearAlgebra.Transpose{<:Any,<:SparseMatrixCSC{TA,S}}, B::SparseArrays.AdjOrTransStridedOrTriangularMatrix{Chain{V,G,𝕂,X}}) where {TA,S,V,G,𝕂,X} =

@@ -18,15 +18,15 @@
Loading
18 18
@pure *(a::SubManifold{V},b::SubManifold{V}) where V = mul(a,b)
19 19
*(a::X,b::Y,c::Z...) where {X<:TensorAlgebra,Y<:TensorAlgebra,Z<:TensorAlgebra} = *(a*b,c...)
20 20
21 -
@pure function mul(a::SubManifold{V},b::SubManifold{V},der=derive_mul(V,bits(a),bits(b),1,true)) where V
22 -
    ba,bb = bits(a),bits(b)
21 +
@pure function mul(a::SubManifold{V},b::SubManifold{V},der=derive_mul(V,UInt(a),UInt(b),1,true)) where V
22 +
    ba,bb = UInt(a),UInt(b)
23 23
    (diffcheck(V,ba,bb) || iszero(der)) && (return g_zero(V))
24 -
    A,B,Q,Z = symmetricmask(V,bits(a),bits(b))
24 +
    A,B,Q,Z = symmetricmask(V,UInt(a),UInt(b))
25 25
    pcc,bas,cc = (hasinf(V) && hasorigin(V)) ? conformal(V,A,B) : (false,A⊻B,false)
26 26
    d = getbasis(V,bas|Q)
27 27
    out = (typeof(V)<:Signature || count_ones(A&B)==0) ? (parity(a,b)⊻pcc ? Simplex{V}(-1,d) : d) : Simplex{V}((pcc ? -1 : 1)*parityinner(V,A,B),d)
28 28
    diffvars(V)β‰ 0 && !iszero(Z) && (out = Simplex{V}(getbasis(loworder(V),Z),out))
29 -
    return cc ? (v=value(out);out+Simplex{V}(hasinforigin(V,A,B) ? -(v) : v,getbasis(V,conformalmask(V)⊻bits(d)))) : out
29 +
    return cc ? (v=value(out);out+Simplex{V}(hasinforigin(V,A,B) ? -(v) : v,getbasis(V,conformalmask(V)⊻UInt(d)))) : out
30 30
end
31 31
32 32
function *(a::Simplex{V},b::SubManifold{V}) where V
@@ -35,7 +35,7 @@
Loading
35 35
    order(a.v)+order(bas)>diffmode(V) ? zero(V) : Simplex{V}(v,bas)
36 36
end
37 37
function *(a::SubManifold{V},b::Simplex{V}) where V
38 -
    v = derive_mul(V,bits(a),bits(basis(b)),b.v,false)
38 +
    v = derive_mul(V,UInt(a),UInt(basis(b)),b.v,false)
39 39
    bas = mul(a,basis(b),v)
40 40
    order(b.v)+order(bas)>diffmode(V) ? zero(V) : Simplex{V}(v,bas)
41 41
end
@@ -78,7 +78,7 @@
Loading
78 78
wedges(x,i=length(x)-1) = i β‰  0 ? Expr(:call,:∧,wedges(x,i-1),x[1+i]) : x[1+i]
79 79
80 80
@pure function ∧(a::SubManifold{V},b::SubManifold{V}) where V
81 -
    ba,bb = bits(a),bits(b)
81 +
    ba,bb = UInt(a),UInt(b)
82 82
    A,B,Q,Z = symmetricmask(V,ba,bb)
83 83
    ((count_ones(A&B)>0) || diffcheck(V,ba,bb) || iszero(derive_mul(V,ba,bb,1,true))) && (return g_zero(V))
84 84
    d = getbasis(V,(A⊻B)|Q)
@@ -88,7 +88,7 @@
Loading
88 88
89 89
function ∧(a::X,b::Y) where {X<:TensorTerm{V},Y<:TensorTerm{V}} where V
90 90
    x,y = basis(a), basis(b)
91 -
    ba,bb = bits(x),bits(y)
91 +
    ba,bb = UInt(x),UInt(y)
92 92
    A,B,Q,Z = symmetricmask(V,ba,bb)
93 93
    ((count_ones(A&B)>0) || diffcheck(V,ba,bb)) && (return g_zero(V))
94 94
    v = derive_mul(V,ba,bb,value(a),value(b),AbstractTensors.∏)
@@ -114,19 +114,19 @@
Loading
114 114
115 115
@pure function ∨(a::SubManifold{V},b::SubManifold{V}) where V
116 116
    p,C,t,Z = regressive(a,b)
117 -
    (!t || iszero(derive_mul(V,bits(a),bits(b),1,true))) && (return g_zero(V))
117 +
    (!t || iszero(derive_mul(V,UInt(a),UInt(b),1,true))) && (return g_zero(V))
118 118
    d = getbasis(V,C)
119 119
    istangent(V) && !iszero(Z) && (d = Simplex{V}(getbasis(loworder(V),Z),d))
120 120
    return isone(p) ? d : Simplex{V}(p,d)
121 121
end
122 122
123 123
function ∨(a::X,b::Y) where {X<:TensorTerm{V},Y<:TensorTerm{V}} where V
124 -
    ba,bb = bits(basis(a)),bits(basis(b))
124 +
    ba,bb = UInt(basis(a)),UInt(basis(b))
125 125
    p,C,t,Z = regressive(V,ba,bb)
126 126
    !t  && (return g_zero(V))
127 127
    v = derive_mul(V,ba,bb,value(a),value(b),AbstractTensors.∏)
128 128
    if istangent(V) && !iszero(Z)
129 -
        _,_,Q,_ = symmetricmask(V,bits(basis(a)),bits(basis(b)))
129 +
        _,_,Q,_ = symmetricmask(V,UInt(basis(a)),UInt(basis(b)))
130 130
        v = !(typeof(v)<:TensorTerm) ? Simplex{V}(v,getbasis(V,Z)) : Simplex{V}(v,getbasis(loworder(V),Z))
131 131
        count_ones(Q)+order(v)>diffmode(V) && (return zero(V))
132 132
    end
@@ -170,19 +170,19 @@
Loading
170 170
"""
171 171
@pure function contraction(a::SubManifold{V},b::SubManifold{V}) where V
172 172
    g,C,t,Z = interior(a,b)
173 -
    (!t || iszero(derive_mul(V,bits(a),bits(b),1,true))) && (return g_zero(V))
173 +
    (!t || iszero(derive_mul(V,UInt(a),UInt(b),1,true))) && (return g_zero(V))
174 174
    d = getbasis(V,C)
175 175
    istangent(V) && !iszero(Z) && (d = Simplex{V}(getbasis(loworder(V),Z),d))
176 176
    return typeof(V) <: Signature ? (g ? Simplex{V}(-1,d) : d) : Simplex{V}(g,d)
177 177
end
178 178
179 179
function contraction(a::X,b::Y) where {X<:TensorTerm{V},Y<:TensorTerm{V}} where V
180 -
    ba,bb = bits(basis(a)),bits(basis(b))
180 +
    ba,bb = UInt(basis(a)),UInt(basis(b))
181 181
    g,C,t,Z = interior(V,ba,bb)
182 182
    !t && (return g_zero(V))
183 183
    v = derive_mul(V,ba,bb,value(a),value(b),AbstractTensors.dot)
184 184
    if istangent(V) && !iszero(Z)
185 -
        _,_,Q,_ = symmetricmask(V,bits(basis(a)),bits(basis(b)))
185 +
        _,_,Q,_ = symmetricmask(V,UInt(basis(a)),UInt(basis(b)))
186 186
        v = !(typeof(v)<:TensorTerm) ? Simplex{V}(v,getbasis(V,Z)) : Simplex{V}(v,getbasis(loworder(V),Z))
187 187
        count_ones(Q)+order(v)>diffmode(V) && (return zero(V))
188 188
    end
@@ -562,7 +562,7 @@
Loading
562 562
        end; else quote
563 563
            $(insert_expr((:N,:t),VEC)...)
564 564
            out = value(b,$VEC(N,G,t))
565 -
            addblade!(out,$left(value(a,t)),bits(basis(a)),Val{N}())
565 +
            addblade!(out,$left(value(a,t)),UInt(basis(a)),Val{N}())
566 566
            return Chain{V,G}(out)
567 567
        end end end
568 568
    end
@@ -594,12 +594,12 @@
Loading
594 594
        else return if !swap; quote
595 595
            $(insert_expr((:N,:t,:out,:r,:bng),VEC)...)
596 596
            @inbounds out[r+1:r+bng] = $(bcast(right,:(value(b,$VEC(N,G,t)),)))
597 -
            addmulti!(out,value(a,t),bits(basis(a)),Val(N))
597 +
            addmulti!(out,value(a,t),UInt(basis(a)),Val(N))
598 598
            return MultiVector{V}(out)
599 599
        end; else quote
600 600
            $(insert_expr((:N,:t,:out,:r,:bng),VEC)...)
601 601
            @inbounds out[r+1:r+bng] = value(a,$VEC(N,G,t))
602 -
            addmulti!(out,$left(value(b,t)),bits(basis(b)),Val(N))
602 +
            addmulti!(out,$left(value(b,t)),UInt(basis(b)),Val(N))
603 603
            return MultiVector{V}(out)
604 604
        end end end
605 605
    end
@@ -623,12 +623,12 @@
Loading
623 623
        else return if !swap; quote
624 624
            $(insert_expr((:N,:t),VEC)...)
625 625
            out = convert($VEC(N,t),$(bcast(right,:(value(b,$VEC(N,t)),))))
626 -
            addmulti!(out,value(a,t),bits(basis(a)),Val(N))
626 +
            addmulti!(out,value(a,t),UInt(basis(a)),Val(N))
627 627
            return MultiVector{V}(out)
628 628
        end; else quote
629 629
            $(insert_expr((:N,:t),VEC)...)
630 630
            out = value(a,$VEC(N,t))
631 -
            addmulti!(out,$left(value(b,t)),bits(basis(b)),Val(N))
631 +
            addmulti!(out,$left(value(b,t)),UInt(basis(b)),Val(N))
632 632
            return MultiVector{V}(out)
633 633
        end end end
634 634
    end

@@ -48,7 +48,7 @@
Loading
48 48
            while typeof(prev[1]) <: TensorTerm
49 49
                basi = basis(prev[1])
50 50
                #base *= basi
51 -
                inds = Leibniz.indexsplit(bits(basi),mdims(V))
51 +
                inds = Leibniz.indexsplit(UInt(basi),mdims(V))
52 52
                prev = (value(prev[1]),prev[2])
53 53
                for k ∈ inds
54 54
                    prev = derive(prev[2],getbasis(V,k),prev[1],true)
@@ -105,7 +105,7 @@
Loading
105 105
        while typeof(prev[1]) <: TensorTerm
106 106
            basi = basis(prev[1])
107 107
            #base *= basi
108 -
            inds = Leibniz.indexsplit(bits(basi),mdims(V))
108 +
            inds = Leibniz.indexsplit(UInt(basi),mdims(V))
109 109
            prev = (value(prev[1]),prev[2])
110 110
            for k ∈ inds
111 111
                prev = derive(prev[2],getbasis(V,k),prev[1],true)
@@ -173,7 +173,7 @@
Loading
173 173
            for j ∈ (:join,:geom)
174 174
                for S ∈ (s,spre)
175 175
                    @eval @inline function $(Symbol(j,S))(m::$M,v::S,A::SubManifold{V},B::SubManifold{V}) where {V,T<:$F,S<:$F,M}
176 -
                        $(Symbol(j,S))(V,m,bits(A),bits(B),v)
176 +
                        $(Symbol(j,S))(V,m,UInt(A),UInt(B),v)
177 177
                    end
178 178
                end
179 179
            end
@@ -238,7 +238,7 @@
Loading
238 238
            for (prod,uct) ∈ ((:meet,:regressive),(:skew,:interior))
239 239
                for S ∈ (s,spre)
240 240
                    @eval @inline function $(Symbol(prod,S))(m::$M,A::SubManifold{V},B::SubManifold{V},v::T) where {V,T,M}
241 -
                        $(Symbol(prod,S))(V,m,bits(A),bits(B),v)
241 +
                        $(Symbol(prod,S))(V,m,UInt(A),UInt(B),v)
242 242
                    end
243 243
                end
244 244
                @eval begin
@@ -418,14 +418,16 @@
Loading
418 418
        *(a::SubManifold{V},b::F) where {F<:$EF,V} = Simplex{V}(b,a)
419 419
        adjoint(b::Simplex{V,G,B,T}) where {V,G,B,T<:$Field} = Simplex{dual(V),G,B',$TF}($CONJ(value(b)))
420 420
        Base.promote_rule(::Type{Simplex{V,G,B,T}},::Type{S}) where {V,G,T,B,S<:$Field} = Simplex{V,G,B,promote_type(T,S)}
421 -
        Base.promote_rule(::Type{Chain{V,G,T,B}},::Type{S}) where {V,G,T,B,S<:$Field} = Chain{V,G,promote_type(T,S),B}
422 421
        Base.promote_rule(::Type{MultiVector{V,T,B}},::Type{S}) where {V,T,B,S<:$Field} = MultiVector{V,promote_type(T,S),B}
423 422
    end
423 +
    Field βˆ‰ Fields && Fieldβ‰ Any && @eval begin
424 +
        Base.promote_rule(::Type{Chain{V,G,T,B}},::Type{S}) where {V,G,T,B,S<:$Field} = Chain{V,G,promote_type(T,S),B}
425 +
    end
424 426
    @eval begin
425 427
        Base.:-(a::Simplex{V,G,B,T}) where {V,G,B,T<:$Field} = Simplex{V,G,B,$TF}($SUB(value(a)))
426 428
        function *(a::Simplex{V,G,A,T} where {G,A},b::Simplex{V,L,B,S} where {L,B}) where {V,T<:$Field,S<:$Field}
427 429
            ba,bb = basis(a),basis(b)
428 -
            v = derive_mul(V,bits(ba),bits(bb),a.v,b.v,$MUL)
430 +
            v = derive_mul(V,UInt(ba),UInt(bb),a.v,b.v,$MUL)
429 431
            Simplex(v,mul(ba,bb,v))
430 432
        end
431 433
        ∧(a::$Field,b::$Field) = $MUL(a,b)

@@ -15,10 +15,10 @@
Loading
15 15
import Base: print, show, getindex, setindex!, promote_rule, convert, adjoint
16 16
import DirectSum: V0, βŠ•, generate, basis, getalgebra, getbasis, dual
17 17
import Leibniz: hasinf, hasorigin, dyadmode, value, pre, vsn, metric, mdims
18 -
import Leibniz: Bits, bit2int, indexbits, indices, diffvars, diffmask
18 +
import Leibniz: bit2int, indexbits, indices, diffvars, diffmask
19 19
import Leibniz: symmetricmask, indexstring, indexsymbol, combo, digits_fast
20 20
21 -
import Leibniz: hasconformal, hasinf2origin, hasorigin2inf, g_zero, g_one, bits
21 +
import Leibniz: hasconformal, hasinf2origin, hasorigin2inf, g_zero, g_one
22 22
import AbstractTensors: valuetype, scalar, isscalar, βŠ—
23 23
import AbstractTensors: vector, isvector, bivector, isbivector, volume, isvolume
24 24
@@ -183,7 +183,7 @@
Loading
183 183
collapse(a,b) = aβ‹…absym(βˆ‚(b))
184 184
185 185
function chain(t::S,::Val{T}=Val{true}()) where S<:TensorTerm{V} where {V,T}
186 -
    N,B,v = mdims(V),bits(basis(t)),value(t)
186 +
    N,B,v = mdims(V),UInt(basis(t)),value(t)
187 187
    C = symmetricmask(V,B,B)[1]
188 188
    G = count_ones(C)
189 189
    G < 2 && (return t)
@@ -202,7 +202,7 @@
Loading
202 202
𝒫(t::T) where T<:TensorAlgebra = Ξ”(t,Val{false}())
203 203
subcomplex(x::S,v=Val{true}()) where S<:TensorAlgebra = Ξ”(absym(βˆ‚(x)),v)
204 204
function skeleton(x::S,v::Val{T}=Val{true}()) where S<:TensorTerm{V} where {V,T}
205 -
    B = bits(basis(x))
205 +
    B = UInt(basis(x))
206 206
    count_ones(symmetricmask(V,B,B)[1])>0 ? absym(x)+skeleton(absym(βˆ‚(x)),v) : (T ? g_zero(V) : absym(x))
207 207
end
208 208
function skeleton(x::Chain{V},v::Val{T}=Val{true}()) where {V,T}
@@ -406,7 +406,7 @@
Loading
406 406
end
407 407
generate_products(SymField,:svec,:($Sym.:∏),:($Sym.:βˆ‘),:($Sym.:-),:($Sym.conj))
408 408
function generate_derivation(m,t,d,c)
409 -
    @eval derive(n::$(:($m.$t)),b) = $m.$d(n,$m.$c(indexsymbol(Manifold(b),bits(b))))
409 +
    @eval derive(n::$(:($m.$t)),b) = $m.$d(n,$m.$c(indexsymbol(Manifold(b),UInt(b))))
410 410
end
411 411
function generate_algebra(m,t,d=nothing,c=nothing)
412 412
    generate_products(:($m.$t),:svec,:($m.:*),:($m.:+),:($m.:-),:($m.conj),true)
@@ -498,12 +498,12 @@
Loading
498 498
            return g
499 499
        end
500 500
    end
501 -
    #@require GraphPlot="a2cc645c-3eea-5389-862e-a155d0052231"
501 +
    #=@require GraphPlot="a2cc645c-3eea-5389-862e-a155d0052231"
502 502
    @require Compose="a81c6b42-2e10-5240-aca2-a61377ecd94b" begin
503 503
        import LightGraphs, GraphPlot, Cairo
504 504
        viewer = Base.Process(`$(haskey(ENV,"VIEWER") ? ENV["VIEWER"] : "xdg-open") simplex.pdf`,Ptr{Nothing}())
505 505
        function Compose.draw(img,x::T,l=layout=GraphPlot.circular_layout) where T<:TensorAlgebra
506 -
            Compose.draw(img,GraphPlot.gplot(LightGraphs.SimpleDiGraph(x),layout=l,nodelabel=collect(1:rank(Manifold(x)))))
506 +
            Compose.draw(img,GraphPlot.gplot(LightGraphs.SimpleDiGraph(x),layout=l,nodelabel=collect(1:mdims(Manifold(x)))))
507 507
        end
508 508
        function graph(x,n="simplex.pdf",l=GraphPlot.circular_layout)
509 509
            cmd = `$(haskey(ENV,"VIEWER") ? ENV["VIEWER"] : "xdg-open") $n`
@@ -512,7 +512,7 @@
Loading
512 512
            Compose.draw(Compose.PDF(n,16Compose.cm,16Compose.cm),x,l)
513 513
            viewer = run(cmd,(devnull,stdout,stderr),wait=false)
514 514
        end
515 -
    end
515 +
    end=#
516 516
    @require StaticArrays="90137ffa-7385-5640-81b9-e52037218182" begin
517 517
        StaticArrays.SMatrix(m::Chain{V,1,<:Chain{W,1}}) where {V,W} = StaticArrays.SMatrix{mdims(W),mdims(V)}(vcat(value.(value(m))...))
518 518
        DyadicChain(m::StaticArrays.SMatrix{N,N}) where N = Chain{SubManifold(N),1}(m)
@@ -520,8 +520,8 @@
Loading
520 520
        Chain{V,1,Chain{W,1}}(m::StaticArrays.SMatrix{M,N}) where {V,W,M,N} = Chain{V,1}(Chain{W,1}.(getindex.(Ref(m),:,StaticArrays.SVector{N}(1:N))))
521 521
        Base.exp(A::Chain{V,1,<:Chain{V,1}}) where V = Chain{V,1}(exp(StaticArrays.SMatrix(A)))
522 522
        Base.log(A::Chain{V,1,<:Chain{V,1}}) where V = Chain{V,1}(log(StaticArrays.SMatrix(A)))
523 -
        LinearAlgebra.eigvals(A::Chain{V,1,<:Chain{V,1}}) where V = Chain(Values{mdims(V)}(eigvals(StaticArrays.SMatrix(A))))
524 -
        LinearAlgebra.eigvecs(A::Chain{V,1,<:Chain{V,1}}) where V = Chain(Chain.(Values{mdims(A)}.(getindex.(Ref(eigvecs(StaticArrays.SMatrix(A))),:,list(1,mdims(A))))))
523 +
        LinearAlgebra.eigvals(A::Chain{V,1,<:Chain{V,1}}) where V = Chain(Values{mdims(V)}(LinearAlgebra.eigvals(StaticArrays.SMatrix(A))))
524 +
        LinearAlgebra.eigvecs(A::Chain{V,1,<:Chain{V,1}}) where V = Chain(Chain.(Values{mdims(A)}.(getindex.(Ref(LinearAlgebra.eigvecs(StaticArrays.SMatrix(A))),:,list(1,mdims(A))))))
525 525
        function LinearAlgebra.eigen(A::Chain{V,1,<:Chain{V,1}}) where V
526 526
            E,N = eigen(StaticArrays.SMatrix(A)),mdims(V)
527 527
            e = Chain(Chain.(Values{N}.(getindex.(Ref(E.vectors),:,list(1,N)))))

@@ -22,7 +22,7 @@
Loading
22 22
        if Q == V
23 23
            if isdyadic(V)
24 24
                if G == M == 1
25 -
                    x = bits(W)
25 +
                    x = UInt(W)
26 26
                    X = isdyadic(V) ? x>>Int(mdims(V)/2) : x
27 27
                    Y = 0β‰ X ? X : x
28 28
                    out = :(@inbounds b.v[bladeindex($(mdims(V)),Y)])
@@ -43,11 +43,11 @@
Loading
43 43
        return V===W ? :b : :(Chain{w,G,T}(value(b)))
44 44
    elseif WβŠ†V
45 45
        if G == 1
46 -
            ind = Values{mdims(W),Int}(indices(bits(W),mdims(V)))
46 +
            ind = Values{mdims(W),Int}(indices(UInt(W),mdims(V)))
47 47
            :(@inbounds Chain{w,1,T}(b.v[$ind]))
48 48
        else quote
49 49
            out,N = zeros(choicevec(M,G,valuetype(b))),mdims(V)
50 -
            ib,S = indexbasis(N,G),bits(w)
50 +
            ib,S = indexbasis(N,G),UInt(w)
51 51
            for k ∈ 1:length(ib)
52 52
                @inbounds if b[k] β‰  0
53 53
                    @inbounds if count_ones(ib[k]&S) == G
@@ -66,7 +66,7 @@
Loading
66 66
            ib = indexbasis(N,G)
67 67
            for k ∈ 1:length(ib)
68 68
                @inbounds if b[k] β‰  0
69 -
                    @inbounds B = typeof(V)<:SubManifold ? expandbits(M,bits(V),ib[k]) : ib[k]
69 +
                    @inbounds B = typeof(V)<:SubManifold ? expandbits(M,UInt(V),ib[k]) : ib[k]
70 70
                    if WC && (!VC)
71 71
                        @inbounds setblade!(out,b[k],mixed(V,B),Val{M}())
72 72
                    elseif (!WC) && (!VC)
@@ -118,7 +118,7 @@
Loading
118 118
            for k ∈ 1:length(ib)
119 119
                @inbounds s = k+bs[i]
120 120
                @inbounds if m.v[s] β‰  0
121 -
                    @inbounds B = typeof(V)<:SubManifold ? expandbits(M,bits(V),ib[k]) : ib[k]
121 +
                    @inbounds B = typeof(V)<:SubManifold ? expandbits(M,UInt(V),ib[k]) : ib[k]
122 122
                    if WC && (!VC)
123 123
                        @inbounds setmulti!(out,m.v[s],mixed(V,B),Val{M}())
124 124
                    elseif (!WC) && (!VC)
@@ -222,7 +222,7 @@
Loading
222 222
223 223
function (a::Chain{V,1})(b::SubManifold{V,1}) where V
224 224
    (!isdyadic(V)) && (return contraction(a,b))
225 -
    x = bits(b)
225 +
    x = UInt(b)
226 226
    X = isdyadic(V) ? x<<Int(mdims(V)/2) : x
227 227
    Y = X>2^mdims(V) ? x : X
228 228
    @inbounds out = a.v[bladeindex(mdims(V),Y)]
@@ -232,7 +232,7 @@
Loading
232 232
    function (a::Chain{V,2,T})(b::SubManifold{V,1}) where {V,T}
233 233
        (!isdyadic(V)) && (return contraction(a,b))
234 234
        $(insert_expr((:N,:df,:di))...)
235 -
        Q = bladeindex(N,bits(b))
235 +
        Q = bladeindex(N,UInt(b))
236 236
        @inbounds m,val = df[Q][1],df[Q][2]*value(b)
237 237
        out = zero(mvec(N,1,T))
238 238
        for i ∈ 1:N
@@ -252,7 +252,7 @@
Loading
252 252
    function (a::Simplex{V,1})(b::Chain{V,1}) where V
253 253
        (!isdyadic(V)) && (return contraction(a,b))
254 254
        $(insert_expr((:t,))...)
255 -
        x = bits(a)
255 +
        x = UInt(a)
256 256
        X = isdyadic(V) ? x>>Int(mdims(V)/2) : x
257 257
        Y = 0β‰ X ? X : x
258 258
        @inbounds out = b.v[bladeindex(mdims(V),Y)]
@@ -267,7 +267,7 @@
Loading
267 267
    function (a::Chain{V,2})(b::Simplex{V,1}) where V
268 268
        (!isdyadic(V)) && (return contraction(a,b))
269 269
        $(insert_expr((:N,:t,:df,:di))...)
270 -
        Q = bladeindex(N,bits(b))
270 +
        Q = bladeindex(N,UInt(b))
271 271
        out = zero(mvec(N,1,T))
272 272
        @inbounds m,val = df[Q][1],df[Q][2]*b.v
273 273
        for i ∈ 1:N
Files Coverage
src 27.88%
Project Totals (7 files) 27.88%