From 341eda67604fa655ea3c9fa19d44f91956d0f05f Mon Sep 17 00:00:00 2001 From: szcf-weiya Date: Sat, 15 Jan 2022 12:24:37 +0800 Subject: [PATCH 1/2] allow matrix as input for bivariate kde --- src/interp.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/interp.jl b/src/interp.jl index 05e648e6..d79bc2c3 100644 --- a/src/interp.jl +++ b/src/interp.jl @@ -30,3 +30,5 @@ pdf(ik::InterpKDE,xs::AbstractVector,ys::AbstractVector) = [ik.itp(x,y) for x in pdf(k::UnivariateKDE,x) = pdf(InterpKDE(k),x) pdf(k::BivariateKDE,x,y) = pdf(InterpKDE(k),x,y) +pdf(k::BivariateKDE,x::AbstractMatrix) = pdf(InterpKDE(k),x[:,1],x[:,2]) + From a77c049d57b9a8a2ed67ff1bd351f20bd0469d33 Mon Sep 17 00:00:00 2001 From: szcf-weiya Date: Sat, 15 Jan 2022 19:44:44 +0800 Subject: [PATCH 2/2] evaluate pdf at each point instead of a grid --- src/interp.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interp.jl b/src/interp.jl index d79bc2c3..04ea8a2f 100644 --- a/src/interp.jl +++ b/src/interp.jl @@ -30,5 +30,5 @@ pdf(ik::InterpKDE,xs::AbstractVector,ys::AbstractVector) = [ik.itp(x,y) for x in pdf(k::UnivariateKDE,x) = pdf(InterpKDE(k),x) pdf(k::BivariateKDE,x,y) = pdf(InterpKDE(k),x,y) -pdf(k::BivariateKDE,x::AbstractMatrix) = pdf(InterpKDE(k),x[:,1],x[:,2]) +pdf(k::BivariateKDE,x::AbstractMatrix) = [ik.itp(z[1], z[2]) for z in eachrow(x)]