Skip to content

Commit 8d17caa

Browse files
committed
Add ForwardDiff extension
1 parent 3c8c393 commit 8d17caa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ Tricks = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
3030

3131
[weakdeps]
3232
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
33+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
3334

3435
[extensions]
3536
MeasureBaseChainRulesCoreExt = "ChainRulesCore"
37+
MeasureBaseForwardDiffExt = "ForwardDiff"
3638

3739
[compat]
3840
ChainRulesCore = "1"
@@ -41,6 +43,7 @@ Compat = "3.35, 4"
4143
ConstructionBase = "1.3"
4244
DensityInterface = "0.4"
4345
FillArrays = "0.12, 0.13, 1"
46+
ForwardDiff = "0.8, 0.9, 0.10"
4447
FunctionChains = "0.1"
4548
IfElse = "0.1"
4649
IntervalSets = "0.7"

ext/MeasureBaseForwardDiffExt.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is a part of MeasureBase.jl, licensed under the MIT License (MIT).
2+
3+
module MeasureBaseForwardDiffExt
4+
5+
using MeasureBase
6+
import ForwardDiff
7+
8+
function MeasureBase.containsnan(x::ForwardDiff.Dual)
9+
a = containsnan(x.value)
10+
b = containsnan(x.partials)
11+
return a || b
12+
end
13+
14+
end # module MeasureBaseForwardDiffExt

0 commit comments

Comments
 (0)