From fbd84e82199572186ea6e2d8ef06c4d94c3d1b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sat, 15 May 2021 00:04:32 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: David Widmann --- src/pdfnorm.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdfnorm.jl b/src/pdfnorm.jl index 2fca711fba..28abcabfd2 100644 --- a/src/pdfnorm.jl +++ b/src/pdfnorm.jl @@ -4,7 +4,7 @@ Return the square of the L2 norm of the probability density function ``f(x)`` of the distribution `d`: ```math -\\big(\\int_{S} f(x)^{2} \\mathrm{d} x \\big)^{1/2} +\\int_{S} f(x)^{2} \\mathrm{d} x ``` where ``S`` is the support of ``f(x)``. @@ -36,7 +36,7 @@ end pdfsquaredL2norm(d::Exponential) = 1 / (2 * d.θ) -function pdfsquaredL2norm(d::Gamma{T}) where {T} +function pdfsquaredL2norm(d::Gamma) α, θ = params(d) z = (2^(1 - 2 * α) * gamma(2 * α - 1)) / (gamma(α) ^ 2 * θ) # L2 norm of the pdf converges only for α > 0.5