From 247aace459d74f74537cc7a13b31e987e1683002 Mon Sep 17 00:00:00 2001 From: mohamed82008 Date: Wed, 16 Jan 2019 08:25:35 +1100 Subject: [PATCH] add debugging info to clamp --- src/Bijectors.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Bijectors.jl b/src/Bijectors.jl index 9bb02fc8..d9e54401 100644 --- a/src/Bijectors.jl +++ b/src/Bijectors.jl @@ -61,7 +61,10 @@ end const TransformDistribution{T<:ContinuousUnivariateDistribution} = Union{T, Truncated{T}} @inline function _clamp(x::Real, dist::TransformDistribution) - return clamp(x, minimum(dist), maximum(dist)) + bounds = (minimum(dist), maximum(dist)) + clamped_x = clamp(x, bounds...) + @debug "x = $x, bounds = $bounds, clamped_x = $clamped_x" + return clamped_x end link(d::TransformDistribution, x::Real) = _link(d, _clamp(x, d)) @@ -149,7 +152,10 @@ end const SimplexDistribution = Union{Dirichlet} @inline function _clamp(x::T, dist::SimplexDistribution) where T - return clamp(x, zero(T), one(T)) + bounds = (zero(T), one(T)) + clamped_x = clamp(x, bounds...) + @debug "x = $x, bounds = $bounds, clamped_x = $clamped_x" + return clamped_x end function link(