Skip to content

Commit 96b1abd

Browse files
author
Miha Zgubic
committed
Revert "Revert "Add rand_tangent for types (#172)""
This reverts commit 61a83ed.
1 parent 61a83ed commit 96b1abd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/rand_tangent.jl

Lines changed: 3 additions & 0 deletions
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()

test/rand_tangent.jl

Lines changed: 9 additions & 0 deletions
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)