Skip to content

Commit

Permalink
fix bug in univariate sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Aug 11, 2024
1 parent ee338f5 commit 4a245a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ function AbstractMCMC.step(rng ::Random.AbstractRNG,
return t, UnivariateSliceState(t)
end

struct UnivariateTarget{Model}
model::Model
end

function LogDensityProblems.logdensity(uni::UnivariateTarget, θi)
LogDensityProblems.logdensity(uni.model, [θi])
end

function AbstractMCMC.step(
rng ::Random.AbstractRNG,
model ::AbstractMCMC.LogDensityModel,
Expand Down
2 changes: 1 addition & 1 deletion test/multivariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function LogDensityProblems.dimension(model::MultiModel)
2
end

@testset "sampling" begin
@testset "multivariate sampling" begin
model = MultiModel(1., 1., [0.])
@testset for sampler in [
# Vector-valued windows
Expand Down
2 changes: 1 addition & 1 deletion test/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function LogDensityProblems.dimension(model::UniModel)
1
end

@testset "sampling" begin
@testset "multivariate sampling" begin
model = UniModel([0.])
@testset for sampler in [
Slice(1),
Expand Down

0 comments on commit 4a245a5

Please sign in to comment.