Skip to content

Commit 15d0cbc

Browse files
committed
rem mutable + add Ref(x)
1 parent 93437e0 commit 15d0cbc

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
examples/.ipynb_checkpoints/*
2-
Manifest.toml
2+
Manifest.toml
3+
.vscode/settings.json
4+
tmp.jl

src/KernelDensity.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export kde, kde_lscv, UnivariateKDE, BivariateKDE, InterpKDE, pdf
1212

1313
abstract type AbstractKDE end
1414

15+
Base.broadcastable(x::AbstractKDE) = Ref(x)
16+
1517
include("univariate.jl")
1618
include("bivariate.jl")
1719
include("interp.jl")

src/interp.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import Interpolations: interpolate, scale
22

3-
mutable struct InterpKDE{K,I} <: AbstractKDE
3+
struct InterpKDE{K,I} <: AbstractKDE
44
kde::K
55
itp::I
66
InterpKDE{K,I}(kde::K, itp::I) where {K,I} = new{K,I}(kde, itp)
77
end
88

9-
109
function InterpKDE(kde::UnivariateKDE, opts...)
1110
itp_u = interpolate(kde.density, opts...)
1211
itp = scale(itp_u, kde.x)

src/univariate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sum(density) * step(x) ≈ 1
1313
1414
$(FIELDS)
1515
"""
16-
mutable struct UnivariateKDE{R<:AbstractRange} <: AbstractKDE
16+
struct UnivariateKDE{R<:AbstractRange} <: AbstractKDE
1717
"Gridpoints for evaluating the density."
1818
x::R
1919
"Kernel density at corresponding gridpoints `x`."

0 commit comments

Comments
 (0)