Implementing Gibbs Sampling
InterviewCodingGibbs samplingimplementationIsing model
Related module: Stochastic computing and sampling
Problem statement
Implement Gibbs sampling for the 2D Ising model:
where the sum is over nearest-neighbor pairs on a square lattice.
Write code to:
1. Update a single spin given its neighbors.
2. Perform one sweep of Gibbs sampling.
3. Measure the magnetization.
Learn the foundations
The Thermodynamic Computing track covers this topic and more in depth.