Skip to content

Commit

Permalink
Add to_vec(::Thunk) (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzgubic authored Jun 9, 2021
1 parent 2b3efc3 commit e0b3621
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
env:
JULIA_PKG_SERVER: ""
- run: |
julia --project=docs -e '
using Documenter: doctest
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FiniteDifferences"
uuid = "26cc04aa-876d-5657-8c51-4c34ba976000"
version = "0.12.12"
version = "0.12.13"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand All @@ -11,7 +11,7 @@ Richardson = "708f8203-808e-40c0-ba2d-98a6953ed40d"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
ChainRulesCore = "0.9.44, 0.10"
ChainRulesCore = "0.10.3"
Richardson = "1.2"
StaticArrays = "0.12, 1.0"
julia = "1"
Expand Down
16 changes: 8 additions & 8 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[ChainRulesCore]]
deps = ["Compat", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "b391f22252b8754f4440de1f37ece49d8a7314bb"
git-tree-sha1 = "8b31cc69cbc38c5c826aaa1c890c694be3622d99"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "0.9.44"
version = "0.10.3"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
Expand All @@ -34,10 +34,10 @@ deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "9d4f64f79012636741cf01133158a54b24924c32"
deps = ["LibGit2"]
git-tree-sha1 = "a32185f5428d3986f47c2ab78b1f216d5e6cc96f"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.4"
version = "0.8.5"

[[Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
Expand All @@ -53,7 +53,7 @@ uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
deps = ["ChainRulesCore", "LinearAlgebra", "Printf", "Random", "Richardson", "StaticArrays"]
path = ".."
uuid = "26cc04aa-876d-5657-8c51-4c34ba976000"
version = "0.12.7"
version = "0.12.13"

[[IOCapture]]
deps = ["Logging"]
Expand Down Expand Up @@ -161,9 +161,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "c635017268fd51ed944ec429bcc4ad010bcea900"
git-tree-sha1 = "42378d3bab8b4f57aa1ca443821b752850592668"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.2.0"
version = "1.2.2"

[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
Expand Down
6 changes: 6 additions & 0 deletions src/to_vec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,9 @@ function FiniteDifferences.to_vec(x::AbstractZero)
end
return Bool[], AbstractZero_from_vec
end

function FiniteDifferences.to_vec(t::Thunk)
v, back = to_vec(unthunk(t))
Thunk_from_vec = v -> @thunk(back(v))
return v, Thunk_from_vec
end
4 changes: 4 additions & 0 deletions test/to_vec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ end
test_to_vec(ZeroTangent())
test_to_vec(NoTangent())
end

@testset "Thunks" begin
test_to_vec(@thunk(3.2+4.3))
end
end

@testset "FillVector" begin
Expand Down

2 comments on commit e0b3621

@mzgubic
Copy link
Member Author

@mzgubic mzgubic commented on e0b3621 Jun 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/38513

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.13 -m "<description of version>" e0b362177228cc6baf45916fa43504afcd1be625
git push origin v0.12.13

Please sign in to comment.