Skip to content

Commit 69ccf50

Browse files
author
Miha Zgubic
committed
Revert "Revert "Add rand_tangent for types (#172)""
This reverts commit 65ab55c.
1 parent 65ab55c commit 69ccf50

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Diff for: Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FiniteDifferences"
22
uuid = "26cc04aa-876d-5657-8c51-4c34ba976000"
3-
version = "0.12.11"
3+
version = "0.12.12"
44

55
[deps]
66
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

Diff for: src/rand_tangent.jl

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ function rand_tangent(rng::AbstractRNG, x::T) where {T}
5757
Tangent{T}(; NamedTuple{field_names}(tangents)...)
5858
end
5959
end
60+
61+
rand_tangent(rng::AbstractRNG, ::Type) = NoTangent()
62+
rand_tangent(rng::AbstractRNG, ::Module) = NoTangent()

Diff for: test/rand_tangent.jl

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ using FiniteDifferences: rand_tangent
1111
(:a, NoTangent),
1212
(true, NoTangent),
1313
(4, NoTangent),
14+
(FiniteDifferences, NoTangent), # Module object
15+
# Types (not instances of type)
16+
(Foo, NoTangent),
17+
(Union{Int, Foo}, NoTangent),
18+
(Union{Int, Foo}, NoTangent),
19+
(Vector, NoTangent),
20+
(Vector{Float64}, NoTangent),
21+
(Integer, NoTangent),
22+
(Type{<:Real}, NoTangent),
1423

1524
# Numbers.
1625
(5.0, Float64),

0 commit comments

Comments
 (0)