Skip to content

Commit e10d21d

Browse files
committed
Update documentation of the interface
1 parent 5eada1a commit e10d21d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ use a custom distribution type `GaussianPrior`, the following methods should be
5656
implemented:
5757
```julia
5858
# state that the distribution is actually Gaussian
59-
EllipticalSliceSampling.isnormal(::GaussianPrior) = true
59+
EllipticalSliceSampling.isnormal(::Type{<:GaussianPrior}) = true
60+
61+
# define the mean of the distribution
62+
Statistics.mean(dist::GaussianPrior) = ...
6063

6164
# define how to sample from the distribution
6265
# only one of the following methods is needed:
@@ -68,6 +71,9 @@ Base.rand!(rng::AbstractRNG, dist::GaussianPrior, sample) = ...
6871

6972
# specify the type of a sample from the distribution
7073
Base.eltype(::Type{<:GaussianPrior}) = ...
74+
75+
# in the case of mutable samples, specify the array size of the samples
76+
Base.size(dist::GaussianPrior) = ...
7177
```
7278

7379
### Log likelihood

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct Model{P,L}
88
loglikelihood::L
99

1010
function Model{P,L}(prior::P, loglikelihood::L) where {P,L}
11-
isnormal(prior) ||
11+
isnormal(P) ||
1212
error("prior distribution has to be a normal distribution")
1313

1414
new{P,L}(prior, loglikelihood)

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ end
2121
Test whether a distribution is normal.
2222
"""
2323
isnormal(dist) = false
24-
isnormal(::Normal) = true
25-
isnormal(::AbstractMvNormal) = true
24+
isnormal(::Type{<:Normal}) = true
25+
isnormal(::Type{<:AbstractMvNormal}) = true

0 commit comments

Comments
 (0)