From 4a67b05647cc06c543c5b24558c2ac66a0359e9d Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Tue, 8 Jun 2021 10:38:56 +0100 Subject: [PATCH 1/5] add rand_tangent --- src/rand_tangent.jl | 3 +++ test/rand_tangent.jl | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/rand_tangent.jl b/src/rand_tangent.jl index 930a3c7..96d4b6a 100644 --- a/src/rand_tangent.jl +++ b/src/rand_tangent.jl @@ -57,3 +57,6 @@ function rand_tangent(rng::AbstractRNG, x::T) where {T} Tangent{T}(; NamedTuple{field_names}(tangents)...) end end + +rand_tangent(rng::AbstractRNG, ::Type) = NoTangent() +rand_tangent(rng::AbstractRNG, ::Module) = NoTangent() diff --git a/test/rand_tangent.jl b/test/rand_tangent.jl index f5815e8..61a382a 100644 --- a/test/rand_tangent.jl +++ b/test/rand_tangent.jl @@ -11,6 +11,8 @@ using FiniteDifferences: rand_tangent (:a, NoTangent), (true, NoTangent), (4, NoTangent), + (FiniteDifferences, NoTangent), + (Foo, NoTangent), # Numbers. (5.0, Float64), From 9fb9d3c14ada35419643d8087048bd4edd54b3f5 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Tue, 8 Jun 2021 10:39:13 +0100 Subject: [PATCH 2/5] version bump --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 51354aa..cda4584 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FiniteDifferences" uuid = "26cc04aa-876d-5657-8c51-4c34ba976000" -version = "0.12.11" +version = "0.12.12" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" From fe9737ee3ac1a18baa5729560eef087ebc955eee Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Tue, 8 Jun 2021 10:45:02 +0100 Subject: [PATCH 3/5] remove module (already works) --- src/rand_tangent.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rand_tangent.jl b/src/rand_tangent.jl index 96d4b6a..9ba6709 100644 --- a/src/rand_tangent.jl +++ b/src/rand_tangent.jl @@ -59,4 +59,3 @@ function rand_tangent(rng::AbstractRNG, x::T) where {T} end rand_tangent(rng::AbstractRNG, ::Type) = NoTangent() -rand_tangent(rng::AbstractRNG, ::Module) = NoTangent() From e44ee4cfce41ce7d3fb6f1b9083a60210eece5c2 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Tue, 8 Jun 2021 11:03:29 +0100 Subject: [PATCH 4/5] Revert "remove module (already works)" This reverts commit fe9737ee3ac1a18baa5729560eef087ebc955eee. --- src/rand_tangent.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rand_tangent.jl b/src/rand_tangent.jl index 9ba6709..96d4b6a 100644 --- a/src/rand_tangent.jl +++ b/src/rand_tangent.jl @@ -59,3 +59,4 @@ function rand_tangent(rng::AbstractRNG, x::T) where {T} end rand_tangent(rng::AbstractRNG, ::Type) = NoTangent() +rand_tangent(rng::AbstractRNG, ::Module) = NoTangent() From 62bae26015a401be6cee20fd8333f75ec16ef1e2 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Tue, 8 Jun 2021 13:27:55 +0100 Subject: [PATCH 5/5] Update test/rand_tangent.jl Co-authored-by: Lyndon White --- test/rand_tangent.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/rand_tangent.jl b/test/rand_tangent.jl index 61a382a..a7f861c 100644 --- a/test/rand_tangent.jl +++ b/test/rand_tangent.jl @@ -11,8 +11,15 @@ using FiniteDifferences: rand_tangent (:a, NoTangent), (true, NoTangent), (4, NoTangent), - (FiniteDifferences, NoTangent), - (Foo, NoTangent), + (FiniteDifferences, NoTangent), # Module object + # Types (not instances of type) + (Foo, NoTangent), + (Union{Int, Foo}, NoTangent), + (Union{Int, Foo}, NoTangent), + (Vector, NoTangent), + (Vector{Float64}, NoTangent), + (Integer, NoTangent), + (Type{<:Real}, NoTangent), # Numbers. (5.0, Float64),