diff --git a/REQUIRE b/REQUIRE index c069e29..fa89aa4 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,2 @@ -julia 0.6 +julia 0.7 Combinatorics -Compat 0.34 diff --git a/appveyor.yml b/appveyor.yml index f0f7d95..c541de9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,6 @@ environment: matrix: allow_failures: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" diff --git a/src/Dendriform.jl b/src/Dendriform.jl index dbb5cca..c91753f 100644 --- a/src/Dendriform.jl +++ b/src/Dendriform.jl @@ -4,7 +4,7 @@ module Dendriform # This file is part of Dendriform.jl. It is licensed under the GPL license # Dendriform Copyright (C) 2017 Michael Reed -using Combinatorics, Compat +using Combinatorics export PBTree, Grove, GroveBin, ==, Cn, grovesort, grovesort!, σ, print, grovecomposition, grovedisplay @@ -125,6 +125,7 @@ Grove(d::UI8I) = convert(Grove,d) Grove(d::UI8I,s::BitArray{1}) = TreeLoday(d,s) Grove(g::GroveBin) = convert(Grove,g) Grove(s::BitArray{1}) = Grove(CnInv(length(s)),s) +Grove(g::Grove) = g """ Grove(degree::Int, index::Integer) @@ -242,7 +243,7 @@ function GroveExtend!(Y::Array{Grove,1},R::Array{Array{Int,1},1},deg::UInt8) # initialize total grove Yn = Grove(Array{UInt8,2}(undef,Cn(n),n)) # loop over left-branch grove - n==1 ? (Yn.Y[τ,1] .= n) : (Yn.Y[τ:lYn,n] .= n) + n==1 ? (Yn.Y[τ,1] = n) : (Yn.Y[τ:lYn,n] .= n) for λ ∈ 1:lYn Yn.Y[τ,1:n-1] = Y[n].Y[λ,:] τ += 1 diff --git a/src/morphism.jl b/src/morphism.jl index e06cbcd..35673f1 100644 --- a/src/morphism.jl +++ b/src/morphism.jl @@ -108,7 +108,7 @@ grovebit(g::Union{Ar1UI8I,Ar2UI8I}) = grovebit(Grove(g)) grovebit(g::GroveBin) = grovebit(g.degr,g.gbin) function grovebit(d::UI8I,s::Integer) - gb = '1' .== reverse(collect(string(s,base=2)),dims=1) + gb = Ref('1') .== reverse(collect(string(s,base=2)),dims=1) return vcat(gb,falses(Cn(d)-length(gb))) end @@ -128,7 +128,7 @@ function groveindex(d::UI8I,l::Int,g::Ar2UI8I) s += BigInt(2)^(findfirst(v.==gt[c])-1) end catch - treecheck(g) ? throw(DomainError()) : s=BigInt(-1) + treecheck(g) ? throw(DomainError(g)) : s=BigInt(-1) end return s end @@ -193,7 +193,7 @@ TreeLoday(d::UI8I,s::Integer) = Grove(d,s) Returns BaseTree objects for any AbstractGrove """ -TreeBase(d::UI8I,s::Integer) = TreeBase(d,grovebit(findall(s))) +TreeBase(d::UI8I,s::Integer) = TreeBase(d,grovebit(findall(x->x!=0,s))) function TreeBase(d::UI8I,ind::BitArray) # from treeindex y = Υ(d).Y @@ -317,7 +317,7 @@ function TreeRational(d::UI8I,indb::BitArray) # from treeindex end TreeRational(μ::BaseTree) = (s=treeshift(); s+((-1)^s)*ΘInt(μ.μ)//ΘMax(length(μ.μ))) -TreeRational(deg::UI8I,Θ::Array{Int,1}) = (s=treeshift(); 1-s-((-1)^s)*Θ.//ΘMax(deg)) +TreeRational(deg::UI8I,Θ::Array{Int,1}) = (s=treeshift(); 1-s.-((-1)^s)*Θ.//ΘMax(deg)) function TreeRational(Y::Array{BaseTree,1}) γ = length(Y) diff --git a/src/poset.jl b/src/poset.jl index 27b0d97..5e44777 100644 --- a/src/poset.jl +++ b/src/poset.jl @@ -226,7 +226,7 @@ function intcomp(d::Int) for i ∈ 1:Int(groveindex(Grove(q))), j ∈ 1:Int(groveindex(Grove(d-q))) z = GroveBin(Grove(q,i) + Grove(d-q,j)) f = findall(s->s==z.gbin, ins) - length(f) == 0 ? (cn += 1) : (cc[f] += 1) + length(f) == 0 ? (cn += 1) : (cc[f] .+= 1) end end @info "Non-intervals: $cn" @@ -242,7 +242,7 @@ function intcompt(d::Int) for i ∈ 1:Int(Cn(q)), j ∈ 1:Int(Cn(d-q)) z = GroveBin(PBTree(q,i) + PBTree(d-q,j)) f = findall(s->s==z.gbin, ins) - length(f) == 0 ? (cn += 1) : (cc[f] += 1) + length(f) == 0 ? (cn += 1) : (cc[f] .+= 1) end end #@info "Non-intervals: $cn" diff --git a/test/runtests.jl b/test/runtests.jl index 07834f4..ea5bfb4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,4 @@ -using Dendriform -using Test +using Dendriform, Test import Dendriform: GroveError, TreeInteger, TreeRational, TreeBase, TreeLoday d = 5 @@ -22,7 +21,7 @@ d = 5 @test Grove(d) |> grovesort! == Grove(d) == Grove(d,2^Cn(d)-1) @test Grove(d) == d |> TreeBase |> TreeLoday @test (k = Grove(d) |> TreeBase |> TreeLoday; k == k |> TreeBase |> TreeLoday) -@test TreeLoday(0,Array{Int,1}(0)) == Grove(0) +@test TreeLoday(0,Array{Int,1}(undef,0)) == Grove(0) @test [TreeBase([1:d...])] == TreeBase(d,1) @test Grove(d) |> TreeBase |> TreeInteger == Grove(d) |> TreeInteger @test (grovesort(false); TreeLoday(d,treeindex(Grove(d))) == Grove(d))