  In this work, we proposed and experimentally demonstrated a photonic
simulator for XY models, which is a typical kind of classical spin models. By
encoding the XY spins on the phase term of the input light field, the
corresponding XY Hamiltonian could be performed on the output light
intensities. The simulator is mainly based on a programmable and reconfigurable
optical vector-matrix multiplication system, which can map arbitrary XY models
within the dimensionality limit. Here, we demonstrated the
Berezinskii-Kosterlitz-Thouless transition in a two-dimensional XY model, in
which the expectation values of some observables are calculated and consistent
with the theory. Besides, we performed the ground state search of two 25-spin
XY models with different spin connections and coupling strengths. Our proposal
paves a new way to investigate the XY spin system.
