Skip to content

Commit

Permalink
rem Compat, eachslice to maplices + reshape
Browse files Browse the repository at this point in the history
  • Loading branch information
jaksle committed Mar 11, 2024
1 parent 60db7b0 commit 8b0126c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ authors = ["Simon Byrne and various contributors"]
version = "0.6.8"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Expand All @@ -18,7 +17,6 @@ FFTW = "1"
Interpolations = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15"
StatsBase = "0.33, 0.34"
julia = "1"
Compat = "2.2.0, 4"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
3 changes: 1 addition & 2 deletions src/interp.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Compat: eachslice
import Interpolations: interpolate, scale


Expand Down Expand Up @@ -32,7 +31,7 @@ InterpKDE(kde::BivariateKDE) = InterpKDE(kde::BivariateKDE, BSpline(Quadratic(Li
# any dimension
pdf(ik::InterpKDE,x::Real...) = ik.itp(x...)
pdf(ik::InterpKDE, V::AbstractVector) = ik.itp(V...)
pdf(ik::InterpKDE, M::AbstractArray{<:Real, N}) where N = pdf.(ik,eachslice(M, dims=ntuple(i->i+1, N-1)) )
pdf(ik::InterpKDE, M::AbstractArray{<:Real, N}) where N = reshape(mapslices(v->pdf(ik, v), M, dims = 1), size(M)[2:end])

# 1 dimension
pdf(k::UnivariateKDE,x) = pdf(InterpKDE(k),x)
Expand Down

0 comments on commit 8b0126c

Please sign in to comment.