From 9afa6afdbe05d0160fdbc2c8398efd09fc7abd55 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Mon, 16 May 2022 16:55:09 +0200 Subject: [PATCH] Update CI (#18) * Update CI.yml * Update Docs.yml * Update JuliaNightly.yml * Simplify docs and remove Manifest file * Update sinkhorn2 doctest * Actually fix doctest * Use example from POT documentation * Actually use example * Update lib.jl * Update lib.jl * Revert example --- .github/workflows/CI.yml | 11 ++- .github/workflows/Docs.yml | 15 ++-- .github/workflows/JuliaNightly.yml | 9 ++- .gitignore | 3 +- docs/Manifest.toml | 123 ----------------------------- src/lib.jl | 13 ++- 6 files changed, 27 insertions(+), 147 deletions(-) delete mode 100644 docs/Manifest.toml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 89ec53f..cd8e511 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,6 +6,12 @@ on: - main pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ (matrix.python && 'system Python') || 'conda' }} @@ -38,9 +44,6 @@ jobs: python-version: '3.x' architecture: ${{ matrix.arch }} if: matrix.python - # Limitation of pip: https://pythonot.github.io/index.html#pip-installation - - run: python -m pip install cython numpy - if: matrix.python - run: python -m pip install pot if: matrix.python - uses: julia-actions/setup-julia@v1 @@ -67,7 +70,7 @@ jobs: PYTHON: ${{ matrix.python }} - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v2 if: matrix.coverage with: file: lcov.info diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml index de026fa..47d567f 100644 --- a/.github/workflows/Docs.yml +++ b/.github/workflows/Docs.yml @@ -7,6 +7,12 @@ on: tags: '*' pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: docs: name: Documentation @@ -16,14 +22,7 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' - - run: | - julia --project=docs -e ' - using Pkg - Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate()' - env: - PYTHON: '' - - run: julia --project=docs docs/make.jl + - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/JuliaNightly.yml b/.github/workflows/JuliaNightly.yml index 1879a04..24677c2 100644 --- a/.github/workflows/JuliaNightly.yml +++ b/.github/workflows/JuliaNightly.yml @@ -9,6 +9,12 @@ on: - main pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ (matrix.python && 'system Python') || 'conda' }} @@ -35,9 +41,6 @@ jobs: python-version: '3.x' architecture: ${{ matrix.arch }} if: matrix.python - # Limitation of pip: https://pythonot.github.io/index.html#pip-installation - - run: python -m pip install cython numpy - if: matrix.python - run: python -m pip install pot if: matrix.python - uses: julia-actions/setup-julia@v1 diff --git a/.gitignore b/.gitignore index 5d2e5b9..1c02e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.jl.*.cov *.jl.cov *.jl.mem -/Manifest.toml -/test/Manifest.toml +Manifest.toml /docs/build/ diff --git a/docs/Manifest.toml b/docs/Manifest.toml deleted file mode 100644 index bb59c6c..0000000 --- a/docs/Manifest.toml +++ /dev/null @@ -1,123 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -[[Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[Conda]] -deps = ["JSON", "VersionParsing"] -git-tree-sha1 = "299304989a5e6473d985212c28928899c74e9421" -uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d" -version = "1.5.2" - -[[Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[DocStringExtensions]] -deps = ["LibGit2"] -git-tree-sha1 = "a32185f5428d3986f47c2ab78b1f216d5e6cc96f" -uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.8.5" - -[[Documenter]] -deps = ["Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"] -git-tree-sha1 = "5acbebf1be22db43589bc5aa1bb5fcc378b17780" -uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "0.27.0" - -[[IOCapture]] -deps = ["Logging"] -git-tree-sha1 = "1868e4e7ad2f93d8de0904d89368c527b46aa6a1" -uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" -version = "0.2.1" - -[[InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[JSON]] -deps = ["Dates", "Mmap", "Parsers", "Unicode"] -git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4" -uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.21.1" - -[[LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] -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" - -[[MacroTools]] -deps = ["Markdown", "Random"] -git-tree-sha1 = "6a8a2a625ab0dea913aba95c11370589e0239ff0" -uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.6" - -[[Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[Mmap]] -uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[NetworkOptions]] -uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" - -[[Parsers]] -deps = ["Dates"] -git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "1.1.0" - -[[Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[PyCall]] -deps = ["Conda", "Dates", "Libdl", "LinearAlgebra", "MacroTools", "Serialization", "VersionParsing"] -git-tree-sha1 = "169bb8ea6b1b143c5cf57df6d34d022a7b60c6db" -uuid = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" -version = "1.92.3" - -[[PythonOT]] -deps = ["PyCall"] -path = ".." -uuid = "3c485715-4278-42b2-9b5f-8f00e43c12ef" -version = "0.1.4" - -[[REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[Random]] -deps = ["Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" - -[[Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[VersionParsing]] -git-tree-sha1 = "80229be1f670524750d905f8fc8148e5a8c4537f" -uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" -version = "1.2.0" diff --git a/src/lib.jl b/src/lib.jl index 6e50f7e..0142528 100644 --- a/src/lib.jl +++ b/src/lib.jl @@ -222,9 +222,8 @@ julia> ν = [0.0, 1.0]; julia> C = [0.0 1.0; 2.0 0.0; 0.5 1.5]; -julia> round.(sinkhorn2(μ, ν, C, 0.01); sigdigits=6) -1-element Vector{Float64}: - 0.95 +julia> round(sinkhorn2(μ, ν, C, 0.01); sigdigits=6) +0.95 ``` It is possible to provide multiple target marginals as columns of a matrix. @@ -258,17 +257,17 @@ in the Python Optimal Transport package. Keyword arguments are listed in the doc # Examples ```jldoctest -julia> xsource = [1]; +julia> xsource = [1.0]; -julia> xtarget = [2, 3]; +julia> xtarget = [2.0, 3.0]; julia> ε = 0.01; julia> empirical_sinkhorn_divergence(xsource, xtarget, ε) ≈ - sinkhorn2([1], [0.5, 0.5], [1 4], ε) - + sinkhorn2([1], [0.5, 0.5], [1.0 4.0], ε) - ( sinkhorn2([1], [1], zeros(1, 1), ε) + - sinkhorn2([0.5, 0.5], [0.5, 0.5], [0 1; 1 0], ε) + sinkhorn2([0.5, 0.5], [0.5, 0.5], Float64[0 1; 1 0], ε) ) / 2 true ```