From 4f0b970febf569892a32dfb3d76407e1df8a6c6a Mon Sep 17 00:00:00 2001 From: Markus Hauru Date: Wed, 8 Jan 2025 10:18:52 +0000 Subject: [PATCH] Modify type signature of Gibbs --- src/mcmc/gibbs.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mcmc/gibbs.jl b/src/mcmc/gibbs.jl index 52971e08d..ada5f611b 100644 --- a/src/mcmc/gibbs.jl +++ b/src/mcmc/gibbs.jl @@ -322,8 +322,10 @@ Currently only variable names without indexing are supported, so for instance # Fields $(TYPEDFIELDS) """ -struct Gibbs{V<:AbstractVector{<:AbstractVector{<:VarName}},A<:AbstractVector} <: +struct Gibbs{N,V<:NTuple{N,AbstractVector{<:VarName}},A<:NTuple{N,Any}} <: InferenceAlgorithm + # TODO(mhauru) Revisit whether A should have a fixed element type once + # InferenceAlgorithm/Sampler types have been cleaned up. "varnames representing variables for each sampler" varnames::V "samplers for each entry in `varnames`" @@ -343,9 +345,9 @@ struct Gibbs{V<:AbstractVector{<:AbstractVector{<:VarName}},A<:AbstractVector} < # Ensure that samplers have the same selector, and that varnames are lists of # VarNames. - samplers = map(set_selector ∘ drop_space, samplers) - varnames = map(to_varname_list, varnames) - return new{typeof(varnames),typeof(samplers)}(varnames, samplers) + samplers = tuple(map(set_selector ∘ drop_space, samplers)...) + varnames = tuple(map(to_varname_list, varnames)...) + return new{length(samplers),typeof(varnames),typeof(samplers)}(varnames, samplers) end end