From dc14b2fd951259b39a04fdad59f9b7aec7d21a25 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 30 Oct 2019 23:56:53 +0100 Subject: [PATCH 1/6] replace Settings.warmstart by force_compute --- src/1712.07167.jl | 35 +++++++++++++++++------------------ test/1703.09680.jl | 8 ++++---- test/1712.07167.jl | 34 +++++++++++++++++----------------- test/1812.03456.jl | 4 ++-- test/runtests.jl | 4 ++-- 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/1712.07167.jl b/src/1712.07167.jl index 1d246f5..125d83d 100644 --- a/src/1712.07167.jl +++ b/src/1712.07167.jl @@ -16,7 +16,7 @@ struct Naive{El} <: Settings upper_bound::Float64 solver::JuMP.OptimizerFactory - warmstart::Bool + force_compute::Bool end struct Symmetrized{El} <: Settings @@ -28,19 +28,19 @@ struct Symmetrized{El} <: Settings upper_bound::Float64 solver::JuMP.OptimizerFactory - warmstart::Bool + force_compute::Bool end function Settings(name::String, G::Union{Group, NCRing}, S::AbstractVector{El}, solver::JuMP.OptimizerFactory; - halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where El <: Union{GroupElem, NCRingElem} - return Naive(name, G, S, halfradius, upper_bound, solver, warmstart) + halfradius::Integer=2, upper_bound::Float64=1.0, force_compute=false) where El <: Union{GroupElem, NCRingElem} + return Naive(name, G, S, halfradius, upper_bound, solver, force_compute) end function Settings(name::String, G::Union{Group, NCRing}, S::AbstractVector{El}, autS::Group, solver::JuMP.OptimizerFactory; - halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where El <: Union{GroupElem, NCRingElem} - return Symmetrized(name, G, S, autS, halfradius, upper_bound, solver, warmstart) + halfradius::Integer=2, upper_bound::Float64=1.0, force_compute=false) where El <: Union{GroupElem, NCRingElem} + return Symmetrized(name, G, S, autS, halfradius, upper_bound, solver, force_compute) end prefix(s::Naive) = s.name @@ -81,11 +81,11 @@ end function warmstart(sett::Settings) warmstart_fname = filename(sett, :warmstart) try - ws = load(filename(sett, :warmstart), "warmstart") + ws = load(warmstart_fname, "warmstart") @info "Loaded $warmstart_fname." return ws catch ex - @warn "$(ex.msg). Not providing a warmstart to the solver." + @warn "$(ex.msg). Could not provide a warmstart to the solver." return nothing end end @@ -239,23 +239,22 @@ end Kazhdan(λ::Number, N::Integer) = sqrt(2*λ/N) function check_property_T(sett::Settings) - print_summary(sett) + @info sett certified_sgap = spectral_gap(sett) return interpret_results(sett, certified_sgap) end -function print_summary(sett::Settings) - separator = "="^76 - info_strs = [separator, - "Running tests for $(sett.name):", +function Base.show(io::IO, sett::Settings) + info_strs = ["PropertyT Settings:", + "Group: $(sett.name)", "Upper bound for λ: $(sett.upper_bound), on halfradius $(sett.halfradius).", - "Warmstart: $(sett.warmstart)", - "Results will be stored in ./$(PropertyT.prepath(sett))", + "Force computations: $(sett.force_compute);", + "Results will be stored in ./$(PropertyT.prepath(sett));", "Solver: $(typeof(sett.solver()))", "Solvers options: "] append!(info_strs, [rpad(" $k", 30)* "→ \t$v" for (k,v) in sett.solver().options]) - push!(info_strs, separator) - @info join(info_strs, "\n") + push!(info_strs, "="^76) + print(io, join(info_strs, "\n")) end function interpret_results(sett::Settings, sgap::Number) @@ -300,7 +299,7 @@ function spectral_gap(sett::Settings) return λ, P end - if sett.warmstart + if sett.force_compute λ, P = compute(sett, Δ) else λ, P =try diff --git a/test/1703.09680.jl b/test/1703.09680.jl index f8c66af..971b549 100644 --- a/test/1703.09680.jl +++ b/test/1703.09680.jl @@ -8,7 +8,7 @@ rm("SL($N,Z)", recursive=true, force=true) sett = PropertyT.Settings("SL($N,Z)", G, S, with_SCS(20000, accel=20); upper_bound=0.1) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ < 0.0 @@ -23,7 +23,7 @@ rm("SL($N,Z)", recursive=true, force=true) sett = PropertyT.Settings("SL($N,Z)", G, S, with_SCS(1000, accel=20); upper_bound=0.1) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ > 0.0999 @@ -39,9 +39,9 @@ rm("SAut(F$N)", recursive=true, force=true) sett = PropertyT.Settings("SAut(F$N)", G, S, with_SCS(10000); - upper_bound=0.15, warmstart=false) + upper_bound=0.15) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ < 0.0 diff --git a/test/1712.07167.jl b/test/1712.07167.jl index 259836a..cb41e9e 100644 --- a/test/1712.07167.jl +++ b/test/1712.07167.jl @@ -8,22 +8,22 @@ rm("oSL($N,Z)", recursive=true, force=true) sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(2000, accel=20); - upper_bound=0.27, warmstart=false) + upper_bound=0.27, force_compute=false) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ < 0.0 @test PropertyT.interpret_results(sett, λ) == false - # second run just checks the solution due to warmstart=false above + # second run just checks the solution due to force_compute=false above @test λ == PropertyT.spectral_gap(sett) @test PropertyT.check_property_T(sett) == false - sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(2000, accel=20); - upper_bound=0.27, warmstart=true) + sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(4000, accel=20); + upper_bound=0.27, force_compute=true) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ > 0.269999 @@ -36,10 +36,10 @@ ########## # Symmetrizing by PermGroup(3): - sett = PropertyT.Settings("SL($N,Z)", G, S, PermGroup(N), with_SCS(4000, accel=20); - upper_bound=0.27, warmstart=true) + sett = PropertyT.Settings("SL($N,Z)", G, S, PermGroup(N), with_SCS(4000, accel=20, warm_start=false); + upper_bound=0.27, force_compute=true) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ > 0.269999 @@ -54,22 +54,22 @@ rm("oSL($N,Z)", recursive=true, force=true) sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(2000, accel=20); - upper_bound=1.3, warmstart=false) + upper_bound=1.3, force_compute=false) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ < 0.0 @test PropertyT.interpret_results(sett, λ) == false - # second run just checks the solution due to warmstart=false above + # second run just checks the solution due to force_compute=false above @test λ == PropertyT.spectral_gap(sett) @test PropertyT.check_property_T(sett) == false - sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(5000, accel=20); - upper_bound=1.3, warmstart=true) + sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(5000, accel=20, warm_start=true); + upper_bound=1.3, force_compute=true) - PropertyT.print_summary(sett) + @info sett λ = PropertyT.spectral_gap(sett) @test λ > 1.2999 @@ -89,9 +89,9 @@ rm("oSAut(F$N)", recursive=true, force=true) sett = PropertyT.Settings("SAut(F$N)", G, S, autS, with_SCS(1000); - upper_bound=0.15, warmstart=false) + upper_bound=0.15) - PropertyT.print_summary(sett) + @info sett @test PropertyT.check_property_T(sett) == false end diff --git a/test/1812.03456.jl b/test/1812.03456.jl index 7b6b121..f5f0211 100644 --- a/test/1812.03456.jl +++ b/test/1812.03456.jl @@ -136,7 +136,7 @@ end @test 2^2*norm(residual, 1) < λ # i.e. we can certify positivity - @test 2^2*norm(residual, 1) < λ/100 + @test 2^2*norm(residual, 1) < 2λ/100 end @testset "Adj₃ is SOS" begin @@ -205,7 +205,7 @@ end Base.Libc.flush_cstdio() @info "obtained λ and residual" λ norm(residual, 1) - @test 2^2*norm(residual, 1) > λ # i.e. we can certify positivity + @test 2^2*norm(residual, 1) > λ # i.e. we can't certify positivity end @testset "Adj₄ + Op₄ is SOS" begin diff --git a/test/runtests.jl b/test/runtests.jl index 1a0e85f..d6b4730 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,10 +6,10 @@ using JLD using JuMP, SCS -with_SCS(iters; accel=1, eps=1e-10) = +with_SCS(iters; accel=1, eps=1e-10, warm_start=true) = with_optimizer(SCS.Optimizer, linear_solver=SCS.Direct, max_iters=iters, - acceleration_lookback=accel, eps=eps, warm_start=true) + acceleration_lookback=accel, eps=eps, warm_start=warm_start) include("1703.09680.jl") include("actions.jl") From 70bf9ad74c3efdead690346dc3c29872602508d9 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 30 Oct 2019 23:58:10 +0100 Subject: [PATCH 2/6] =?UTF-8?q?perm=20=E2=86=92=20Generic.Perm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manifest.toml | 90 ++++++++++++++++++++++++++------------------ Project.toml | 2 - src/PropertyT.jl | 2 +- src/RGprojections.jl | 4 +- src/orbitdata.jl | 14 +++---- src/sos_sdps.jl | 2 +- src/sqadjop.jl | 4 +- 7 files changed, 67 insertions(+), 51 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index ca218ca..23908b2 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,13 +2,19 @@ [[AbstractAlgebra]] deps = ["InteractiveUtils", "LinearAlgebra", "Markdown", "Random", "SparseArrays", "Test"] -git-tree-sha1 = "0d4f7283435bd7e12a703a3fd58aa11224a96019" +git-tree-sha1 = "da0bf98d73f2f34c35d58981fcf139f16749a394" uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" -version = "0.5.2" +version = "0.7.1" [[Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +[[BenchmarkTools]] +deps = ["JSON", "Printf", "Statistics"] +git-tree-sha1 = "90b73db83791c5f83155016dd1cc1f684d4e1361" +uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +version = "0.4.3" + [[BinDeps]] deps = ["Compat", "Libdl", "SHA", "URIParser"] git-tree-sha1 = "12093ca6cdd0ee547c39b1870e0c9c3f154d9ca9" @@ -16,10 +22,10 @@ uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee" version = "0.8.10" [[BinaryProvider]] -deps = ["Libdl", "Logging", "SHA"] -git-tree-sha1 = "c7361ce8a2129f20b0e05a89f7070820cfed6648" +deps = ["Libdl", "SHA"] +git-tree-sha1 = "29995a7b317bbd06be147e1974a3541ce2502dca" uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -version = "0.5.6" +version = "0.5.7" [[Blosc]] deps = ["BinaryProvider", "CMakeWrapper", "Compat", "Libdl"] @@ -47,9 +53,9 @@ version = "0.7.1" [[Calculus]] deps = ["Compat"] -git-tree-sha1 = "f60954495a7afcee4136f78d1d60350abd37a409" +git-tree-sha1 = "bd8bbd105ba583a42385bd6dc4a20dad8ab3dc11" uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" -version = "0.4.1" +version = "0.5.0" [[CommonSubexpressions]] deps = ["Test"] @@ -59,15 +65,15 @@ version = "0.2.0" [[Compat]] deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "84aa74986c5b9b898b0d1acaf3258741ee64754f" +git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "2.1.0" +version = "2.2.0" [[DataStructures]] deps = ["InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "0809951a1774dc724da22d26e4289bbaab77809a" +git-tree-sha1 = "1fe8fad5fc84686dcbc674aa255bc867a64f8132" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.17.0" +version = "0.17.5" [[Dates]] deps = ["Printf"] @@ -111,14 +117,14 @@ uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" version = "1.0.7" [[ForwardDiff]] -deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "InteractiveUtils", "LinearAlgebra", "NaNMath", "Random", "SparseArrays", "SpecialFunctions", "StaticArrays", "Test"] -git-tree-sha1 = "4c4d727f1b7e0092134fabfab6396b8945c1ea5b" +deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"] +git-tree-sha1 = "e2c81741a8be50de143ecddee942396894f47750" uuid = "f6369f11-7733-5829-9624-2563aa707210" -version = "0.10.3" +version = "0.10.4" [[GroupRings]] deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown", "SparseArrays"] -git-tree-sha1 = "9f41bad54217ce2605c13f10b79d1221c259ed32" +git-tree-sha1 = "0953bbaa3ccd0b7e12585e705011f01ac8672c7c" repo-rev = "master" repo-url = "https://github.com/kalmarek/GroupRings.jl" uuid = "0befed6a-bd73-11e8-1e41-a1190947c2f5" @@ -126,27 +132,27 @@ version = "0.3.0" [[Groups]] deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown"] -git-tree-sha1 = "bf267f82f4c313a6deb3db64efc7893b139d4340" +git-tree-sha1 = "852339602ab880eb0e2a78f072ad386f3266f8a2" repo-rev = "master" repo-url = "https://github.com/kalmarek/Groups.jl" uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557" -version = "0.2.2" +version = "0.2.3" [[HDF5]] -deps = ["BinaryProvider", "Blosc", "Libdl", "Mmap"] -git-tree-sha1 = "635ae44613c8c8dcf5d5b0084bfa00abea498e1f" +deps = ["BinaryProvider", "Blosc", "CMakeWrapper", "Libdl", "Mmap"] +git-tree-sha1 = "c14a84878428b66222fccea6ed89cdafa7c22ae4" uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" -version = "0.12.0" +version = "0.12.4" [[InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" [[IntervalArithmetic]] -deps = ["CRlibm", "FastRounding", "LinearAlgebra", "Markdown", "RecipesBase", "SetRounding", "StaticArrays", "Test"] -git-tree-sha1 = "e2379c6b0b48ce6e414e8eeabec95cd6982aad22" +deps = ["CRlibm", "FastRounding", "LinearAlgebra", "Markdown", "RecipesBase", "SetRounding", "StaticArrays"] +git-tree-sha1 = "f97d8d63c3f849b0f545062de4634bc9f100d8ec" uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" -version = "0.15.2" +version = "0.16.1" [[JLD]] deps = ["Compat", "FileIO", "HDF5", "LegacyStrings", "Profile", "Random"] @@ -154,11 +160,17 @@ git-tree-sha1 = "95fd5d7f129918a75d0535aaaf5b8e235e6e0b0b" uuid = "4138dd39-2aa7-5051-a626-17a0bb65d9c8" version = "0.9.1" +[[JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.0" + [[JuMP]] deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"] -git-tree-sha1 = "a37fdb14ee3a04b4df44c20a73da89c57035bdf2" +git-tree-sha1 = "ba7f96010ed290d77d5c941c32e5df107ca688a4" uuid = "4076af6c-e467-56ae-b986-b466b2749572" -version = "0.19.2" +version = "0.20.1" [[LegacyStrings]] deps = ["Compat"] @@ -184,10 +196,10 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MathOptInterface]] -deps = ["Compat", "Unicode"] -git-tree-sha1 = "5d3de69c9220610d0336ab45d3eb8b6ac7a7c807" +deps = ["BenchmarkTools", "LinearAlgebra", "OrderedCollections", "SparseArrays", "Test", "Unicode"] +git-tree-sha1 = "0d0e9987440b0b5c03f8df9cd30694f1acec81bb" uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" -version = "0.8.4" +version = "0.9.6" [[MathProgBase]] deps = ["Compat"] @@ -211,10 +223,16 @@ uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" version = "1.1.0" [[Parameters]] -deps = ["Markdown", "OrderedCollections", "REPL", "Test"] -git-tree-sha1 = "70bdbfb2bceabb15345c0b54be4544813b3444e4" +deps = ["OrderedCollections"] +git-tree-sha1 = "b62b2558efb1eef1fa44e4be5ff58a515c287e38" uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" -version = "0.10.3" +version = "0.12.0" + +[[Parsers]] +deps = ["Dates", "Test"] +git-tree-sha1 = "ef0af6c8601db18c282d092ccbd2f01f3f0cd70b" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "0.3.7" [[Pkg]] deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] @@ -265,16 +283,16 @@ deps = ["LinearAlgebra", "Random"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[SpecialFunctions]] -deps = ["BinDeps", "BinaryProvider", "Libdl", "Test"] -git-tree-sha1 = "0b45dc2e45ed77f445617b99ff2adf0f5b0f23ea" +deps = ["BinDeps", "BinaryProvider", "Libdl"] +git-tree-sha1 = "3bdd374b6fd78faf0119b8c5d538788dbf910c6e" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "0.7.2" +version = "0.8.0" [[StaticArrays]] deps = ["LinearAlgebra", "Random", "Statistics"] -git-tree-sha1 = "db23bbf50064c582b6f2b9b043c8e7e98ea8c0c6" +git-tree-sha1 = "1085ffbf5fd48fdba64ef8e902ca429c4e1212d3" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "0.11.0" +version = "0.11.1" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] diff --git a/Project.toml b/Project.toml index 9c38a9a..0426322 100644 --- a/Project.toml +++ b/Project.toml @@ -20,8 +20,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] GroupRings = "^0.3.0" Groups = "^0.2.1" -IntervalArithmetic = "^0.15.0" -JuMP = "^0.19.0" [extras] SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13" diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 53199b3..661b42d 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -13,7 +13,7 @@ using GroupRings using JLD using JuMP -import AbstractAlgebra: Group, NCRing, perm +import AbstractAlgebra: Group, NCRing import MathProgBase.SolverInterface.AbstractMathProgSolver diff --git a/src/RGprojections.jl b/src/RGprojections.jl index ffa3f11..ef7f94d 100644 --- a/src/RGprojections.jl +++ b/src/RGprojections.jl @@ -31,7 +31,7 @@ function (chi::DirectProdCharacter)(g::DirectPowerGroupElem) return res end -function (chi::PermCharacter)(g::Generic.perm) +function (chi::PermCharacter)(g::Generic.Perm) R = AbstractAlgebra.partitionseq(chi.p) p = Partition(Generic.permtype(g)) return Int(Generic.MN1inner(R, p, 1, Generic._charvalsTable)) @@ -97,7 +97,7 @@ function idempotents(RG::GroupRing{Generic.PermGroup{S}}, T::Type=Rational{Int}) return GroupRingElem{T}[1//2*(Id + transp), 1//2*(Id - transp)] end - projs = Vector{Vector{Generic.perm{S}}}() + projs = Vector{Vector{Generic.Perm{S}}}() for l in 2:RG.group.n u = RG.group([circshift([i for i in 1:l], -1); [i for i in l+1:RG.group.n]]) i = 0 diff --git a/src/orbitdata.jl b/src/orbitdata.jl index 1e8c189..ce3c534 100644 --- a/src/orbitdata.jl +++ b/src/orbitdata.jl @@ -4,7 +4,7 @@ # ############################################################################### -struct OrbitData{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:perm} +struct OrbitData{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:Generic.Perm} orbits::Vector{Vector{Int}} preps::Dict{GEl, P} Uπs::Vector{T} @@ -147,7 +147,7 @@ end function perm_reps(G::Group, E::Vector, E_rdict=GroupRings.reverse_dict(E)) elts = collect(G) l = length(elts) - preps = Vector{perm}(undef, l) + preps = Vector{Generic.Perm}(undef, l) permG = PermutationGroup(length(E)) @@ -163,7 +163,7 @@ function matrix_repr(x::GroupRingElem, mreps::Dict) return sum(x[i].*mreps[parent(x).basis[i]] for i in nzeros) end -function matrix_reps(preps::Dict{T,perm{I}}) where {T<:GroupElem, I<:Integer} +function matrix_reps(preps::Dict{T,Generic.Perm{I}}) where {T<:GroupElem, I<:Integer} kk = collect(keys(preps)) mreps = Vector{SparseMatrixCSC{Float64, Int}}(undef, length(kk)) Threads.@threads for i in 1:length(kk) @@ -192,7 +192,7 @@ end # ############################################################################### -function (g::perm)(y::GroupRingElem) +function (g::Generic.Perm)(y::GroupRingElem) RG = parent(y) result = zero(RG, eltype(y.coeffs)) @@ -204,7 +204,7 @@ function (g::perm)(y::GroupRingElem) return result end -function (g::perm)(y::GroupRingElem{T, <:SparseVector}) where T +function (g::Generic.Perm)(y::GroupRingElem{T, <:SparseVector}) where T RG = parent(y) index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind] @@ -213,7 +213,7 @@ function (g::perm)(y::GroupRingElem{T, <:SparseVector}) where T return result end -function (p::perm)(A::MatAlgElem) +function (p::Generic.Perm)(A::MatAlgElem) length(p.d) == size(A, 1) == size(A,2) || throw("Can't act via $p on matrix of size $(size(A))") result = similar(A) @inbounds for i in 1:size(A, 1) @@ -290,7 +290,7 @@ function (g::WreathProductElem)(a::Groups.Automorphism) return res end -function (p::perm)(a::Groups.Automorphism) +function (p::Generic.Perm)(a::Groups.Automorphism) res = parent(a)(Groups.perm_autsymbol(p)) res = Groups.r_multiply!(res, a.symbols, reduced=false) res = Groups.r_multiply!(res, [Groups.perm_autsymbol(inv(p))]) diff --git a/src/sos_sdps.jl b/src/sos_sdps.jl index a67a153..3037e00 100644 --- a/src/sos_sdps.jl +++ b/src/sos_sdps.jl @@ -140,7 +140,7 @@ end function reconstruct(Ps::Vector{M}, preps::Dict{GEl, P}, Uπs::Vector{U}, dims::Vector{Int}) where - {M<:AbstractMatrix, GEl<:GroupElem, P<:perm, U<:AbstractMatrix} + {M<:AbstractMatrix, GEl<:GroupElem, P<:Generic.Perm, U<:AbstractMatrix} lU = length(Uπs) transfP = [dims[π].*Uπs[π]*Ps[π]*Uπs[π]' for π in 1:lU] diff --git a/src/sqadjop.jl b/src/sqadjop.jl index b516d10..27e9199 100644 --- a/src/sqadjop.jl +++ b/src/sqadjop.jl @@ -1,8 +1,8 @@ -isopposite(σ::perm, τ::perm, i=1, j=2) = +isopposite(σ::Generic.Perm, τ::Generic.Perm, i=1, j=2) = σ[i] ≠ τ[i] && σ[i] ≠ τ[j] && σ[j] ≠ τ[i] && σ[j] ≠ τ[j] -isadjacent(σ::perm, τ::perm, i=1, j=2) = +isadjacent(σ::Generic.Perm, τ::Generic.Perm, i=1, j=2) = (σ[i] == τ[i] && σ[j] ≠ τ[j]) || # first equal, second differ (σ[j] == τ[j] && σ[i] ≠ τ[i]) || # sedond equal, first differ (σ[i] == τ[j] && σ[j] ≠ τ[i]) || # first σ equal to second τ From ead95d20c3569ffeece6c34594b695ec07a18958 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 31 Oct 2019 00:16:06 +0100 Subject: [PATCH 3/6] =?UTF-8?q?perm=5Favg=20=E2=86=92=20perm=5Favg!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 + src/sos_sdps.jl | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8084d03..84efbbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ julia: - 1.0 - 1.1 - 1.2 + - 1.3 - nightly notifications: email: true diff --git a/src/sos_sdps.jl b/src/sos_sdps.jl index 3037e00..a7af726 100644 --- a/src/sos_sdps.jl +++ b/src/sos_sdps.jl @@ -147,7 +147,7 @@ function reconstruct(Ps::Vector{M}, tmp = [zeros(Float64, size(first(transfP))) for _ in 1:lU] Threads.@threads for π in 1:lU - tmp[π] = perm_avg(tmp[π], transfP[π], values(preps)) + tmp[π] = perm_avg!(tmp[π], transfP[π], values(preps)) end recP = sum(tmp)./length(preps) @@ -155,7 +155,7 @@ function reconstruct(Ps::Vector{M}, return recP end -function perm_avg(result, P, perms) +function perm_avg!(result, P, perms) lp = length(first(perms).d) for p in perms # result .+= view(P, p.d, p.d) From 4362e7354c11fe338873b74b919927cf18e681b2 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 31 Oct 2019 09:59:09 +0100 Subject: [PATCH 4/6] fix test --- test/1703.09680.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/1703.09680.jl b/test/1703.09680.jl index 971b549..cbed108 100644 --- a/test/1703.09680.jl +++ b/test/1703.09680.jl @@ -26,7 +26,7 @@ @info sett λ = PropertyT.spectral_gap(sett) - @test λ > 0.0999 + @test λ > 0.099 @test PropertyT.interpret_results(sett, λ) == true @test PropertyT.check_property_T(sett) == true #second run should be fast From 080aef1eaf30b9e73bb1a58ea6834aae30540996 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 31 Oct 2019 10:19:42 +0100 Subject: [PATCH 5/6] drop support for julia-1.0 --- .travis.yml | 3 +-- Project.toml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84efbbf..cfd35bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ os: - linux - osx julia: - - 1.0 - 1.1 - 1.2 - 1.3 @@ -15,7 +14,7 @@ matrix: fast_finish: true allow_failures: - julia: nightly - - os: osx + addons: apt: packages: diff --git a/Project.toml b/Project.toml index 0426322..77441af 100644 --- a/Project.toml +++ b/Project.toml @@ -20,6 +20,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] GroupRings = "^0.3.0" Groups = "^0.2.1" +julia = "≥ 1.1.0" [extras] SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13" From 352c1fafe7de76cb299eb8c46ab711c6aeb6b1c5 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 31 Oct 2019 11:18:06 +0100 Subject: [PATCH 6/6] fix tests --- test/1712.07167.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/1712.07167.jl b/test/1712.07167.jl index cb41e9e..d81663d 100644 --- a/test/1712.07167.jl +++ b/test/1712.07167.jl @@ -66,7 +66,7 @@ @test λ == PropertyT.spectral_gap(sett) @test PropertyT.check_property_T(sett) == false - sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(5000, accel=20, warm_start=true); + sett = PropertyT.Settings("SL($N,Z)", G, S, autS, with_SCS(15000, accel=20, warm_start=true); upper_bound=1.3, force_compute=true) @info sett