Skip to content

Commit

Permalink
improved test compatibility with Julia v0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Feb 24, 2019
1 parent 81bf6da commit f4e4f78
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/Grassmann.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Base.firstindex(a::T) where T<:SubAlgebra = 1
Base.lastindex(a::T) where T<:SubAlgebra{V} where V = 1<<ndims(V)
Base.length(a::T) where T<:SubAlgebra{V} where V = 1<<ndims(V)

==(::SubAlgebra{V},::SubAlgebra{W}) where {V,W} = V == W

(::SubAlgebra{V},::SubAlgebra{W}) where {V,W} = getalgebra(VW)
+(::SubAlgebra{V},::SubAlgebra{W}) where {V,W} = getalgebra(VW)

Expand Down
14 changes: 7 additions & 7 deletions src/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ end

### parity cache 2

for (parity,T) ((:interior,Tuple{Bool,Bits,Bool}),(:regressive,Tuple{Bool,Bits,Bool}))
extra = Symbol(parity,:_extra)
cache = Symbol(parity,:_cache)
calc = Symbol(parity,:_calc)
for (par,T) ((:interior,Tuple{Bool,Bits,Bool}),(:regressive,Tuple{Bool,Bits,Bool}))
extra = Symbol(par,:_extra)
cache = Symbol(par,:_cache)
calc = Symbol(par,:_calc)
@eval begin
const $cache = Vector{Dict{Bits,Vector{Vector{$T}}}}[]
const $extra = Vector{Dict{Bits,Dict{Bits,Dict{Bits,$T}}}}[]
@pure function $parity(n,m,s,a,b)::$T
@pure function $par(n,m,s,a,b)::$T
m1 = m+1
if n > sparse_limit
N = n-sparse_limit
Expand Down Expand Up @@ -345,8 +345,8 @@ for (parity,T) ∈ ((:interior,Tuple{Bool,Bits,Bool}),(:regressive,Tuple{Bool,Bi
@inbounds $cache[n][m1][s][a1][b+1]
end
end
@pure $parity(a::Bits,b::Bits,v::VectorSpace) = $parity(ndims(v),DirectSum.options(v),value(v),a,b)
@pure $parity(a::Basis{V,G,B},b::Basis{V,L,C}) where {V,G,B,L,C} = $parity(ndims(V),DirectSum.options(V),value(V),bits(a),bits(b))
@pure $par(a::Bits,b::Bits,v::VectorSpace) = $par(ndims(v),DirectSum.options(v),value(v),a,b)
@pure $par(a::Basis{V,G,B},b::Basis{V,L,C}) where {V,G,B,L,C} = $par(ndims(V),DirectSum.options(V),value(V),bits(a),bits(b))
end
end

Expand Down
7 changes: 5 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ using Test
# write your own tests here
@test (@basis "++++" s e; e124 * e23 == e134)
@test [Λ(3).v32^2,Λ(3).v13^2,Λ(3).v21^2] == [-1Λ(3).v for j1:3]
@test ((Λ(2).v1+2Λ(2).v2)(3Λ(2).w1+4Λ(2).w2))(Λ(2).v1+Λ(2).v2) == 7Λ(2).v1+14Λ(2).v2+0Λ(2).w1
@test ((Λ(2).v1+2Λ(2).v2)(3Λ(2).w1+4Λ(2).w2))(Λ(2).v1+Λ(2).v2) == 7Λ(2).v1+14Λ(2).v2
@test (@basis "++++"; ((v1*v1,v1v1,v1v1) == (1,1,0)) && ((v2*v2,v2v2,v2v2) == (1,1,0)))
@test (@basis "-+++"; ((v1*v1,v1v1,v1v1)==(-1,-1,0)) && ((v2*v2,v2v2,v2v2) == (1,1,0)))
@test (basis"-+++"; h = 1v1+2v2; hh == 3v)
@test Algebra.:+((:a*Λ(2).v1 + :b*Λ(2).v2) (:c*Λ(2).v1 + :d*Λ(2).v2),Λ(2).v) == Λ(2).v+:(a*d-b*c)*Λ(2).v12
!Sys.iswindows() && @test Λ(62).v32a87Ng == -1Λ(62).v2378agN
@test Λ.V3 == Λ.C3'
@test Λ(14) + Λ(14)' == Λ(VectorSpace(14)+VectorSpace(14)')
@test ((a,b) = ((:a*Λ(2).v1 + :b*Λ(2).v2),(:c*Λ(2).v1 + :d*Λ(2).v2)); Algebra.:+(ab,ab)==a*b)

0 comments on commit f4e4f78

Please sign in to comment.