Zig-Zag Block Computation Schedule
- Zig-zag block computation schedules are systematic algorithms that traverse data or parameter blocks in alternating patterns for efficient numerical computation and statistical sampling.
- They enable hybrid Bayesian inference by partitioning parameter spaces into PDMP (zig-zag) and Gibbs (MCMC) blocks, improving convergence and computational efficiency in complex models.
- In transform coding, zig-zag ordering converts multidimensional data blocks into one-dimensional vectors, facilitating effective run-length and entropy coding for image and video compression.
A zig-zag block computation schedule refers to any systematic rule or algorithm in which data or parameter blocks are traversed according to a zig-zag pattern for the purposes of numerical computation, statistical sampling, or information encoding. Notably, this concept arises in two distinct domains: sampling in Bayesian inference—where the Gibbs–Zig–Zag (GZZ) block-computation schedule is used to combine piecewise deterministic Markov process (PDMP) steps and MCMC-style updates over partitioned parameter blocks—and in discrete transform coding, especially for multidimensional data, as in the 2D/3D zig-zag orderings employed in video, medical imaging, and hyperspectral compression. Both approaches share the essential paradigm of updating or scanning variables blockwise but differ in mathematical details, target objectives, and implementation.
1. Block Partitioning and Parameter Update Schedules
In the GZZ framework (Sachs et al., 2020), given a parameter vector partitioned as with and (), the blocks are updated using heterogeneous computation rules. The "Zig–Zag block" (typically ) is evolved using a PDMP zig-zag sampler, where remains fixed, whereas the "Gibbs block" () is updated via conventional MCMC or Gibbs steps conditional on the latest state of . The schedule is flexible in allowing more than two blocks, supporting arbitrary partitionings with particular blocks assigned to PDMP or MCMC updates according to problem structure or computational convenience. For high-dimensional statistical models, such as logistic regression with shrinkage priors, this hybridization enables efficient posterior sampling by exploiting blockwise structure.
In transform-based coding contexts (Mastriani, 2016), a block zig-zag schedule refers to the systematic scan of discrete transform coefficients (e.g., after 2D or 3D DCTs) in a zig-zag order, facilitating efficient run-length and entropy coding. Here, the block is a spatial or spatiotemporal data cube, and the schedule defines the sequence in which transform coefficients are mapped to a 1D vector.
2. Mathematical Formulation and Algorithmic Details
For the GZZ sampler (Sachs et al., 2020), dynamics evolve on the augmented state space . The PDMP block follows linear deterministic flow interrupted by event-driven random updates:
- PDMP Zig–Zag Events: For coordinate 0, events occur at rate
1
where 2 is the negative log posterior, 3 denotes the positive part, and 4 is an optional refreshment rate. When triggered, the 5th velocity 6 is flipped.
- MCMC/Gibbs Events: An independent Poisson process of rate 7 governs Gibbs-block updates, wherein 8 is resampled from a Markov kernel 9 preserving the conditional 0.
The combined process has event rate
1
and admits a generator reflecting both zig-zag (2) and Gibbs (3) evolutions, preserving the target posterior density under standard regularity conditions.
Block events can be scheduled either by direct simulation of inhomogeneous Poisson process arrivals (inverse-cdf), or more commonly, by Poisson thinning with tractable upper bounds.
For 2D or 3D zig-zag block scan schedules (Mastriani, 2016), the schedule is formalized as a deterministic mapping from block indices to their linear scan order. In 2D: for a 4 block, set 5, and for each 6, traverse the antidiagonal 7 either forwards or backwards depending on the parity of 8. Index formulas specify the linear order 9, and MATLAB-style vectorized implementations efficiently generate (and invert) these mappings. The 3D case generalizes this to 0 cubes using 1 as diagonal index, with in-plane 2D zig-zag scans, alternating direction by parity.
3. Scheduling Algorithms and Implementation
For block-wise GZZ sampling (Sachs et al., 2020), the core algorithmic loop is as follows:
- Initialize 2.
- Iteratively, at each step:
- Sample 3: time to the next PDMP event (first arrival across 4).
- Sample 5: Exponential6 time until next Gibbs-block update.
- Set 7, advance 8 accordingly.
- If 9, flip the appropriate velocity; else, resample 0.
- Iterate.
Event times for PDMP events can be scheduled via inverse-cdf or by thinning using upper bounds 1.
For transform coding, practical 2D/3D zig-zag schedules (Mastriani, 2016) are implemented via precomputed antidiagonal index lists, loop-based accumulation, and in-place traversal of the full block in 2 (2D) or 3 (3D) time. This avoids deep conditionals and supports efficient vectorization.
4. Theoretical Properties and Computational Complexity
The GZZ scheduler is Harris-recurrent and exhibits pathwise ergodicity under the assumptions of full-support, smooth MCMC kernel 4, and uniformly lower-bounded event rates 5. The process satisfies a strong law of large numbers:
6
with a central limit theorem under further regularity. Geometric ergodicity is achieved under additional drift conditions on 7 and bounded 8, guaranteeing convergence rate
9
for appropriate 0.
Per-event computational cost is dominated by the calculation of 1 directional derivatives 2 for the PDMP block, with Gibbs-block updates generally 3 if 4 sampling is straightforward, e.g., via closed-form or conjugate sampling.
The 2D zig-zag scan runs in 5 time; the 3D cube in 6, with space required for index arrays scaling likewise. The vectorized code avoids deeply nested loops, yielding high throughput suitable for large transform blocks.
5. Practical Guidelines for Block Size, Rate Control, and Tuning
For effective deployment of the GZZ block-computation schedule (Sachs et al., 2020):
- Block Selection: Group together coordinates (7) for which gradients 8 can be effectively bounded or sampled with fast unbiased estimators. Hyperparameters (9) that admit efficient Gibbs or HMC steps are assigned to the MCMC block.
- Tuning 0 (MCMC clock rate): Set 1 such that approximately 20–30% of events are Gibbs updates, balancing computational effort between PDMP and MCMC steps. The slowest-mixing coordinate's autocorrelation time 2 for small 3, plateauing for large 4.
- Sub-sampling: When 5, unbiased sub-sample estimates of 6 ensure exactness of the overall process if incorporated in the thinning upper bounds 7.
- Block size trade-off: Increasing PDMP block size raises per-event gradient cost (scaling with 8), but potentially reduces MCMC block complexity. Empirical profiling is recommended for optimal performance.
- Refreshment rates 9: Nonzero 0 can be set to improve ergodicity and mitigate periodic trajectories by facilitating random velocity renewals.
6. Foundational and Applied Contexts
Zig-zag block computation schedules are encountered in both modern Bayesian computation and multidimensional signal processing. The GZZ approach (Sachs et al., 2020) generalizes classical single-block PDMP samplers, allowing hybrid, blockwise partitioning for challenging posteriors in high-dimensional regression, random effects, or hierarchical models. It is particularly advantageous when some parameter subsets permit efficient PDMP updates while others only admit standard MCMC moves.
In transform coding, the zig-zag scan schedule enables efficient entropy coding by ordering low-frequency coefficients first (Mastriani, 2016). In 2D, this is the basis for JPEG compression; the 3D "rafter" zig-zag schedule extends the principle to cubes, facilitating temporal or spectral decorrelation in video, MRI/CT multi-slicing, and hyperspectral imagery. The consistent ordering delivers long zero runs after quantization, maximizing run-length and Huffman/VLC codec efficiency.
A plausible implication is that block-based zig-zag computation schedules achieve both algorithmic flexibility and computational efficiency by matching update rules to the intrinsic structure of the model or data, and by enabling scalable, parallelized, or hardware-optimized implementation in both sampling and coding scenarios.