Deborah.Miriam.CumulantsBundle

Deborah.Miriam.CumulantsBundle.compute_cumulants_bundleMethod
compute_cumulants_bundle(
    N_bs::Int,
    blk_size::Int,
    method::String,
    V::Int,
    trMi_all_bundle::Vector{Vector{Vector{T}}},
    rw_bundle::ReweightingBundle.ReweightingSolverBundle, 
    jobid::Union{Nothing, String}=nothing;
    rng_pool::Union{Nothing, SeedManager.RNGPool} = nothing,
    idx_all::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_lb::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_bc::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_ul::Union{Nothing, Vector{Vector{Int}}} = nothing
) where T -> (
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Dict{Symbol, Vector{Vector{Int}}}
)

Compute bootstrap estimates of cumulants using multi-ensemble reweighting.

This function computes bootstrap-resampled cumulants (cond, sus, skew, kurt, bind) from multiple estimators, namely: OG (original), P1 (bias-corrected), P2 (weighted blend of LB and P1).

Each trace entry is reweighted by the corresponding weight field w from Deborah.Miriam.ReweightingBundle.ReweightingSolverBundle.

Arguments

  • N_bs::Int: Number of bootstrap resamples.
  • blk_size::Int: Default block size for bootstrap resampling.
  • method::String : Block-bootstrap scheme (case-sensitive):
    • "nonoverlapping" — Nonoverlapping Block Bootstrap (NBB; resample disjoint blocks).
    • "moving" — Moving Block Bootstrap (MBB; resample sliding windows).
    • "circular" — Circular Block Bootstrap (CBB; sliding windows with wrap-around).
  • V::Int: Lattice volume (e.g., $N_S^3 \times N_T$).
  • trMi_all_bundle::Vector{Vector{Vector{T}}}: Trace data bundle; trMi_all_bundle[i][j] is the j-th configuration in solver i.
  • rw_bundle::ReweightingBundle.ReweightingSolverBundle: Solver bundle containing .w fields used for reweighting.
  • jobid::Union{Nothing, String}: Optional logging context.
  • rng_pool::Union{Nothing, SeedManager.RNGPool}: Optional RNG pool for deterministic sampling.
  • idx_all: Optional bootstrap indices for original data.
  • idx_lb: Optional bootstrap indices for labeled set.
  • idx_bc: Optional indices for bias correction set.
  • idx_ul: Optional indices for unlabeled set.

Returns

  • cumulants_OG_bs::Vector{Vector{Float64}}: Bootstrap cumulants from original data.
  • cumulants_P1_bs::Vector{Vector{Float64}}: Cumulants using P1 estimator.
  • cumulants_P2_bs::Vector{Vector{Float64}}: Cumulants using P2 estimator.
  • idx_bundle::Dict{Symbol, Vector{Vector{Int}}}: Dictionary containing the bootstrap indices used.

Notes

  • If idx_* arguments are omitted, new bootstrap indices are generated.
source
Deborah.Miriam.CumulantsBundle.compute_cumulants_bundle_rawMethod
compute_cumulants_bundle_raw(
    N_bs::Int,
    blk_size::Int,
    method::String,
    V::Int,
    trMi_all_bundle::Vector{Vector{Vector{T}}},
    ens_bundle::Ensemble.EnsembleArrayBundle{T},
    ens_idx::Int, 
    jobid::Union{Nothing, String}=nothing;
    rng_pool::Union{Nothing, SeedManager.RNGPool} = nothing,
    idx_all::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_lb::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_bc::Union{Nothing, Vector{Vector{Int}}} = nothing,
    idx_ul::Union{Nothing, Vector{Vector{Int}}} = nothing
) where T -> (
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Dict{Symbol, Vector{Vector{Int}}}
)

Compute bootstrap estimates of cumulants for single ensemble.

This function performs block bootstrap resampling and computes cumulants from structured subsets of trace data – original, labeled, bias-corrected, and unlabeled – extracted from a bundle of ensembles.

Arguments

  • N_bs::Int: Number of bootstrap resamples.
  • blk_size::Int: Default block size for bootstrap resampling.
  • method::String : Block-bootstrap scheme (case-sensitive):
    • "nonoverlapping" — Nonoverlapping Block Bootstrap (NBB; resample disjoint blocks).
    • "moving" — Moving Block Bootstrap (MBB; resample sliding windows).
    • "circular" — Circular Block Bootstrap (CBB; sliding windows with wrap-around).
  • V::Int: Lattice volume (e.g., $N_S^3 \times N_T$).
  • trMi_all_bundle::Vector{Vector{Vector{T}}}: Trace moment inputs; trMi_all_bundle[i][j] holds the j-th configuration of the i-th estimator.
  • ens_bundle::Ensemble.EnsembleArrayBundle{T}: Bundle of ensemble data matching the structure of trMi_all_bundle.
  • ens_idx::Int: Index of the ensemble to process (same across all estimators).
  • jobid::Union{Nothing, String}: Optional logging context.
  • rng_pool::Union{Nothing, SeedManager.RNGPool}: Optional RNG pool for reproducible sampling.
  • idx_all: Optional bootstrap indices for original data.
  • idx_lb: Optional bootstrap indices for labeled set.
  • idx_bc: Optional bootstrap indices for bias correction set.
  • idx_ul: Optional bootstrap indices for unlabeled set.

Returns

  • cumulants_OG_bs::Vector{Vector{Float64}}: Bootstrap samples of cumulants from the original dataset.
  • cumulants_P1_bs::Vector{Vector{Float64}}: Bootstrap samples using the P1 estimator (bias-corrected).
  • cumulants_P2_bs::Vector{Vector{Float64}}: Bootstrap samples using the P2 estimator (weighted LB + P1).
  • idx_bundle::Dict{Symbol, Vector{Vector{Int}}}: Bundle of bootstrap indices actually used for resampling.

Notes

  • If index arguments are omitted, new bootstrap indices are generated and returned via idx_bundle.
source
Deborah.Miriam.CumulantsBundle.compute_moments_bundle_rawMethod
compute_moments_bundle_raw(
    N_bs::Int,
    blk_size::Int,
    method::String,
    trMi_all_bundle::Vector{Vector{Vector{T}}},
    ens_bundle::Ensemble.EnsembleArrayBundle{T},
    ens_idx::Int,
    jobid::Union{Nothing, String}=nothing;
    rng_pool::Union{Nothing, SeedManager.RNGPool} = nothing,
    idx_all::Union{Nothing, Matrix{Int}} = nothing,
    idx_lb ::Union{Nothing, Matrix{Int}} = nothing,
    idx_bc ::Union{Nothing, Matrix{Int}} = nothing,
    idx_ul ::Union{Nothing, Matrix{Int}} = nothing
) where T -> (
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Dict{Symbol, Union{Nothing, Matrix{Int}}}
)

Compute bootstrap estimates of moments $Q_{n} \; (n=1,2,3,4)$ for single ensemble. This mirrors the structure of compute_cumulants_bundle_raw but returns moment components instead of cumulants.

Arguments

  • N_bs::Int: Number of bootstrap resamples.
  • blk_size::Int: Base block size for block bootstrap (per subset will be optimized).
  • method::String: Bootstrap method identifier (e.g., "moving", "stationary").
  • trMi_all_bundle::Vector{Vector{Vector{T}}}: For each array in the bundle, a vector of per-configuration trace vectors (e.g., length-5 trMi rows). Each inner Vector{T} must be consumable by Cumulants.calc_Q.
  • ens_bundle::Ensemble.EnsembleArrayBundle{T}: Bundle containing the ensemble arrays.
  • ens_idx::Int: Index of the target ensemble array inside ens_bundle.
  • jobid: Optional job identifier for logging.
  • rng_pool::Union{Nothing, SeedManager.RNGPool}: Optional RNG pool (with fields rng, rng_lb, rng_bc, rng_ul); if nothing, a new pool is created via Deborah.Sarah.SeedManager.setup_rng_pool.
  • idx_all, idx_lb, idx_bc, idx_ul: Optional bootstrap index plans for the subsets. If provided, they are used; otherwise plans are generated internally.

Returns

  • (moments_OG_bs, moments_P1_bs, moments_P2_bs, idx_bundle) where:
    • moments_OG_bs::Vector{Vector{Float64}} = [Q1_ORG_bs, Q2_ORG_bs, Q3_ORG_bs, Q4_ORG_bs]
    • moments_P1_bs::Vector{Vector{Float64}} = [Q1_P1_bs, Q2_P1_bs, Q3_P1_bs, Q4_P1_bs ]
    • moments_P2_bs::Vector{Vector{Float64}} = [Q1_P2_bs, Q2_P2_bs, Q3_P2_bs, Q4_P2_bs ] Each Qk_*_bs is a length-N_bs vector of bootstrap means.
    • idx_bundle::Dict{Symbol, Union{Nothing, Matrix{Int}}}: :all, :lb, :bc, :ul → the index plans used for each subset (or nothing).

Notes

  • Subset splitting uses Deborah.Miriam.CumulantsBundleUtils.split_Q_full on the tuple (Q1,Q2,Q3,Q4) per array.
  • P1 is constructed analogously to the cumulant pipeline: Y_P1 = (N_tr == N_lb) ? YP_UL : (YP_UL + (Y_BC - YP_BC)), applied component-wise to Q1,Q2,Q3,Q4.
  • P2 is the linear combination: Y_P2 = w_lb * Y_LB + w_ul * Y_P1 with w_lb = N_lb/N_all and w_ul = N_ul/N_all.
  • If a subset is empty by construction (e.g., N_lb == 0), its bootstrap means are set to 0.
source
Deborah.Miriam.CumulantsBundle.compute_traces_bundle_rawMethod
compute_traces_bundle_raw(
    N_bs::Int,
    blk_size::Int,
    method::String,
    trMi_all_bundle::Vector{Vector{Vector{T}}},
    ens_bundle::Ensemble.EnsembleArrayBundle{T},
    ens_idx::Int,
    jobid::Union{Nothing, String}=nothing;
    rng_pool::Union{Nothing, SeedManager.RNGPool} = nothing,
    idx_all::Union{Nothing, Matrix{Int}} = nothing,
    idx_lb ::Union{Nothing, Matrix{Int}} = nothing,
    idx_bc ::Union{Nothing, Matrix{Int}} = nothing,
    idx_ul ::Union{Nothing, Matrix{Int}} = nothing
) where T -> (
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Vector{Vector{Float64}},
    Dict{Symbol, Union{Nothing, Matrix{Int}}}
)

Compute bootstrap estimates of $\text{Tr} \, M^{-n} \; (n=1,2,3,4)$ for single ensemble. This mirrors compute_moments_bundle_raw but returns trace components instead of moments.

Arguments

  • N_bs::Int: Number of bootstrap resamples.
  • blk_size::Int: Base block size for block bootstrap (per subset will be optimized).
  • method::String: Bootstrap method identifier (e.g., "moving", "circular", "nonoverlapping").
  • trMi_all_bundle::Vector{Vector{Vector{T}}}: For each array in the bundle, a vector of per-configuration trace-moment rows (e.g., length-5 trMi). Each inner Vector{T} is processed by Deborah.Miriam.Cumulants.calc_trace to obtain $\text{Tr} \, M^{-n} \; (n=1,2,3,4)$.
  • ens_bundle::Ensemble.EnsembleArrayBundle{T}: Bundle containing the ensemble arrays.
  • ens_idx::Int: Index of the target ensemble array inside ens_bundle.
  • jobid: Optional job identifier for logging.
  • rng_pool::Union{Nothing, SeedManager.RNGPool}: Optional RNG pool (with fields rng, rng_lb, rng_bc, rng_ul); if nothing, a new pool is created via Deborah.Sarah.SeedManager.setup_rng_pool.
  • idx_all, idx_lb, idx_bc, idx_ul: Optional bootstrap index plans for the subsets. If provided, they are used; otherwise, plans are generated internally.

Returns

  • (traces_OG_bs, traces_P1_bs, traces_P2_bs, idx_bundle) where:
    • traces_OG_bs::Vector{Vector{Float64}} = [trM1_ORG_bs, trM2_ORG_bs, trM3_ORG_bs, trM4_ORG_bs]
    • traces_P1_bs::Vector{Vector{Float64}} = [trM1_P1_bs, trM2_P1_bs, trM3_P1_bs, trM4_P1_bs ]
    • traces_P2_bs::Vector{Vector{Float64}} = [trM1_P2_bs, trM2_P2_bs, trM3_P2_bs, trM4_P2_bs ] Each trMk_*_bs is a length-N_bs vector of bootstrap means.
    • idx_bundle::Dict{Symbol, Union{Nothing, Matrix{Int}}}: :all, :lb, :bc, :ul → the index plans used for each subset (or nothing).

Notes

  • Subset splitting follows the same tag logic as the cumulant/moment pipeline (ORG/Y_LB/Y_BC/YP_BC/Y_UL/YP_UL).
  • P1 is constructed component-wise: Y_P1 = (N_tr == N_lb) ? YP_UL : (YP_UL + (Y_BC - YP_BC)).
  • P2 is the linear combination: Y_P2 = w_lb * Y_LB + w_ul * Y_P1, with w_lb = N_lb/N_all and w_ul = N_ul/N_all.
  • If a subset is empty by construction (e.g., N_lb == 0), its bootstrap means are set to 0.
source