  The spatial photonic Ising machine (SPIM) [D. Pierangeli et al., Phys. Rev.
Lett. 122, 213902 (2019)] is a promising optical architecture utilizing spatial
light modulation for solving large-scale combinatorial optimization problems
efficiently. The primitive version of the SPIM, however, can accommodate Ising
problems with only rank-one interaction matrices. In this Letter, we propose a
new computing model for the SPIM that can accommodate any Ising problem without
changing its optical implementation. The proposed model is particularly
efficient for Ising problems with low-rank interaction matrices, such as
knapsack problems. Moreover, it acquires the learning ability of Boltzmann
machines. We demonstrate that learning, classification, and sampling of the
MNIST handwritten digit images are achieved efficiently using the model with
low-rank interactions. Thus, the proposed model exhibits higher practical
applicability to various problems of combinatorial optimization and statistical
learning, without losing the scalability inherent in the SPIM architecture.
