Abstract
Nonlinear optics(1) plays a central role in many photonic technologies, both classical(2-5) and quantum(6-8). However, the function of a nonlinear-optical device is typically determined during design and fixed during fabrication(9), restricting the use of nonlinear optics to scenarios in which this inflexibility is tolerable. Here we present a photonic device with highly programmable nonlinear functionality: an optical slab waveguide with an arbitrarily reconfigurable two-dimensional distribution of χ((2)) nonlinearity. The nonlinearity is realized using electric-field-induced χ((2)) (refs. (10-16)), and the programmability is engineered by massively parallel control of the electric-field distribution within the device using a photoconductive layer and optical programming with a spatial light pattern. To showcase the versatility of our device, we demonstrate spectral, spatial and spatio-spectral engineering of second-harmonic generation by tailoring arbitrary quasi-phase-matching grating structures(1) in two dimensions. The programmability of the device makes it possible to perform inverse design of grating structures in situ, as well as real-time feedback to compensate for fluctuations in operating and environmental conditions. Our work shows that we can break from the conventional one-device-one-function paradigm, potentially expanding the applications of nonlinear optics to situations in which fast device reconfigurability is desirable-such as in programmable optical quantum gates and quantum light sources(7,17-19), all-optical signal processing(20), optical computation(21) and adaptive structured light for sensing(22-24).