Skip to content

Commit b87a4bc

Browse files
authored
Merge pull request #72 from tpapp/tp/document-slots
Document that slots can be accessed as part of the API.
2 parents 51bdb83 + ad64440 commit b87a4bc

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ version = "0.5.1"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
8+
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
89
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
910
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
1011
Optim = "429524aa-4258-5aef-a3af-852621145aeb"

src/KernelDensity.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module KernelDensity
22

3+
using DocStringExtensions: TYPEDEF, FIELDS
34
using StatsBase
45
using Distributions
56
using Optim

src/bivariate.jl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
# Store both grid and density for KDE over R2
1+
"""
2+
$(TYPEDEF)
3+
4+
Store both grid and density for KDE over the real line.
5+
6+
Reading the fields directly is part of the API, and
7+
8+
```julia
9+
sum(density) * step(x) * step(y) ≈ 1
10+
```
11+
12+
# Fields
13+
14+
$(FIELDS)
15+
"""
216
mutable struct BivariateKDE{Rx<:AbstractRange,Ry<:AbstractRange} <: AbstractKDE
17+
"First coordinate of gridpoints for evaluating the density."
318
x::Rx
19+
"Second coordinate of gridpoints for evaluating the density."
420
y::Ry
21+
"Kernel density at corresponding gridpoints `Tuple.(x, permutedims(y))`."
522
density::Matrix{Float64}
623
end
724

src/univariate.jl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
# Store both grid and density for KDE over the real line
1+
"""
2+
$(TYPEDEF)
3+
4+
Store both grid and density for KDE over ``ℝ²``.
5+
6+
Reading the fields directly is part of the API, and
7+
8+
```julia
9+
sum(density) * step(x) ≈ 1
10+
```
11+
12+
# Fields
13+
14+
$(FIELDS)
15+
"""
216
mutable struct UnivariateKDE{R<:AbstractRange} <: AbstractKDE
17+
"Gridpoints for evaluating the density."
318
x::R
19+
"Kernel density at corresponding gridpoints `x`."
420
density::Vector{Float64}
521
end
622

0 commit comments

Comments
 (0)