Skip to content

Commit 100fcb9

Browse files
committed
add sampling interface
1 parent f1ec67d commit 100fcb9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Solus.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ An uncertainty quantification problem.
1313
1414
$(DocStringExtensions.FIELDS)
1515
"""
16-
struct SolusProblem{P<:MvNormal,M,O,S<:HilbertSpace}
16+
struct SolusProblem{P,M,O,S<:HilbertSpace}
1717
"""
1818
The prior distribution for the parameters ``θ``. Currently only `MvNormal` objects are supported.
1919
"""
@@ -36,6 +36,15 @@ struct SolusProblem{P<:MvNormal,M,O,S<:HilbertSpace}
3636
end
3737
SolusProblem(prior, forwardmodel, obs) = SolusProblem(prior, forwardmodel, obs, DefaultSpace())
3838

39+
struct FlatPrior
40+
end
41+
42+
Distributions.logpdf(::FlatPrior, x) = 0.0
43+
44+
function neglogposteriordensity(s::SolusProblem, θ)
45+
-logpdf(s.prior, θ) + norm(s.forwardmodel(θ) - s.obs, s.space)
46+
end
47+
3948

4049
"""
4150
Ensemble

0 commit comments

Comments
 (0)