diff --git a/Project.toml b/Project.toml index f35b1df4..41e11f26 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AdvancedHMC" uuid = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d" -version = "0.6.3" +version = "0.6.4" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" diff --git a/src/hamiltonian.jl b/src/hamiltonian.jl index b5546051..f8f2ab32 100644 --- a/src/hamiltonian.jl +++ b/src/hamiltonian.jl @@ -108,6 +108,10 @@ Base.isfinite(v::DualValue) = all(isfinite, v.value) && all(isfinite, v.gradient Base.isfinite(v::AbstractVecOrMat) = all(isfinite, v) Base.isfinite(z::PhasePoint) = isfinite(z.ℓπ) && isfinite(z.ℓκ) +Base.isnan(v::DualValue) = any(isnan, v.value) || any(isnan, v.gradient) +Base.isnan(v::AbstractVecOrMat) = any(isnan, v) +Base.isnan(z::PhasePoint) = isnan(z.ℓπ) || isnan(z.ℓκ) + ### ### Negative energy (or log probability) functions. ### NOTE: the general form (i.e. non-Euclidean) of K depends on both θ and r.