From d2d455a48e702180e3b92e0931f762716b481f72 Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Mon, 12 Jun 2023 17:26:58 +0200 Subject: [PATCH 1/9] Add support for tropical number in containers --- src/setup_types.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 2cc944f6da1abd48a1b7d76b7bc1b4db288b0bc8 Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Tue, 13 Jun 2023 15:56:57 +0200 Subject: [PATCH 2/9] Add tests for TropicalNumber in containers --- test/tropicalnumber.jl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 From 4c8d6a57f3db87bf98a3a419696aaa7f8a647b33 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Tue, 20 Jun 2023 09:50:02 +0200 Subject: [PATCH 3/9] fixed for tropicalnumber vectors --- src/convert.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/convert.jl b/src/convert.jl index 4b4a2838..b830a90e 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,8 @@ 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}), + (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)} From c3555d89d2c513996ee7ee9b6eacee02d438dfb1 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 28 May 2023 16:58:22 +0200 Subject: [PATCH 4/9] use updated deps tree generator --- src/Polymake.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Polymake.jl b/src/Polymake.jl index c83866ad..c159b6ea 100644 --- a/src/Polymake.jl +++ b/src/Polymake.jl @@ -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) From c7918fca1e4baa7ef82ac9d295ae4bc0d29bb69b Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Tue, 20 Jun 2023 10:31:44 +0200 Subject: [PATCH 5/9] also add tropicalnumber min --- src/convert.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/convert.jl b/src/convert.jl index b830a90e..07e7f3f7 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -108,6 +108,7 @@ for (pmT, jlT) in [(Integer, Base.Integer), (Int64, Union{Int32,Int64,CxxWrap.CxxLong}), (Rational, Union{Base.Rational, 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)} From 881d29fd83e010621476ad37e57ec65ffee9be63 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sat, 24 Jun 2023 10:58:34 +0200 Subject: [PATCH 6/9] prepare for polymake 4.10 and libpolymake 0.10 --- Project.toml | 4 ++-- src/Polymake.jl | 2 +- src/sets.jl | 8 -------- test/arrays.jl | 6 +++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Project.toml b/Project.toml index c23ccef5..35c88219 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.9.3" [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.9.0, ~0.10.0" polymake_jll = "^400.900.0" diff --git a/src/Polymake.jl b/src/Polymake.jl index c159b6ea..4f0f0ceb 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.9.0", v"0.11") struct PolymakeError <: Exception msg 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/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 From 0682f0100373b31ef72c5a359214df14a1d06b33 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sat, 24 Jun 2023 11:54:47 +0200 Subject: [PATCH 7/9] bump version even further due to breaking changes in polymake 4.10 [skip ci] --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 35c88219..b8afb22c 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.3" +version = "0.10.0" [deps] BinaryWrappers = "f01c122e-0ea1-4f85-ad8f-907073ad7a9f" From d063934939599660ce24aaa77aa3f695a0164c5e Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sat, 24 Jun 2023 15:03:17 +0200 Subject: [PATCH 8/9] use new depstree folder [skip ci] --- src/Polymake.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Polymake.jl b/src/Polymake.jl index 4f0f0ceb..f61eef72 100644 --- a/src/Polymake.jl +++ b/src/Polymake.jl @@ -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) From acf388ebd6e9fba74d728f879ef4c43f949b7a6e Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sat, 24 Jun 2023 17:42:52 +0200 Subject: [PATCH 9/9] restrict libpolymake version to test new binaries --- Project.toml | 2 +- src/Polymake.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b8afb22c..0ab3e063 100644 --- a/Project.toml +++ b/Project.toml @@ -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, ~0.10.0" +libpolymake_julia_jll = "~0.10.0" polymake_jll = "^400.900.0" diff --git a/src/Polymake.jl b/src/Polymake.jl index f61eef72..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.11") +const jlpolymake_version_range = (v"0.10.0", v"0.11") struct PolymakeError <: Exception msg