  Recently, spatial photonic Ising machines (SPIMs) have demonstrated the
abilities to compute the Ising Hamiltonian of large-scale spin systems, with
the advantages of ultrafast speed and high power efficiency. However, such
optical computations have been limited to specific Ising models with fully
connected couplings. Here we develop a wavelength-division multiplexing SPIM to
enable programmable spin couplings and external magnetic fields as well for
general Ising models. We experimentally demonstrate such a wavelength-division
multiplexing SPIM with a single spatial light modulator, where the gauge
transformation is implemented to eliminate the impact of pixel alignment. To
show the programmable capability of general spin coupling interactions, we
explore three spin systems: $\pm J$ models, Sherrington-Kirkpatrick models, and
only locally connected ${{J}_{1}}\texttt{-}{{J}_{2}}$ models and observe the
phase transitions among the spin-glass, the ferromagnetic, the paramagnetic and
the stripe-antiferromagnetic phases. These results show that the
wavelength-division multiplexing approach has great programmable flexibility of
spin couplings and external magnetic fields, which provides the opportunities
to solve general combinatorial optimization problems with large-scale and
on-demand SPIM.
