diff --git a/Project.toml b/Project.toml index c23ccef5..0ab3e063 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Polymake" uuid = "d720cf60-89b5-51f5-aff5-213f193123e7" repo = "https://github.com/oscar-system/Polymake.jl.git" -version = "0.9.2" +version = "0.10.0" [deps] BinaryWrappers = "f01c122e-0ea1-4f85-ad8f-907073ad7a9f" @@ -32,5 +32,5 @@ Scratch = "^1.1" TOPCOM_jll = "~0.17.8" julia = "^1.6" lib4ti2_jll = "^1.6.10" -libpolymake_julia_jll = "~0.9.0" +libpolymake_julia_jll = "~0.10.0" polymake_jll = "^400.900.0" diff --git a/src/Polymake.jl b/src/Polymake.jl index c83866ad..01fc79cc 100644 --- a/src/Polymake.jl +++ b/src/Polymake.jl @@ -37,7 +37,7 @@ import TOPCOM_jll using libpolymake_julia_jll -const jlpolymake_version_range = (v"0.9.0", v"0.10") +const jlpolymake_version_range = (v"0.10.0", v"0.11") struct PolymakeError <: Exception msg @@ -81,7 +81,7 @@ include("ijulia.jl") @wrapmodule(joinpath(libpolymake_julia), :define_module_polymake) -include(polymake_jll.generate_deps_tree) +include(libpolymake_julia_jll.generate_deps_tree) include(type_translator) @@ -93,7 +93,7 @@ function __init__() @generate_wrappers(Ninja_jll), @generate_wrappers(Perl_jll), ] - polymake_deps_tree = @get_scratch!("$(scratch_key)_depstree") + polymake_deps_tree = @get_scratch!("$(scratch_key)_depstree_v2") # we run this on every init to make sure all artifacts still exist prepare_deps_tree(polymake_deps_tree) diff --git a/src/convert.jl b/src/convert.jl index 4b4a2838..07e7f3f7 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -97,6 +97,7 @@ NodeMap{Dir, T}(g::Graph{Dir}) where Dir<:DirType where T<:Set{<:Union{Int64, Cx convert_to_pm_type(::Type{HomologyGroup{T}}) where T<:Integer = HomologyGroup{T} convert_to_pm_type(::Type{<:QuadraticExtension{T}}) where T<:Rational = QuadraticExtension{Rational} +convert_to_pm_type(::Type{<:TropicalNumber{S,T}}) where S<:Union{Max,Min} where T<:Rational = TropicalNumber{S,Rational} # convert_to_pm_type(::Type{<:Union{AbstractSet, Set}}) = Set # specific converts for container types we wrap: @@ -106,7 +107,9 @@ convert_to_pm_type(::Type{<:Base.AbstractSet{<:Base.Integer}}) = Set{Int64} for (pmT, jlT) in [(Integer, Base.Integer), (Int64, Union{Int32,Int64,CxxWrap.CxxLong}), (Rational, Union{Base.Rational, Rational}), - (QuadraticExtension{Polymake.Rational}, QuadraticExtension{Polymake.Rational})] + (TropicalNumber{Max, Rational}, TropicalNumber{Max, Rational}), + (TropicalNumber{Min, Rational}, TropicalNumber{Min, Rational}), + (QuadraticExtension{Rational}, QuadraticExtension{Rational})] @eval begin convert_to_pm_type(::Type{<:AbstractMatrix{T}}) where T<:$jlT = Matrix{to_cxx_type($pmT)} convert_to_pm_type(::Type{<:AbstractVector{T}}) where T<:$jlT = Vector{to_cxx_type($pmT)} diff --git a/src/sets.jl b/src/sets.jl index 5f7dd4fa..0eef2065 100644 --- a/src/sets.jl +++ b/src/sets.jl @@ -74,8 +74,6 @@ end Base.allunique(::Set) = true -# delete! : Defined on the C++ side -Base.delete!(s::Set{T}, x) where T = delete!(s, T(x)) # empty! : Defined on the C++ side Base.empty(s::Set{T}, ::Type{U}=T) where {T, U} = Set{to_cxx_type(U)}() # @@ -90,10 +88,6 @@ function Base.filter!(pred, s::Set{T}) where T return s end -# in : Defined on the C++ side -Base.in(x::Base.Integer, s::Set{T}) where T = in(T(x), s) - -# # # isempty : Defined on the C++ function Base.iterate(S::Set) @@ -125,8 +119,6 @@ function Base.pop!(s::Set{T}) where T return pop!(s, first(s)) end -# push! : Defined on the C++ side -Base.push!(s::Set{T}, x::Base.Integer) where T = push!(s, T(x)) # show : Defined on the C++ side Base.sizehint!(s::Set, newsz) = s diff --git a/src/setup_types.jl b/src/setup_types.jl index 076b3fac..04121279 100644 --- a/src/setup_types.jl +++ b/src/setup_types.jl @@ -19,7 +19,7 @@ const SmallObject = Union{ EdgeMap, NodeMap, } -const VecOrMat_eltypes = Union{Int64, Integer, Rational, Float64, QuadraticExtension{Rational}, CxxWrap.CxxLong, Polynomial{Rational, CxxWrap.CxxLong}} +const VecOrMat_eltypes = Union{Int64, Integer, Rational, Float64, QuadraticExtension{Rational}, CxxWrap.CxxLong, Polynomial{Rational, CxxWrap.CxxLong}, TropicalNumber{Polymake.Max, Polymake.Rational}, TropicalNumber{Polymake.Min, Polymake.Rational}} const TypeConversionFunctions = Dict( Symbol("Int") => to_int, diff --git a/test/arrays.jl b/test/arrays.jl index f5028150..b8a68bd3 100644 --- a/test/arrays.jl +++ b/test/arrays.jl @@ -112,15 +112,15 @@ @test A == Polymake.Array{T}(2l+2, elt) end - @testset "Polymake.Array{Polymake.Array{Polymake.Set{Int64}}}" begin + @testset "Polymake.Array{Polymake.Set{Polymake.Set{Int64}}}" begin c = Polymake.polytope.cube(2, 1, 0) PC = Polymake.polytope.PointConfiguration(POINTS=c.VERTICES) all = Polymake.polytope.topcom_all_triangulations(PC) - @test all isa Polymake.Array{Polymake.Array{Polymake.Set{Polymake.to_cxx_type(Int64)}}} + @test all isa Polymake.Array{Polymake.Set{Polymake.Set{Polymake.to_cxx_type(Int64)}}} @test length(all) == 2 @test size(all) == (2,) for triang in all - @test triang isa Polymake.Array{Polymake.Set{Polymake.to_cxx_type(Int64)}} + @test triang isa Polymake.Set{Polymake.Set{Polymake.to_cxx_type(Int64)}} end end diff --git a/test/tropicalnumber.jl b/test/tropicalnumber.jl index 9d163072..b31ae94e 100644 --- a/test/tropicalnumber.jl +++ b/test/tropicalnumber.jl @@ -156,4 +156,33 @@ end end end + + @testset "Containers" begin + for VType in [Polymake.Vector, Polymake.Array] + for A in AdditionTypes + v = VType{Polymake.TropicalNumber{A, Polymake.Rational}}(5) + @test v isa VType{Polymake.TropicalNumber{A, Polymake.Rational}} + # If this at some point might work, we want to get notified: + @test_broken v isa VType{Polymake.TropicalNumber{A}} + @test length(v) == 5 + @test v+v == v + for e in v + @test iszero(e) + end + end + end + for MType in [Polymake.Matrix, Polymake.SparseMatrix] + for A in AdditionTypes + v = MType{Polymake.TropicalNumber{A, Polymake.Rational}}(5,5) + @test v isa MType{Polymake.TropicalNumber{A, Polymake.Rational}} + # If this at some point might work, we want to get notified: + @test_broken v isa MType{Polymake.TropicalNumber{A}} + @test size(v) == (5,5) + @test v+v == v + for e in v + @test iszero(e) + end + end + end + end end