Merge pull request #8 from kalmarek/enh/update_deps

Enh/update deps
This commit is contained in:
Marek Kaluba 2021-02-21 23:16:02 +01:00 committed by GitHub
commit db04430105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 190 additions and 497 deletions

11
.github/workflows/TagBot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

41
.github/workflows/runtests.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- '1.3'
- '1.5'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: ./lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
Manifest.toml
test/SL*
test/oSL*
test/SAut*

View File

@ -1,377 +0,0 @@
# This file is machine-generated - editing it directly is not advised
[[AbstractAlgebra]]
deps = ["InteractiveUtils", "LinearAlgebra", "Markdown", "Random", "SparseArrays", "Test"]
git-tree-sha1 = "a203c19175c8dfa8cd61356a06bb157e973baff0"
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
version = "0.9.2"
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[BenchmarkTools]]
deps = ["JSON", "Logging", "Printf", "Statistics", "UUIDs"]
git-tree-sha1 = "9e62e66db34540a0c919d72172cc2f642ac71260"
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
version = "0.5.0"
[[Blosc]]
deps = ["Blosc_jll"]
git-tree-sha1 = "84cf7d0f8fd46ca6f1b3e0305b4b4a37afe50fd6"
uuid = "a74b3585-a348-5f62-a45c-50e91977d574"
version = "0.7.0"
[[Blosc_jll]]
deps = ["Libdl", "Lz4_jll", "Pkg", "Zlib_jll", "Zstd_jll"]
git-tree-sha1 = "aa9ef39b54a168c3df1b2911e7797e4feee50fbe"
uuid = "0b7ba130-8d10-5ba8-a3d6-c5182647fed9"
version = "1.14.3+1"
[[Bzip2_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "3663bfffede2ef41358b6fc2e1d8a6d50b3c3904"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.6+2"
[[CRlibm]]
deps = ["Libdl"]
git-tree-sha1 = "9d1c22cff9c04207f336b8e64840d0bd40d86e0e"
uuid = "96374032-68de-5a5b-8d9e-752f78720389"
version = "0.8.0"
[[Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"
[[CodecBzip2]]
deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"]
git-tree-sha1 = "2e62a725210ce3c3c2e1a3080190e7ca491f18d7"
uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd"
version = "0.7.2"
[[CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.0"
[[CommonSubexpressions]]
deps = ["Test"]
git-tree-sha1 = "efdaf19ab11c7889334ca247ff4c9f7c322817b0"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
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 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "2.2.0"
[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612"
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "0.3.3+0"
[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "be680f1ad03c0a03796aa3fda5a2180df7f83b46"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.18"
[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[DiffResults]]
deps = ["StaticArrays"]
git-tree-sha1 = "da24935df8e0c6cf28de340b958f6aac88eaa0cc"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.0.2"
[[DiffRules]]
deps = ["NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"
[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[ErrorfreeArithmetic]]
git-tree-sha1 = "a5198ab6c8a724dd3965b31ddd11ccde65300f5b"
uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a"
version = "0.5.0"
[[FastRounding]]
deps = ["ErrorfreeArithmetic", "Test"]
git-tree-sha1 = "224175e213fd4fe112db3eea05d66b308dc2bf6b"
uuid = "fa42c844-2597-5d31-933b-ebd51ab2693f"
version = "0.2.0"
[[FileIO]]
deps = ["Pkg"]
git-tree-sha1 = "202335fd24c2776493e198d6c66a6d910400a895"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.3.0"
[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "869540e4367122fbffaace383a5bdc34d6e5e5ac"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.10"
[[GroupRings]]
deps = ["AbstractAlgebra", "Groups", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "76e662a5473866f4f02ed4df2e83af4d531b419c"
repo-rev = "master"
repo-url = "https://github.com/kalmarek/GroupRings.jl"
uuid = "0befed6a-bd73-11e8-1e41-a1190947c2f5"
version = "0.3.2"
[[Groups]]
deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown"]
git-tree-sha1 = "479214998d4769d31a8ff65d0f43152eb191850f"
repo-rev = "master"
repo-url = "https://github.com/kalmarek/Groups.jl"
uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557"
version = "0.4.2"
[[HDF5]]
deps = ["Blosc", "HDF5_jll", "Libdl", "Mmap", "Random"]
git-tree-sha1 = "7048678fa1970aaf867f3e99b90f3e85a9847124"
uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
version = "0.13.2"
[[HDF5_jll]]
deps = ["Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "85bd2e586a10ae0eab856125bf5245e0d36384a7"
uuid = "0234f1f7-429e-5d53-9886-15a909be8d59"
version = "1.10.5+5"
[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
git-tree-sha1 = "ec87d5e2acbe1693789efbbe14f5ea7525758f71"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.8.15"
[[IniFile]]
deps = ["Test"]
git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.0"
[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[IntervalArithmetic]]
deps = ["CRlibm", "FastRounding", "LinearAlgebra", "Markdown", "Random", "RecipesBase", "SetRounding", "StaticArrays"]
git-tree-sha1 = "b2db6ee367b4eb3ee8b009ede8ca809e4fd23d35"
uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
version = "0.16.7"
[[JLD]]
deps = ["Compat", "FileIO", "HDF5", "LegacyStrings"]
git-tree-sha1 = "c8c7a9ca4c17a519961a8ec27e508b07ffc9c1a9"
uuid = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
version = "0.9.2"
[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.0"
[[JSONSchema]]
deps = ["HTTP", "JSON", "ZipFile"]
git-tree-sha1 = "832a4d327d9dafdae55a6ecae04f9997c83615cc"
uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "0.3.0"
[[JuMP]]
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "ba7f96010ed290d77d5c941c32e5df107ca688a4"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.20.1"
[[LegacyStrings]]
deps = ["Compat"]
git-tree-sha1 = "d4b9bde2694c552fe579cc4462733f1ce08733fe"
uuid = "1b4a561d-cfcb-5daf-8433-43fcf8b4bea3"
version = "0.4.1"
[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[Lz4_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "e1a93171a400d4578193eaa39edd2d3f5db08fb6"
uuid = "5ced341a-0733-55b8-9ab6-a4889d929147"
version = "1.9.2+0"
[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MathOptInterface]]
deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "JSON", "JSONSchema", "LinearAlgebra", "MutableArithmetics", "OrderedCollections", "SparseArrays", "Test", "Unicode"]
git-tree-sha1 = "cd2049c055c7d192a235670d50faa375361624ba"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
version = "0.9.14"
[[MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
git-tree-sha1 = "426a6978b03a97ceb7ead77775a1da066343ec6e"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.0.2"
[[MbedTLS_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "c83f5a1d038f034ad0549f9ee4d5fac3fb429e33"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.16.0+2"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[MutableArithmetics]]
deps = ["LinearAlgebra", "SparseArrays", "Test"]
git-tree-sha1 = "6cf09794783b9de2e662c4e8b60d743021e338d0"
uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
version = "0.2.10"
[[NaNMath]]
git-tree-sha1 = "928b8ca9b2791081dc71a51c55347c27c618760f"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.3"
[[OpenSpecFun_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87"
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.3+3"
[[OrderedCollections]]
git-tree-sha1 = "12ce190210d278e12644bcadf5b21cbdcf225cd3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.2.0"
[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "eb3e09940c0d7ae01b01d9291ebad7b081c844d3"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.0.5"
[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[RecipesBase]]
git-tree-sha1 = "b4ed4a7f988ea2340017916f7c9e5d7560b52cae"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "0.8.0"
[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[SetRounding]]
deps = ["Test"]
git-tree-sha1 = "faca28c7937138d560ede5bfef2076d0cdf3584b"
uuid = "3cc68bcd-71a2-5612-b932-767ffbe40ab0"
version = "0.2.0"
[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[SpecialFunctions]]
deps = ["OpenSpecFun_jll"]
git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.10.3"
[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "5c06c0aeb81bef54aed4b3f446847905eb6cbda0"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "0.12.3"
[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.5"
[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[ZipFile]]
deps = ["Libdl", "Printf", "Zlib_jll"]
git-tree-sha1 = "254975fef2fc526583bb9b7c9420fe66ffe09f2f"
uuid = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
version = "0.9.2"
[[Zlib_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "4838361eb3ba796a57457bdc183e1a128639d0ec"
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.11+12"
[[Zstd_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "b25b0fb10176c42e9a5a20e1f40d570ac0288d4e"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.4.5+0"

View File

@ -12,16 +12,18 @@ IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[compat]
AbstractAlgebra = "^0.9.0"
AbstractAlgebra = "^0.10.0"
GroupRings = "^0.3.2"
Groups = "^0.4.2"
Groups = "^0.5.0"
IntervalArithmetic = "^0.16.0"
JLD = "^0.9.0"
JuMP = "^0.20.0"
julia = "^1.3.0, ^1.4.0"
SCS = "^0.7.0"
julia = "^1.3.0"
[extras]
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"

View File

@ -51,8 +51,8 @@ filename(sett::Settings, ::Type{Val{:solverlog}}; kwargs...) =
filename(sett::Settings, ::Type{Val{}}; kwargs...) =
filename(prepath(sett), "delta", "jld"; kwargs...)
filename(sett::Settings, ::Type{Val{:OrbitData}}; kwargs...) =
filename(prepath(sett), "OrbitData", "jld"; kwargs...)
filename(sett::Settings, ::Type{Val{:BlockDecomposition}}; kwargs...) =
filename(prepath(sett), "BlockDecomposition", "jld"; kwargs...)
filename(sett::Settings, ::Type{Val{:solution}}; kwargs...) =
filename(fullpath(sett), "solution", "jld"; kwargs...)
@ -89,7 +89,7 @@ function approximate_by_SOS(sett::Naive,
isdir(fullpath(sett)) || mkpath(fullpath(sett))
@info "Creating SDP problem..."
SDP_problem = SOS_problem(elt, orderunit, upper_bound=sett.upper_bound)
SDP_problem = SOS_problem_primal(elt, orderunit, upper_bound=sett.upper_bound)
@info Base.repr(SDP_problem)
@info "Logging solver's progress into $solverlog"
@ -125,7 +125,7 @@ function approximate_by_SOS(sett::Symmetrized,
isdir(fullpath(sett)) || mkpath(fullpath(sett))
orbit_data = try
orbit_data = load(filename(sett, :OrbitData), "OrbitData")
orbit_data = load(filename(sett, :BlockDecomposition), "BlockDecomposition")
@info "Loaded orbit data."
orbit_data
catch ex
@ -133,15 +133,15 @@ function approximate_by_SOS(sett::Symmetrized,
GroupRings.hasbasis(parent(orderunit)) ||
throw("You need to define basis of Group Ring to compute orbit decomposition!")
@info "Computing orbit and Wedderburn decomposition..."
orbit_data = OrbitData(parent(orderunit), sett.autS)
save(filename(sett, :OrbitData), "OrbitData", orbit_data)
orbit_data = BlockDecomposition(parent(orderunit), sett.autS)
save(filename(sett, :BlockDecomposition), "BlockDecomposition", orbit_data)
orbit_data
end
orbit_data = decimate(orbit_data)
@info "Creating SDP problem..."
SDP_problem, varP = SOS_problem(elt, orderunit, orbit_data, upper_bound=sett.upper_bound)
SDP_problem, varP = SOS_problem_primal(elt, orderunit, orbit_data, upper_bound=sett.upper_bound)
@info Base.repr(SDP_problem)
@info "Logging solver's progress into $solverlog"

View File

@ -16,7 +16,7 @@ import AbstractAlgebra: Group, NCRing
include("laplacians.jl")
include("RGprojections.jl")
include("orbitdata.jl")
include("blockdecomposition.jl")
include("sos_sdps.jl")
include("checksolution.jl")

View File

@ -1,17 +1,17 @@
###############################################################################
#
# OrbitData
# BlockDecomposition
#
###############################################################################
struct OrbitData{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:Generic.Perm}
struct BlockDecomposition{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:Generic.Perm}
orbits::Vector{Vector{Int}}
preps::Dict{GEl, P}
Uπs::Vector{T}
dims::Vector{Int}
end
function OrbitData(RG::GroupRing, autS::Group, verbose=true)
function BlockDecomposition(RG::GroupRing, autS::Group; verbose=true)
verbose && @info "Decomposing basis of RG into orbits of" autS
@time orbs = orbit_decomposition(autS, RG.basis, RG.basis_dict)
@assert sum(length(o) for o in orbs) == length(RG.basis)
@ -38,29 +38,33 @@ function OrbitData(RG::GroupRing, autS::Group, verbose=true)
end
@assert dot(multiplicities, dimensions) == size(RG.pm,1)
return OrbitData(orbs, preps, Uπs, dimensions)
return BlockDecomposition(orbs, preps, Uπs, dimensions)
end
function decimate(od::OrbitData)
nzros = [i for i in 1:length(od.Uπs) if size(od.Uπs[i],2) !=0]
function decimate(od::BlockDecomposition; verbose=true)
nzros = [i for i in 1:length(od.Uπs) if !isempty(od.Uπs[i])]
Us = map(x -> PropertyT.sparsify!(x, eps(Float64)*1e3, verbose=true), od.Uπs[nzros])
#dimensions of the corresponding πs:
Us = sparsify!.(od.Uπs, eps(Float64) * 1e4, verbose = verbose)[nzros]
#dimensions of the corresponding Uπs:
dims = od.dims[nzros]
return OrbitData(od.orbits, od.preps, Array{Float64}.(Us), dims);
return BlockDecomposition(od.orbits, od.preps, Array{Float64}.(Us), dims)
end
function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
M = Matrix(M)
fact = svd(M)
M_rank = sum(fact.S .> maximum(size(M))*eps(T))
return fact.U[:,1:M_rank]
fact = svd(convert(Matrix{T}, M))
M_rank = sum(fact.S .> maximum(size(M)) * eps(T))
return fact.U[:, 1:M_rank]
end
orbit_decomposition(G::Group, E::AbstractVector, rdict=GroupRings.reverse_dict(E)) = orbit_decomposition(collect(G), E, rdict)
orbit_decomposition(
G::Group,
E::AbstractVector,
rdict = GroupRings.reverse_dict(E);
op = ^,
) = orbit_decomposition(collect(G), E, rdict; op=op)
function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVector, rdict=GroupRings.reverse_dict(E))
function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVector, rdict=GroupRings.reverse_dict(E); op=^)
tovisit = trues(size(E));
orbits = Vector{Vector{Int}}()
@ -71,7 +75,7 @@ function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVecto
if tovisit[i]
g = E[i]
Threads.@threads for j in eachindex(elts)
orbit[j] = rdict[elts[j](g)]
orbit[j] = rdict[op(g, elts[j])]
end
tovisit[orbit] .= false
push!(orbits, unique(orbit))
@ -89,26 +93,25 @@ end
dens(M::SparseMatrixCSC) = nnz(M)/length(M)
dens(M::AbstractArray) = count(!iszero, M)/length(M)
function sparsify!(M::SparseMatrixCSC{Tv,Ti}, eps=eps(Tv); verbose=false) where {Tv,Ti}
function sparsify!(M::SparseMatrixCSC{Tv,Ti}, tol=eps(Tv); verbose=false) where {Tv,Ti}
densM = dens(M)
for i in eachindex(M.nzval)
if abs(M.nzval[i]) < eps
M.nzval[i] = zero(Tv)
end
end
dropzeros!(M)
droptol!(M, tol)
if verbose
@info("Sparsified density:", rpad(densM, 20), "", rpad(dens(M), 20), " ($(nnz(M)) non-zeros)")
end
verbose && @info(
"Sparsified density:",
rpad(densM, 20),
"",
rpad(dens(M), 20),
" ($(nnz(M)) non-zeros)"
)
return M
end
function sparsify!(M::AbstractArray{T}, eps=eps(T); verbose=false) where T
function sparsify!(M::AbstractArray{T}, tol=eps(T); verbose=false) where T
densM = dens(M)
clamp_small!(M, eps)
clamp_small!(M, tol)
if verbose
@info("Sparsifying $(size(M))-matrix... \n $(rpad(densM, 20))$(rpad(dens(M),20))), ($(count(!iszero, M)) non-zeros)")
@ -117,9 +120,9 @@ function sparsify!(M::AbstractArray{T}, eps=eps(T); verbose=false) where T
return sparse(M)
end
function clamp_small!(M::AbstractArray{T}, eps=eps(T)) where T
function clamp_small!(M::AbstractArray{T}, tol=eps(T)) where T
for n in eachindex(M)
if abs(M[n]) < eps
if abs(M[n]) < tol
M[n] = zero(T)
end
end
@ -139,7 +142,7 @@ end
function perm_repr(g::GroupElem, E::Vector, E_dict)
p = Vector{Int}(undef, length(E))
for (i,elt) in enumerate(E)
p[i] = E_dict[g(elt)]
p[i] = E_dict[elt^g]
end
return p
end
@ -178,29 +181,33 @@ end
#
###############################################################################
function (g::GroupRingElem)(y::GroupRingElem)
function Base.:^(y::GroupRingElem, g::GroupRingElem, op = ^)
res = parent(y)()
for elt in GroupRings.supp(g)
res += g[elt]*elt(y)
res += g[elt] * ^(y, elt, op)
end
return res
end
function (g::GroupElem)(y::GroupRingElem)
function Base.:^(y::GroupRingElem, g::GroupElem, op = ^)
RG = parent(y)
result = zero(RG, eltype(y.coeffs))
for (idx, c) in enumerate(y.coeffs)
if !iszero(c)
result[g(RG.basis[idx])] = c
result[op(RG.basis[idx], g)] = c
end
end
return result
end
function (g::GroupElem)(y::GroupRingElem{T, <:SparseVector}) where T
function Base.:^(
y::GroupRingElem{T,<:SparseVector},
g::GroupElem,
op = ^,
) where {T}
RG = parent(y)
index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind]
index = [RG.basis_dict[op(RG.basis[idx], g)] for idx in y.coeffs.nzind]
result = GroupRingElem(sparsevec(index, y.coeffs.nzval, y.coeffs.n), RG)
@ -213,28 +220,29 @@ end
#
###############################################################################
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))")
function Base.:^(A::MatAlgElem, p::Generic.Perm)
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)
for j in 1:size(A, 2)
result[p[i], p[j]] = A[i,j] # action by permuting rows and colums/conjugation
@inbounds for i = 1:size(A, 1)
for j = 1:size(A, 2)
result[p[i], p[j]] = A[i, j] # action by permuting rows and colums/conjugation
end
end
return result
end
function (g::WreathProductElem{N})(A::MatAlgElem) where N
function Base.:^(A::MatAlgElem, g::WreathProductElem{N}) where {N}
# @assert N == size(A,1) == size(A,2)
flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N)
flips = ntuple(i -> (g.n[i].d[1] == 1 && g.n[i].d[2] == 2 ? 1 : -1), N)
result = similar(A)
R = base_ring(parent(A))
tmp = R(1)
@inbounds for i = 1:size(A,1)
for j = 1:size(A,2)
@inbounds for i = 1:size(A, 1)
for j = 1:size(A, 2)
x = A[i, j]
if flips[i]*flips[j] == 1
if flips[i] * flips[j] == 1
result[g.p[i], g.p[j]] = x
else
result[g.p[i], g.p[j]] = -x
@ -250,7 +258,7 @@ end
#
###############################################################################
function (g::GroupElem)(a::Automorphism)
function Base.:^(a::Automorphism, g::GroupElem)
Ag = parent(a)(g)
Ag_inv = inv(Ag)
res = append!(Ag, a, Ag_inv)
@ -261,10 +269,11 @@ end
function (A::AutGroup)(g::WreathProductElem)
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
parent(g).P.n == length(A.objectGroup.gens) ||
throw("No natural embedding of $(parent(g)) into $A")
elt = one(A)
Id = one(parent(g.n.elts[1]))
for i in 1:length(g.p.d)
for i = 1:length(g.p.d)
if g.n.elts[i] != Id
push!(elt, Groups.flip(i))
end

View File

@ -16,7 +16,7 @@ end
function Laplacian(S::AbstractVector{REl}, halfradius) where REl<:Union{NCRingElem, GroupElem}
G = parent(first(S))
@info "Generating metric ball of radius" radius=2halfradius
@time E_R, sizes = Groups.generate_balls(S, one(G), radius=2halfradius)
@time E_R, sizes = Groups.wlmetric_ball(S, radius=2halfradius)
@info "Generated balls:" sizes
@info "Creating product matrix..."

View File

@ -43,7 +43,7 @@ end
###############################################################################
function SOS_problem_dual(elt::GroupRingElem, order_unit::GroupRingElem;
upper_bound::Float64=Inf)
lower_bound::Float64=Inf)
@assert parent(elt) == parent(order_unit)
RG = parent(elt)
@ -54,9 +54,10 @@ function SOS_problem_dual(elt::GroupRingElem, order_unit::GroupRingElem;
@constraint(m, λ_dual, dot(order_unit.coeffs, y) == 1)
@constraint(m, psd, [y[i] for i in RG.pm] in PSDCone())
if !isinf(upper_bound)
if !isinf(lower_bound)
@variable(m, λ_ub_dual)
expr = dot(elt.coeffs, y) + upper_bound*λ_ub_dual
expr = dot(elt.coeffs, y) + lower_bound*λ_ub_dual
# @constraint m expr >= lower_bound
@objective m Min expr
else
@objective m Min dot(elt.coeffs, y)
@ -73,7 +74,7 @@ function SOS_problem_primal(X::GroupRingElem, orderunit::GroupRingElem;
JuMP.@variable(m, P[1:N, 1:N])
# SP = Symmetric(P)
JuMP.@constraint(m, sdp, P in PSDCone())
JuMP.@SDconstraint(m, sdp, P >= 0)
if iszero(aug(X)) && iszero(aug(orderunit))
JuMP.@constraint(m, augmentation, sum(P) == 0)
@ -97,15 +98,13 @@ function SOS_problem_primal(X::GroupRingElem, orderunit::GroupRingElem;
return m
end
const SOS_problem = SOS_problem_primal
###############################################################################
#
# Symmetrized SDP
#
###############################################################################
function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData; upper_bound::Float64=Inf)
function SOS_problem_primal(X::GroupRingElem, orderunit::GroupRingElem, data::BlockDecomposition; upper_bound::Float64=Inf)
Ns = size.(data.Uπs, 2)
m = JuMP.Model();
@ -113,7 +112,7 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData
for (k,s) in enumerate(Ns)
Ps[k] = JuMP.@variable(m, [1:s, 1:s])
JuMP.@constraint(m, Ps[k] in PSDCone())
JuMP.@SDconstraint(m, Ps[k] >= 0)
end
if upper_bound < Inf
@ -138,7 +137,7 @@ end
function addconstraints!(m::JuMP.Model,
P::Vector{Matrix{JuMP.VariableRef}},
X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData)
X::GroupRingElem, orderunit::GroupRingElem, data::BlockDecomposition)
orderunit_orb = orbit_spvector(orderunit.coeffs, data.orbits)
X_orb = orbit_spvector(X.coeffs, data.orbits)
@ -164,7 +163,7 @@ function addconstraints!(m::JuMP.Model,
return m
end
function reconstruct(Ps::Vector{Matrix{F}}, data::OrbitData) where F
function reconstruct(Ps::Vector{Matrix{F}}, data::BlockDecomposition) where F
return reconstruct(Ps, data.preps, data.Uπs, data.dims)
end
@ -205,22 +204,29 @@ end
#
###############################################################################
function setwarmstart_scs!(m::JuMP.Model, warmstart)
solver_name(m) == "SCS" || throw("warmstarting defined only for SCS!")
primal, dual, slack = warmstart
m.moi_backend.optimizer.model.optimizer.sol.primal = primal
m.moi_backend.optimizer.model.optimizer.sol.dual = dual
m.moi_backend.optimizer.model.optimizer.sol.slack = slack
function setwarmstart!(m::JuMP.Model, warmstart)
if solver_name(m) == "SCS"
primal, dual, slack = warmstart
m.moi_backend.optimizer.model.optimizer.data.primal = primal
m.moi_backend.optimizer.model.optimizer.data.dual = dual
m.moi_backend.optimizer.model.optimizer.data.slack = slack
else
@warn "Setting warmstart for $(solver_name(m)) is not implemented! Ignoring..."
end
return m
end
function getwarmstart_scs(m::JuMP.Model)
solver_name(m) == "SCS" || return (primal=Float64[], dual=Float64[], slack=Float64[])
warmstart = (
primal = m.moi_backend.optimizer.model.optimizer.sol.primal,
dual = m.moi_backend.optimizer.model.optimizer.sol.dual,
slack = m.moi_backend.optimizer.model.optimizer.sol.slack
)
function getwarmstart(m::JuMP.Model)
if solver_name(m) == "SCS"
warmstart = (
primal = m.moi_backend.optimizer.model.optimizer.data.primal,
dual = m.moi_backend.optimizer.model.optimizer.data.dual,
slack = m.moi_backend.optimizer.model.optimizer.data.slack
)
else
@warn "Saving warmstart for $(solver_name(m)) is not implemented!"
return (primal=Float64[], dual=Float64[], slack=Float64[])
end
return warmstart
end
@ -230,7 +236,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
MOIU.attach_optimizer(m)
if warmstart != nothing
setwarmstart_scs!(m, warmstart)
setwarmstart!(m, warmstart)
end
optimize!(m)
@ -238,7 +244,7 @@ function solve(m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=n
status = termination_status(m)
return status, getwarmstart_scs(m)
return status, getwarmstart(m)
end
function solve(solverlog::String, m::JuMP.Model, with_optimizer::JuMP.OptimizerFactory, warmstart=nothing)

View File

@ -19,7 +19,7 @@ function Sq(RG::GroupRing, N::Integer)
sq = RG()
for σ in Alt_N
GroupRings.addeq!(sq, *(σ(Δ₂), σ(Δ₂), false))
GroupRings.addeq!(sq, *(Δ₂^σ, Δ₂^σ, false))
end
return sq÷factorial(N-2)
end
@ -30,7 +30,7 @@ function Adj(RG::GroupRing, N::Integer)
Δ₂ = length(S₂)*one(RG, ) - RG(S₂, );
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
Δ₂s = Dict(σ=>σ(Δ₂) for σ in Alt_N)
Δ₂s = Dict(σ=>Δ₂^σ for σ in Alt_N)
adj = RG()
for σ in Alt_N
@ -52,7 +52,7 @@ function Op(RG::GroupRing, N::Integer)
Δ₂ = length(S₂)*one(RG, ) - RG(S₂, );
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
Δ₂s = Dict(σ=>σ(Δ₂) for σ in Alt_N)
Δ₂s = Dict(σ=>Δ₂^σ for σ in Alt_N)
op = RG()
for σ in Alt_N
@ -80,7 +80,7 @@ function SqAdjOp(RG::GroupRing, N::Integer)
Alt_N = [σ for σ in SymmetricGroup(N) if parity(σ) == 0]
sq, adj, op = RG(), RG(), RG()
Δ₂s = Dict(σ=>σ(Δ₂) for σ in Alt_N)
Δ₂s = Dict(σ=>Δ₂^σ for σ in Alt_N)
for σ in Alt_N
GroupRings.addeq!(sq, *(Δ₂s[σ], Δ₂s[σ], false))

View File

@ -57,7 +57,7 @@
NAME = "SL($N,Z)_orbit"
rm(NAME, recursive=true, force=true)
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(2000, accel=20);
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(1000, accel=20);
upper_bound=1.3, force_compute=false)
@info sett
@ -70,18 +70,18 @@
@test λ == PropertyT.spectral_gap(sett)
@test PropertyT.check_property_T(sett) == false
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(15000, accel=20, warm_start=true);
sett = PropertyT.Settings(NAME, G, S, autS, with_SCS(7000, accel=20, warm_start=true);
upper_bound=1.3, force_compute=true)
@info sett
λ = PropertyT.spectral_gap(sett)
@time λ = PropertyT.spectral_gap(sett)
@test λ > 1.2999
@test PropertyT.interpret_results(sett, λ) == true
# this should be very fast due to warmstarting:
@test λ PropertyT.spectral_gap(sett) atol=1e-5
@test PropertyT.check_property_T(sett) == true
@time @test λ PropertyT.spectral_gap(sett) atol=1e-5
@time @test PropertyT.check_property_T(sett) == true
end
@testset "SAut(F₃)" begin

View File

@ -100,7 +100,7 @@ end
end
function check_positivity(elt, Δ, orbit_data, upper_bound, warm=nothing; with_solver=with_SCS(20_000, accel=10))
SDP_problem, varP = PropertyT.SOS_problem(elt, Δ, orbit_data; upper_bound=upper_bound)
SDP_problem, varP = PropertyT.SOS_problem_primal(elt, Δ, orbit_data; upper_bound=upper_bound)
status, warm = PropertyT.solve(SDP_problem, with_solver, warm);
Base.Libc.flush_cstdio()
@ -123,7 +123,7 @@ end
S = PropertyT.generating_set(M)
Δ = PropertyT.Laplacian(S, halfradius)
RG = parent(Δ)
orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.decimate(orbit_data);
@testset "Sq₃ is SOS" begin
@ -170,7 +170,7 @@ end
S = PropertyT.generating_set(M)
Δ = PropertyT.Laplacian(S, halfradius)
RG = parent(Δ)
orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.decimate(orbit_data);
@testset "Sq₄ is SOS" begin
@ -228,7 +228,7 @@ end
# S = PropertyT.generating_set(M)
# Δ = PropertyT.Laplacian(S, halfradius)
# RG = parent(Δ)
# orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
# orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
# orbit_data = PropertyT.decimate(orbit_data);
#
# @time elt = PropertyT.Adj(RG) + 100PropertyT.Op(RG)

View File

@ -15,7 +15,7 @@
halfradius = 2
M = MatrixAlgebra(zz, N)
S = PropertyT.generating_set(M)
E_R, sizes = Groups.generate_balls(S, one(M), radius=2halfradius);
E_R, sizes = Groups.wlmetric_ball(S, one(M), radius=2halfradius);
rdict = GroupRings.reverse_dict(E_R)
pm = GroupRings.create_pm(E_R, rdict, sizes[halfradius]; twisted=false);
@ -31,14 +31,14 @@
y = 2RG(elt2) - RG(elt)
for G in [SymmetricGroup(N), WreathProduct(SymmetricGroup(2), SymmetricGroup(N))]
@test all(g(one(M)) == one(M) for g in G)
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
@test all(one(M)^g == one(M) for g in G)
@test all(rdict[m^g] <= sizes[1] for g in G for m in S)
@test all(m^g*n^g == (m*n)^g for g in G for m in S for n in S)
@test all(g(Δ) == Δ for g in G)
@test all(g(x) == RG(1) - RG(g(elt)) for g in G)
@test all(Δ^g == Δ for g in G)
@test all(x^g == RG(1) - RG(elt^g) for g in G)
@test all(2RG(g(elt2)) - RG(g(elt)) == g(y) for g in G)
@test all(2RG(elt2^g) - RG(elt^g) == y^g for g in G)
end
end
@ -47,9 +47,9 @@
Sij = ssgs(M, i,j)
Δij= PropertyT.spLaplacian(RG, Sij)
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
@test all(Δij^p == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
@test all(Δij^g == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
end
end
end
@ -59,7 +59,7 @@ end
halfradius = 2
M = SAut(FreeGroup(N))
S = PropertyT.generating_set(M)
E_R, sizes = Groups.generate_balls(S, one(M), radius=2halfradius);
E_R, sizes = Groups.wlmetric_ball(S, one(M), radius=2halfradius);
rdict = GroupRings.reverse_dict(E_R)
pm = GroupRings.create_pm(E_R, rdict, sizes[halfradius]; twisted=false);
@ -77,14 +77,14 @@ end
y = 2RG(elt2) - RG(elt)
for G in [SymmetricGroup(N), WreathProduct(SymmetricGroup(2), SymmetricGroup(N))]
@test all(g(one(M)) == one(M) for g in G)
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
@test all(one(M)^g == one(M) for g in G)
@test all(rdict[m^g] <= sizes[1] for g in G for m in S)
@test all(m^g*n^g == (m*n)^g for g in G for m in S for n in S)
@test all(g(Δ) == Δ for g in G)
@test all(g(x) == RG(1) - RG(g(elt)) for g in G)
@test all(Δ^g == Δ for g in G)
@test all(x^g == RG(1) - RG(elt^g) for g in G)
@test all(2RG(g(elt2)) - RG(g(elt)) == g(y) for g in G)
@test all(2RG(elt2^g) - RG(elt^g) == y^g for g in G)
end
end
@ -92,9 +92,9 @@ end
Sij = ssgs(M, i,j)
Δij= PropertyT.spLaplacian(RG, Sij)
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
@test all(Δij^p == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
@test all(Δij^g == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
end
end

View File

@ -6,9 +6,9 @@ using JLD
using JuMP, SCS
with_SCS(iters; accel=1, eps=1e-10, warm_start=true) =
with_SCS(iters; accel=0, eps=1e-10, warm_start=true) =
with_optimizer(SCS.Optimizer,
linear_solver=SCS.Direct, max_iters=iters,
linear_solver=SCS.DirectSolver, max_iters=iters,
acceleration_lookback=accel, eps=eps, warm_start=warm_start)
include("1703.09680.jl")