  Optical phenomena always display some degree of partial coherence between
their respective degrees of freedom. Partial coherence is of particular
interest in multimodal systems, where classical and quantum correlations
between spatial, polarization, and spectral degrees of freedom can lead to
fascinating phenomena (e.g., entanglement) and be leveraged for advanced
imaging and sensing modalities (e.g., in hyperspectral, polarization, and ghost
imaging). Here, we present a universal method to analyze, process, and generate
spatially partially coherent light in multimode systems by using
self-configuring optical networks. Our method relies on cascaded
self-configuring layers whose average power outputs are sequentially optimized.
Once optimized, the network separates the input light into its mutually
incoherent components, which is formally equivalent to a diagonalization of the
input density matrix. We illustrate our method with arrays of Mach-Zehnder
interferometers and show how this method can be used to perform partially
coherent environmental light sensing, generation of multimode partially
coherent light with arbitrary coherency matrices, and unscrambling of quantum
optical mixtures. We provide guidelines for the experimental realization of
this method, paving the way for self-configuring photonic devices that can
automatically learn optimal modal representations of partially coherent light
fields.
