diff --git a/.travis.yml b/.travis.yml index 55f7934..c30b393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ os: - linux - osx julia: - - 0.7 - 1.0 - 1.1 - nightly diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..eae5218 --- /dev/null +++ b/Project.toml @@ -0,0 +1,24 @@ +name = "Grassmann" +uuid = "4df31cd9-4c27-5bea-88d0-e6a7146666d8" +authors = ["Michael Reed"] +version = "0.1.1" + +[deps] +AbstractLattices = "398f06c4-4d28-53ec-89ca-5b2656b7603d" +AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea" +Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" +ComputedFieldTypes = "459fdd68-db75-56b8-8c15-d717a790f88e" +DirectSum = "22fd7b30-a8c0-5bf2-aabe-97783860d07c" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Reduce = "93e0c654-6965-5f22-aba9-9c1ae6b3c259" +Requires = "ae029012-a4dd-5104-9daa-d747884805df" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + +[compat] +DirectSum = "0.2" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 0107f07..0000000 --- a/REQUIRE +++ /dev/null @@ -1,9 +0,0 @@ -julia 0.7 -Combinatorics -StaticArrays -ComputedFieldTypes -Requires -DirectSum 0.2 -AbstractTensors -AbstractLattices -Reduce diff --git a/appveyor.yml b/appveyor.yml index 6b45913..cd1997d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,5 @@ environment: matrix: - - julia_version: 0.7 - julia_version: 1 - julia_version: 1.1 - julia_version: nightly diff --git a/src/algebra.jl b/src/algebra.jl index 109e5a3..9868ca2 100644 --- a/src/algebra.jl +++ b/src/algebra.jl @@ -235,14 +235,15 @@ function dot(a::X,b::Y) where {X<:TensorTerm{V},Y<:TensorTerm{V}} where V end @pure function interior_calc(V::Signature{N,M,S},A,B) where {N,M,S} + hasinf(M) && isodd(A) && isodd(B) && (return false,zero(Bits),false) γ = complement(N,B) - p,C,t = regressive(A,γ,V) + p,C,t = regressive_calc(V,A,γ,true) return t ? p⊻parityright(S,B) : p, C, t end @pure function interior_calc(V::DiagonalForm{N,M,S},A,B) where {N,M,S} γ = complement(N,B) - p,C,t = regressive(A,γ,Signature(V)) + p,C,t = regressive_calc(Signature(V),A,γ,true) ind = indices(B) g = prod(V[ind]) return t ? (p⊻parityright(0,sum(ind),count_ones(B)) ? -(g) : g) : g, C, t @@ -268,13 +269,14 @@ end @inline ∨(a::TensorAlgebra{V},b::UniformScaling{T}) where {V,T<:Field} = a∨V(b) @inline ∨(a::UniformScaling{T},b::TensorAlgebra{V}) where {V,T<:Field} = V(a)∨b -@pure function regressive_calc(::Signature{N,M,S},A,B) where {N,M,S} +@pure function regressive_calc(::Signature{N,M,S},A,B,opt=false) where {N,M,S} α,β = complement(N,A),complement(N,B) - if (count_ones(α&β)==0) && !(hasinf(M) && isodd(α) && isodd(β)) + if (count_ones(α&β)==0 ? true : A+B==0) && !(hasinf(M) && isodd(α) && isodd(β) && (A+B≠0)) C = α ⊻ β L = count_ones(A)+count_ones(B) pa,pb,pc = parityright(S,A),parityright(S,B),parityright(S,C) - return isodd(L*(L-N))⊻pa⊻pb⊻parity(N,S,α,β)⊻pc, complement(N,C), true + bas = opt ? complement(N,C) : A+B≠0 ? complement(N,C) : zero(Bits) + return isodd(L*(L-N))⊻pa⊻pb⊻parity(N,S,α,β)⊻pc, bas, true else return false, zero(Bits), false end @@ -315,7 +317,7 @@ end end end -@pure function crodprod_calc(V::DiagonalForm{N,M,S}) where {N,M,S} +@pure function crossprod_calc(V::DiagonalForm{N,M,S}) where {N,M,S} if (count_ones(A&B)==0) && !(hasinf(M) && isodd(A) && isodd(B)) C = A ⊻ B g = parityright(V,C) @@ -632,7 +634,7 @@ function generate_product_algebra(Field=Field,MUL=:*,ADD=:+,SUB=:-,VEC=:mvec,CON for k ∈ 1:binomial(N,G) @inbounds val = b.v[k] if val≠0 - v = typeof(V)<:Signature ? ($p(V,ib[k]) ? $SUB(val) : val) : $p(V,ib[k]) + v = typeof(V)<:Signature ? ($p(V,ib[k]) ? $SUB(val) : val) : $p(V,ib[k])*val @inbounds setblade!(out,v,complement(N,ib[k]),Dimension{N}()) end end @@ -649,7 +651,7 @@ function generate_product_algebra(Field=Field,MUL=:*,ADD=:+,SUB=:-,VEC=:mvec,CON @inbounds for i ∈ 1:bn[g] @inbounds val = m.v[bs[g]+i] if val≠0 - v = typeof(V)<:Signature ? ($p(V,ib[i]) ? $SUB(val) : val) : $p(V,ib[i]) + v = typeof(V)<:Signature ? ($p(V,ib[i]) ? $SUB(val) : val) : $p(V,ib[i])*val @inbounds setmulti!(out,v,complement(N,ib[i]),Dimension{N}()) end end @@ -733,7 +735,7 @@ function generate_product_algebra(Field=Field,MUL=:*,ADD=:+,SUB=:-,VEC=:mvec,CON for g ∈ 1:N+1 ib = indexbasis(N,g-1) @inbounds for i ∈ 1:bn[g] - @inbounds $product!(V,out,bits(basis(s)),ib[i],$MUL(a.v,b.v[bs[g]+i])) + @inbounds $product!(V,out,bits(basis(a)),ib[i],$MUL(a.v,b.v[bs[g]+i])) end end return MultiVector{t,V,2^N}(out) diff --git a/src/generators.jl b/src/generators.jl index 6ffbb2c..28a223c 100644 --- a/src/generators.jl +++ b/src/generators.jl @@ -39,7 +39,7 @@ else print(io,C>0 ? string(dual) : lab) for j ∈ shift_indices(V,sk) - print(io,j≠0 ? (j>0 ? (j>9 ? (C>0 ? sups[j] : subs[j]) : j) : 'ϵ') : 'o') + print(io,j≠0 ? (j>0 ? (j>9 ? (C>0 ? sups[j] : subs[j]) : j) : vio[1]) : vio[2]) end end icr += 1 diff --git a/src/utilities.jl b/src/utilities.jl index 84edbb9..0f2875a 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -4,7 +4,7 @@ import Base: @pure, print, show, getindex, setindex!, promote_rule, ==, convert, ndims import DirectSum: Bits, bit2int, doc2m, indexbits, indices -import DirectSum: pre, alphanumv, alphanumw, vsn, subs, sups +import DirectSum: pre, alphanumv, alphanumw, vsn, vio, subs, sups @pure binomial_set(N) = SVector(Int[binomial(N,g) for g ∈ 0:N]...) @pure binomial(N,G) = Base.binomial(N,G)