## Abstract

We propose and experimentally verify a method to program the effective transmission matrix of general multiport linear optical circuits in random multiple-scattering materials by phase modulation of incident wavefronts. We demonstrate the power of our method by programming linear optical circuits in white paint layers with 2 inputs and 2 outputs, and 2 inputs and 3 outputs. Using interferometric techniques we verify our ability to program any desired phase relation between the outputs. The method works in a deterministic manner and can be directly applied to existing wavefront-shaping setups without the need of measuring a transmission matrix or to rely on sensitive interference measurements.

© 2015 Optical Society of America

## 1. Introduction

In many optical experiments light propagates through linear optical circuits, such as waveguides and interferometers. These optical circuits are often realized either in (*i*) free-space setups containing, *e.g*., mirrors, lenses, polarizers, wave plates, or in state-of-the-art (*ii*) integrated photonics, such as coupled waveguides and cavities [1, 2]. Both free-space and integrated optical circuits are robust platforms for performing experiments with low optical losses. In principle, arbitrary complex linear circuits can be built this way [3, 4]. One can include, like in [4], adaptive optical elements, which mostly give a controllable (phase) delay. Especially in integrated photonics much effort is invested in controlling the refractive index by, *e.g*., temperature tuning, free-carrier excitation, or optical Kerr switching [5–9]. Nevertheless, doing this for a complex circuit remains a major experimental challenge.

Here we suggest the radical different approach to use wavefront shaping of light on random multiple-scattering materials as a platform for programmable linear optical circuits, as is illustrated in Fig. 1. Incident coherent light on stationary random multiple-scattering media, such as white paint, teeth, and paper, gives rise to speckle patterns as the result of the collective interference of scattered waves. The individual far-field speckle spots form diffraction-limited beams that are correlated to each other as if light would have propagated through a very complicated random linear optical circuit [10]. In essence one controls by modulating, *e.g*., the phase of the incident wavefront the degree of mode mixing of all scattered waves that contribute constructively to the target spots [11, 12]. Adaptive wavefront shaping has been generally known for focusing and imaging with multiple-scattering media. By wavefront shaping it is also possible to adaptively transform the speckle patterns of multiple-scattering materials to behave like many linear optical components, such as waveguides and lenses [11, 13], optical pulse compressors [14,15], programmable wave plates [16] and beam splitters [17]. The manner in which the incident input modes are projected to the output modes by the scattering material is described in the scattering matrix. By wavefront shaping one can address subsets of the scattering matrix to project on desired modes to obtain the functionality of the desired linear optical device. Since one is in general not able to control all incident modes of the scattering matrix, and the scattering matrix might not contain all desired correlations, one has to tolerate losses that are typically higher than of custom fabricated optical circuits. On the other hand, this optical circuit is inherently programmable in functionality, has a system size comparable to integrated photonics, and is in terms of optical hardware very easy to implement and adapt. In contrast to most (integrated) multi-mode interference based devices [18], our method exploits disorder for functionality and is therefore robust against imperfections and does not require careful fabrication of the scattering structure. However, up to now, a general method for creating arbitrary multiport linear optical circuits by wavefront shaping in random scattering materials was still missing. A promising strategy is to measure the transmission matrix of the sample [19] and to adapt the wavefront to program the desired interference pattern. Unfortunately this requires many interference measurements, which is not always feasible.

We present a general wavefront-shaping method that controls the phase and amplitude correlations between the enhanced target spots. For this method it is not necessary to measure a transmission matrix or to rely on sensitive interference measurements. One only requires a phase-only spatial light modulator (SLM) and a camera; both are already present in most wavefront-shaping setups. We program in a deterministic manner an interference pattern that represents the functionality of multiport linear optical circuits, where the light interferes in a compact system size comparable with integrated photonics. We demonstrate the power of our method by wavefront shaping equivalents of 2 × 2 and 2 × 3 linear optical circuits using a layer of strongly scattering white paint deposited on glass. Our input basis consists of wavefront-shaped beams and the output basis consists of individual spots.

## 2. Algorithm

We show that it is possible to use a multiple-scattering material as an arbitrary mode mixing circuit by combining the phase patterns of mode-by-mode wavefront-shaping optimizations. In the following we introduce our procedure, or algorithm, that describes the consequent steps to be performed on the setup to arrive at the desired circuits. We describe here the most general implementation of our algorithm that should be valid for any existing wavefront-shaping setup. The algorithm is illustrated for a 2 × 2 optical circuit in Fig. 2 and explained for the general *n* × *m* optical system with *n* separate inputs and *m* separate outputs. We assume for simplicity that a single phase-only spatial light modulator is used, the incident input modes are spatially separated on the same SLM surface, and the resulting interference pattern is observed with a CCD camera. We use the term ’optimization’ of a spot for intensity enhancing a target spot in a speckle pattern by phase modulation of the incident light. A single spot is considered as one independent output mode: the spots form an orthogonal basis. A single incident wavefront shaped beam is considered to be a single input mode of the system. We assume that the desired optical circuit is supported by the scattering matrix of the multiple-scattering material. The algorithm consists of the following steps:

**Single input-output wavefront shaping:**Start with the first input mode incident on the SLM and the sample. Optimize by phase modulation of the incident light a target spot that forms output mode 1′. Examples of algorithms for optimizing a single spot are described in [11,20,21]. Store the corresponding phase pattern on the SLM as*θ*_{1,1′}. This corresponds with Fig. 2 step I.**Wavefront shaping of the other input modes for the same output mode:**Repeat step 1 to optimize an enhanced spot 1′ for each other input mode. Store the final phase patterns*θ*_{2,1′}…*θ*_{n,1′}. This corresponds with Fig. 2 step II. Now one has*n*phase patterns*θ*_{i,1′}, each projecting one input*i*to output 1′. Because all input modes are separated in space on the SLM surface, phase pattern*θ*_{i,1′}is only nonzero at the position of input mode*i*, and zero everywhere else (at the locations of the other input modes).**Combination of phase patterns of individual optimizations:**Create a phase pattern: by blocking all but the first two input modes 1 and 2. Via the SLM and the sample this gives an enhanced spot at output mode 1′ with light from both inputs. Adding the two phase patterns in Eq. (1) does not change the optimization of the individual inputs, since*θ*_{1,1′}= 0 at the position of input 2 and vice versa. Until now only the intensity of the output mode has been considered. Therefore the relative phase of the contributions from both input modes still has to be adjusted in order to get constructive interference in the output. To realize this, a phase offset*β*_{2,1′}is added at the corresponding illuminated pattern of the second input mode on the SLM (gray filled circle in Fig. 2 step III) that maximizes the intensity in output spot 1′. The intensity is maximal when mode 1 and mode 2 are projected in phase on 1′. Store this value for phase*β*_{2,1′}. After performing this adjustment both input modes 1, 2 are projected in phase to output mode 1′, and the phase pattern displayed by the SLM is:**Combining all inputs for one output mode:**Now block input mode 2 and open input mode 3, and repeat the procedure of the previous step for mode 1 and mode 3. Redo this for all remaining input modes. For*n*≥ 2 Eq. (2) can be generalized:**Construction of one row of the transfer matrix:**In steps 3–4 we have enforced that all input modes are projected in phase to the target spot, where the first input mode was used as reference. Next we have all input modes incident on the sample with phase mask*θ*_{1′}on the SLM. In principle all input modes can be optimized simultaneous per output mode as long as the input modes are interferometric stable during optimization and that this automatically projects all input modes in phase to the target spot. The corresponding complex field amplitude*E′*_{1}at the target spot 1′ becomes:$$\begin{array}{cc}{E}_{1}^{\prime}={e}^{i{\varphi}_{{1}^{\prime}}}\left[\left|{t}_{1,{1}^{\prime}}\right|\left|{t}_{2,{1}^{\prime}}\right|\dots \left|{t}_{n,{1}^{\prime}}\right|\right]& \left[\begin{array}{c}{E}_{1}\\ {E}_{2}\\ \vdots \\ {E}_{n}\end{array}\right]\end{array},$$where*ϕ*_{1′}is an overall phase factor with respect to a fixed reference and we have ignored an overall normalization factor. The amplitudes |*t*_{i,1′}| should be approximately equal to each other for an isotropic random scattering material, and is given by the square root of the intensity of the optimized spot. This equation can be simplified to a transfer matrix equation describing a*n*× 1 optical system:**Amplitude control of each element in T**_{n×1,1′}: One can achieve amplitude control by manipulating the intensity enhancement of the spot for each input mode. Suppose one wants to decrease |*t*_{2,1′}| In order to do so, add at the location of the second input mode a random phase pattern to*θ*_{1′}with a controlled amplitude to reduce the intensity enhancement to the desired level. Store this new phase pattern as*θ*_{1′}. The phase of the transfer matrix element should remain unaffected if there are sufficient SLM segments used for the mode (about ∼ 10^{2}segments in our experiments). Otherwise one can compensate for this additional phase shift by repeating the procedure of step 4 for the specific input mode. It is important to note that this manner of controlling the amplitude of |*t*_{i,1′}| will only reduce the amplitude level.**Phase control of each element in T**_{n×1,1′}: One can achieve phase control over each input mode*i*by writing a desired phase offset*α*_{i,1′}to*θ*_{1′}at the corresponding illuminated region on the SLM. In this manner the unnormalized transfer matrix**T**_{n×1,1′}becomes:$${\mathbf{T}}_{n\times 1,{1}^{\prime}}={e}^{i{\varphi}_{{1}^{\prime}}}\left[\left|{t}_{1,{1}^{\prime}}\right|{e}^{i{\alpha}_{1,{1}^{\prime}}}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\left|{t}_{2,{1}^{\prime}}\right|{e}^{1{\alpha}_{2,{1}^{\prime}}}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\cdots \hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\left|{t}_{n,{1}^{\prime}}\right|{e}^{1{\alpha}_{\text{n},{1}^{\prime}}}\right].$$We have now controlled independently both the phase and amplitude of each element in**T**_{n×1,1′}. This is also illustrated in Fig. 2 step III. In the remainder of this section we will explain how to get a desired transmission matrix with multiple inputs and multiple outputs.**Wavefront shape inputs for other outputs:**Repeat steps 1–7 for the remaining number of orthogonal output spots. This is also illustrated in Fig. 2 steps IV–VI. At the end of this step you have*m*independent transfer matrices**T**_{n×1,m′}that each describe an*n*× 1 optical system.**Combine results for all outputs:**With all input modes incident, write the phase pattern*θ*:_{n×m}$${\mathit{\theta}}_{n\times m}=\text{arg}\left(\sum _{j=1}^{m}{c}_{j}{e}^{\text{i}{\mathit{\theta}}_{j}}\right),$$where subscript*j*denotes the*j*th output mode, with*j*≤*m*. The phase pattern*θ*is a weighted pixel-by-pixel vector sum of each of the_{n×m}*m*output optimizations. Consequently, the field in target output modes become related to the input modes as:$$\left[\begin{array}{c}{E}_{1}^{\prime}\\ {E}_{2}^{\prime}\\ \vdots \\ {E}_{m}^{\prime}\end{array}\right]={f}_{1}\left[\begin{array}{c}{c}_{1}{\mathbf{T}}_{n\times 1,{1}^{\prime}}\\ {c}_{2}{\mathbf{T}}_{n\times 1,{2}^{\prime}}\\ \vdots \\ {c}_{m}{\mathbf{T}}_{n\times 1,{m}^{\prime}}\end{array}\right]\hspace{0.17em}\hspace{0.17em}\left[\begin{array}{c}{E}_{1}\\ {E}_{2}\\ \vdots \\ {E}_{n}\end{array}\right],$$with*f*_{1}a normalization factor. In this manner we have programmed an unnormalized transmission matrix**T**given by:_{m×n}$${\mathbf{T}}_{m\times n}=\left[\begin{array}{c}{c}_{1}{\mathbf{T}}_{n\times 1,{1}^{\prime}}\\ {c}_{2}{\mathbf{T}}_{n\times 1,{2}^{\prime}}\\ \vdots \\ {c}_{m}{\mathbf{T}}_{n\times 1,{m}^{\prime}}\end{array}\right].$$This is also illustrated for the 2×2 system in Fig. 2 VII. This transmission matrix projects the*n*input modes to the*m*output modes, with the desired linear optical functionality.

To illustrate what happens in Eq. (7), consider a 1×2 circuit splitting one input mode equally into two output modes 1′ and 2′. For this circuit Eq. (7) reduces to *θ*_{1×2} = arg(*e*^{iθ1′} + *e*^{iθ2′}), with *θ*_{1′} the phase pattern optimized to produce output mode 1′ and *θ*_{2′} the pattern for output mode 2′. To produce both outputs simultaneously, one performs a vector addition of the fields 1′ and 2′. The resulting phase pattern *θ*_{1×2} now contributes to both output modes. In Eq. (7) the superposition of the individual incident field patterns results into the desired correlations between the output modes because the scattering material is a linear system. This procedure requires that the output spots behave as independent uncorrelated output modes. If this is the case, all individual matrices describing patterns *e*^{iθj} in Eq. (7) should be orthogonal to each other. This condition is met if all *e*^{iθi,j′} for a given input mode *i* are orthogonal to each other. Nonorthogonality results in background speckle and decreases the contrast of the output spots. In practice complete orthogonality is not met since the spots are weakly correlated with each other, which can be caused by the correlations in the scattering matrix of the material itself [22,23], or by the fact that one only addresses subsets of the scattering matrix of the sample by wavefront shaping [24]. However, if this subset is large enough (typically ∼ 10^{2} independent channels per wavefront describing an input mode, in our experience), the spots behave approximately orthogonal to each other and therefore also the phase masks become orthogonal and the algorithm will work.

## 3. Experimental setup and methods

We demonstrate our method by wavefront shaping a programmable 2×2 and 2×3 transmission matrix in an opaque layer of white paint. In this section we describe our experimental setup and our measurement method.

#### 3.1. Experimental setup

Our setup is illustrated in Fig. 3(a). This is the same setup as described in [17]. The light source is a mode-locked Ti:Sapphire laser (Spectra-Physics, Tsunami) emitting transform-limited pulses at a repetition rate of 80 MHz with a pulse width of approximately 0.3 ps and a center wavelength of 790.0 nm. The beam is split and coupled into two separate single-mode fibers. The output of the two fibers have identical polarization and beam waist and form the input modes 1 and 2. The two modes are phase-modulated with a SLM (Hamamatsu, LCOSSLM). Figure 3(b) illustrates an optimized phase pattern. Clearly, both modes are spatially separated on the SLM surface. Behind the SLM, the two modes are spatially overlapped with a half-wave plate (HWP) and polarizing beam splitter (PBS) cube, resulting in collinear propagation of modes with orthogonal polarization. This allows us to completely fill the aperture of the objective (NA=0.95) that images the SLM on the conjugate plane of the layer of white paint. Creating a configuration with more than 2 inputs requires spatial shaping of the inputs to have orthogonal incident modes arriving at the sample, *e.g.* by creating angular gradients, patterned beams, etc. The surface of the SLM is imaged on the back focal plane of the objective with two lenses in a 4-focal-length-configuration (not shown). Both pulses arrive simultaneously at the sample. We make sure that the power of both input modes on the objective are identical (approximately 0.5 mW per mode). However, input mode 1 is transmitted more efficiently by the objective than input mode 2 because of experimental imperfections. This causes the optimized spots for mode 1 to have a higher intensity. The layer of white paint consists of ZnO powder with a scattering mean free path of 0.7 ± 0.2 *μ*m. The layer is approximately 30 *μ*m thick and spray painted on a glass microscope slide of 1.5 mm thickness. The transmitted pattern is collected with a second objective (NA=0.55) and directly projected on a CCD camera after reflection on a PBS, see for example Fig. 3(c) where three optimized spots are visible. The intensity values for the CCD pixels that correspond to the target spots are spatially integrated to obtain the output powers for the interference pattern.

#### 3.2. Measurement method

We start with a single input mode incident on the material and selected on the camera a location for intensity enhancing a target spot. The SLM is divided into segments of 10×10 pixels. One input mode is controlled by approximately 500 segments, providing maximum intensity enhancement. The SLM controls the phase by addressing the pixels with 8-bit pixel values. In our experiment a pixel value of 207 corresponds with a phase difference of 2*π* rad. We first pre-optimize spots by fitting the optimal phase for each segment that provides maximum constructive interference in the target spot, as used in [11]. We apply this method twice, in spirit of the work in [21]. We obtain a higher enhancement when a final optimization is made by sequentially addressing each segment with a random phase and accept it if the intensity increased. We apply this procedure about 5 times for each pixel. In case there is no initial intensity present at the intended target, the random phase procedure is also used as an initial optimization. The total optimization time for one input mode to one output mode iss approximately 1.5 hours. The typical intensity enhancement for an individual spot is in the order of 50× the average intensity of the other spots. The transmission of the sample and imaging optics is not critical for this proof-of-principle demonstration and is estimated to be on the percent level.

This procedure is repeated for each input and each output mode. With the algorithm leading to Eq. (9) the phase pattern that provides the desired transmission matrix is generated. The obtained transmission matrix is characterized with interference measurements, as described in [17] and Fig. 4. A phase difference Δ*θ* is applied between the input modes to monitor the interference in the output modes. From these interference measurements we extract the phase of each element of the transmission matrix. This phase difference Δ*θ* is applied with the SLM on input mode 2. Figure 3(b) shows an example. We define *δ _{j′}* the phase Δ

*θ*for which maximum intensity occurs in output mode

*j′*, as indicated for mode 1′ in Fig. 4(b).

## 4. The 2 × 2 optical circuit

We demonstrate our algorithm by first programming a 2 × 2 optical circuit with a transmission matrix of the form:

*T*| are set by the intensity enhancement of the individual spots and are approximately equal. We let the phase of element

_{a,b}**T**

_{2×2}(2, 2) vary with controllable phase

*α*, to demonstrate the ability to program the phase correlations of this optical circuit. The four phase patterns

*θ*_{1,1′},

*θ*_{2,1′},

*θ*_{1,2′},

*θ*_{2,2′}were combined to overall phase pattern

*θ*_{2×2}(

*α*) following our algorithm, in which step 6 was excluded. First we find the four phase patterns

*θ*_{1,1′},

*θ*_{2,1′},

*θ*_{1,2′},

*θ*_{2,2′}projecting the individual inputs 1, 2 to the individual outputs 1′, 2′ (steps 1–2 of the algorithm). Next both input modes are projected in phase to the output modes by finding

*β*

_{2,1′}and

*β*

_{2,2′}(steps 3–5). Then we program the phase of element

**T**

_{2×2}(2, 2) according to Eq. (10) by setting

*α*

_{2,2′}=

*α*(step 7). Finally all phase patterns are combined to the overall phase pattern

*θ*_{2×2}(

*α*) (steps 8–9). Phase

*α*is varied in 21 steps. Therefore in total 21 different phase patterns

*θ*_{2×2}(

*α*) were made for our measurements. Note that the transmission matrix for

*α*=

*π*represents the equivalent of a standard optical beam splitter [25], which is in this case fully controlled, in contrast to the algorithm for the wavefront-shaped beam splitters obtained in [17].

The results are presented in Fig. 5. Figure 5(a) shows the interference results for the two optimized spots for *α* = 2 rad. Two sine functions are fitted to the output modes to determine the phases *δ*_{1′} and *δ*_{2′} at which maximum intensity occurs. The phases *δ*_{1′} and *δ*_{2′} for each *α* are shown in Fig. 5(b). We observe that *δ*_{1′} is approximately constant as function of *α*, while *δ*_{2′} decreases linearly with *α*. Ideally one would expect that *δ*_{1′} remains exactly constant as function of *α*. However, there is crosstalk between the modes since they are not perfectly orthogonal. Phase fluctuations due the stability of our setup can be neglected. Figure 5(c) presents the main results of the 2 × 2 optical circuit: the observed phase difference between the output modes (symbols) as a function of the programmed value for *α*. The diagonal band represents the expected phase difference, based on the target phase *α*, and the uncertainties in *β*_{2,1′} and *β*_{2,2′}. We observe an excellent agreement between our measurements and predicted values. Our proof-of-principle experiments demonstrate full phase control of wavefront shaping 2 × 2 optical circuits in white paint in a deterministic manner.

For comparison, we also performed simulations to support our measurements. Figures 6(a)–6(c) present computational results in which we have repeated virtually our experiment 10,000 times on simulated random unitary scattering matrices with a dimension of 1000 and 50 controlled channels per input mode (a scattering matrix of dimension 1000 means that there are 1000 independent channels). Similar simulations were performed by us in [17], but now we have implemented the algorithm presented in this manuscript. Figure 6(a) shows the histograms for the fitted phase *δ*_{1′} as a function of *α*. Figure 6(b) shows the histograms for fitted phase *δ*_{2′}. Figure 6(c) shows the histogram for the phase difference between the output modes. All three figures demonstrate histograms with a finite width. This width is a manifestation of the nonorthogonality caused by addressing a subset of the scattering matrix, as described below step 9 of the algorithm. In these simulations a subset of the scattering matrix becomes addressed that consists of 2 rows, corresponding to the output spots, and 100 columns, corresponding to the two modes that are controlled by 50 independent channels each. This subset does not consist of orthogonal rows anymore, resulting in the output spots being weakly correlated, which also occurs in our experiment. Apparently, the width of the observed phases *δ*_{1′} and *δ*_{2′} is independent of *α* and is identical for *δ*_{1′} and *δ*_{2′}.

Figure 6(d) shows another set of simulations where the standard deviation of the phase distributions is plotted as a function of the controlled number of independent channels per wavefront-shaped input mode. We have performed these simulations for scattering matrices with dimension 500 and 2500. Each data point was obtained by ensemble averaging over 1,000 different realizations. We observe that the standard deviation of these phase distributions decreases with an increased number of controlled elements. More computational and theoretical work is necessary to understand the efficiency and accuracy of wavefront-shaping optical circuits, which is beyond the scope of this article.

## 5. The 2 × 3 optical circuit

In the previous section we have presented experiments on a wavefront shaped 2 × 2 optical circuit. Here we present the same type of experiments for a 2 × 3 optical circuit. The transmission matrix of the 2 × 3 optical circuit is given by:

*α*. We let the phase of element

**T**

_{2×3}(2, 2) vary with controllable phase

*α*. First we find the six phase patterns projecting the individual inputs 1, 2 to the individual outputs 1′, 2′, 3′ (steps 1–2 of the algorithm). Next both input modes are projected in phase to the output modes (steps 3–5). Then we program the phase of element

**T**

_{2×3}(2, 2) by setting

*α*

_{2,2′}=

*α*in Eq. (11) (step 7). Finally all phase patterns are combined to the overall phase pattern

*θ*_{2×3}(

*α*) (steps 8–9). Phase

*α*is varied in 21 steps.

The results are presented in Fig. 7. The phases for which maximum interference occurs in the output modes, *δ*_{1′}, *δ*_{2′}, and *δ*_{3′}, are shown in Fig. 7(a) for each programmed phase *α*. We observe that *δ*_{1′} and *δ*_{3′} are approximately constant as function of *α*, while *δ*_{2′} decreases linearly with *α*. The fluctuations in *δ*_{1′} and *δ*_{3′} are caused by the non-orthogonality of the output modes, as was explained in more detail for the 2 × 2 optical circuit in the previous section. Figure 7(b) shows the main result, the relative phase differences between the output modes. The symbols represent the measurements and the bands represent the expected phases based on the accuracy at which we program the transmission matrix. The observed phase differences between the output modes match very well the expected phase differences. Our proof-of-principle experiments demonstrate full phase control of wavefront shaping 2 × 3 optical circuits in white paint in a deterministic manner.

## 6. Conclusions and outlook

In summary, we have presented a method that transforms random multiple-scattering materials into programmable multiport linear optical circuits by phase modulation of incident wavefronts. The method provides the desired transmission matrix in a deterministic manner and it can be implemented in most existing wavefront-shaping setups. We have described proof-of-principle experiments in which we have used a white paint layer as programmable 2 × 2 and 2 × 3 optical circuits. The experimental observed phase relations demonstrate a very good agreement with theory.

We anticipate that our method can be implemented to make more advanced linear optical circuits with a larger number of inputs and outputs. More research is required to understand how efficiently one can shape an interference pattern with a programmed correlation to achieve the functionality of the desired optical circuit. Many parameters have to be explored to identify the restrictions of our algorithm. It would be fascinating to explore the influence of the scattering properties of the material, *e.g.*, the sample geometry, the sample thickness, and scattering mean free path. The performance of our algorithm is expected to be affected by the efficiency of the wavefront shaping process, which determines the intensity enhancement and the amount of light that gets focused in a target spot. Based on the linearity of the intensity of the optimized spots with the number of controlled channels [11], we expect the power efficiency of our algorithm to scale as 1/*n* where *n* is the number of inputs. However, it is an open question if more efficient configurations exist. Using random scattering media described by scattering matrices of lower dimension, such as disordered multi-mode fibers or planar disordered structures, will reduce optical losses caused by uncontrolled channels. This would make it possible to use these wavefront-shaped optical circuits for those adaptive quantum optical experiments in multiple-scattering materials [26,27] where efficiencies in the order of 1% are acceptable. Our presented method requires the setup to be interferometrically stable during the optimization of a single speckle spot. To program a 2 × 2 circuit now took about 6 hours, because each phase pattern required about 1.5 hours of optimization. We anticipate that by using a micromirror based SLM, in combination with faster algorithms and laser light with longer coherence length, the time to program a similar circuit can be reduced to a matter of seconds [28]. In our experiments we worked with linearly-polarized light. By using polarization-selective components for the incident light and the scattered light, and additional cameras for detection, it becomes possible to use our algorithm for any polarization basis for the input and output modes, like circularly-polarized light. In addition, it would be intriguing to use structured scattering materials in order to more efficiently address certain correlations in the scattering matrix for programmed functionality.

There exist alternative approaches for programmable optical circuits that provide orders of magnitude less scattering losses, such as achieved in integrated photonics. Each approach requires a scattering platform and adaptive optical components to control the mode mixing. The more complex the transmission matrix needs to be, the more advanced the scattering platform and adaptive optical components should become to obtain a high energy efficiency. In our experiment we have sacrificed energy efficiency: in the order 1% of the light travels through the effective desired optical circuit. However, we have gained in simplicity of the experimental design. Our method for a programmable optical circuit is robust against disorder, versatile to operate, and the mode-mixing heart of the circuit takes place in a compact system size comparable with integrated photonics.

## Acknowledgments

We thank K. -J. Boller, S. A. Goorden, J. L. Herek, J. P. Korterik, F. B. Segerink, I. M. Vellekoop, and W. L. Vos for discussions and support. This work was supported by the Stichting Fundamenteel Onderzoek der Materie (FOM) that is financially supported by the Nederlandse Organisatie voor Wetenschappelijk Onderzoek (NWO). A. P. M. acknowledges ERC grant 279248. P. W. H. P. acknowledges NWO Vici.

## References and links

**1. **E. Hecht, *Optics*, 4th Edition (Addison Wesley, 2002).

**2. **B. E. A. Saleh and M. C. Teich, *Fundamentals of Photonics*, 2nd Edition (Wiley-Interscience, 2007).

**3. **M. Reck, A. Zeilinger, H. J. Bernstein, and P. Bertani, “Experimental realization of any discrete unitary operator,” Phys. Rev. Lett. **73**, 58–61 (1994). [CrossRef] [PubMed]

**4. **D. A. B. Miller, “Self-configuring universal linear optical component,” Phot. Research **1**, 1–15 (2013). [CrossRef]

**5. **S. W. Leonard, H. M. van Driel, J. Schilling, and R. B. Wehrspohn, “Ultrafast band-edge tuning of a two-dimensional silicon photonic crystal via free-carrier injection,” Phys. Rev. B. **66**, 161102 (2002). [CrossRef]

**6. **W. Zhang, K. Aljasem, H. Zappe, and A. Seifert, “Completely integrated, thermo-pneumatically tunable microlens,” Opt. Express **19**, 2347–2362 (2011). [CrossRef] [PubMed]

**7. **P. J. Shadbolt, M. R. Verde, A. Peruzzo, A. Politi, A. Laing, M. Lobino, J. C. F. Matthews, M. G. Thompson, and J. L. O’Brien, “Generating, manipulating and measuring entanglement and mixture with a reconfigurable photonic circuit,” Nat. Photonics **6**, 45–49 (2012). [CrossRef]

**8. **D. Bonneau, M. Lobino, P. Jiang, C. M. Natarajan, M. G. Tanner, R. H. Hadfield, S. N. Dorenbos, V. Zwiller, M. G. Thompson, and J. L. O’Brien, “Fast path and polarization manipulation of telecom wavelength single photons in lithium niobate waveguide devices,” Phys. Rev. Lett. **108**, 053601 (2012). [CrossRef] [PubMed]

**9. **E. Yüce, G. Ctistis, J. Claudon, E. Dupuy, K. J. Boller, J. M. Gérard, and W. L. Vos, “Competition between electronic Kerr and free-carrier effects in an ultimate-fast optically switched semiconductor microcavity,” J. Opt. Soc. Am. B **29**, 2630–2642 (2012). [CrossRef]

**10. **I. Freund, “Looking through walls and around corners,” Physica A **168**, 49–65 (1990). [CrossRef]

**11. **I. M. Vellekoop and A. P. Mosk, “Focusing coherent light through opaque strongly scattering media,” Optics Lett. **32**, 2309–2311 (2007). [CrossRef]

**12. **A. P. Mosk, A. Lagendijk, G. Lerosey, and M. Fink, “Controlling waves in space and time for imaging and focusing in complex media,” Nat. Photonics **6**, 283–292 (2012). [CrossRef]

**13. **E. G. van Putten, D. Akbulut, J. Bertolotti, W. L. Vos, A. Lagendijk, and A. P. Mosk, “Scattering lens resolves sub-100 nm structures with visible light,” Phys. Rev. Lett. **106**, 193905 (2011). [CrossRef] [PubMed]

**14. **J. Aulbach, B. Gjonaj, P. M. Johnson, A. P. Mosk, and A. Lagendijk, “Control of light transmission through opaque scattering media in space and time,” Phys. Rev. Lett. **106**, 103901 (2011). [CrossRef] [PubMed]

**15. **O. Katz, E. Small, Y. Bromberg, and Y. Silberberg, “Focusing and compression of ultrashort pulses through scattering media,” Nat. Photonics **5**, 372–377 (2011). [CrossRef]

**16. **Y. Guan, O. Katz, E. Small, J. Zhou, and Y. Silberberg, “Polarization control of multiply scattered light through random media by wavefront shaping,” Opt. Lett. **37**, 4663–4665 (2012). [CrossRef] [PubMed]

**17. **S. R. Huisman, T. J. Huisman, S. A. Goorden, A. P. Mosk, and P. W. H. Pinkse, “Programming balanced optical beam splitters in white paint,” Opt. Express **22**, 8320–8332 (2014). [CrossRef] [PubMed]

**18. **L. B. Soldano and E. C. M. Pennings, “Optical multi-mode interference devices based on self-imaging: principles and applications,” J. Lightwave Technol. **13**, 615–627 (1995). [CrossRef]

**19. **S. M. Popoff, G. Lerosey, R. Carminati, M. Fink, A. C. Boccara, and S. Gigan, “Measuring the transmission matrix in optics: an approach to the study and control of light propagation in disordered media,” Phys. Rev. Lett. **104**, 100601 (2010). [CrossRef] [PubMed]

**20. **I. M. Vellekoop and A. P. Mosk, “Phase control algorithms for focusing light through turbid media,” Opt. Commun. **281**, 3071–3080 (2008). [CrossRef]

**21. **H. Yilmaz, W. L. Vos, and A. P. Mosk, “Optimal control of light propagation through multiple-scattering media in the presence of noise,” Biomed. Opt. Express **4**, 1759–1768 (2013). [CrossRef] [PubMed]

**22. **P. Sheng, *Introduction to wave scattering, localization, and mesoscopic phenomena*, 1st Edition (Academic, 1995).

**23. **E. Akkermans and G. Montambaux, *Mesoscopic physics of electrons and photons*, 1st Edition (Cambridge University, 2007). [CrossRef]

**24. **I. M. Vellekoop and A. P. Mosk, “Universal optimal transmission of light through disordered materials,” Phys. Rev. Lett. **101**, 120601 (2008). [CrossRef] [PubMed]

**25. **R. A. Campos, B. E. A. Saleh, and M. C. Teich, “Quantum-mechanic lossless beam splitter: SU(2) symmetry and photon statistics,” Phys. Rev. A **40**, 1371–1384 (1989). [CrossRef] [PubMed]

**26. **T. J. Huisman, S. R. Huisman, A. P. Mosk, and P. W. H. Pinkse, “Controlling single-photon Fock-state propagation through opaque scattering materials,” Appl. Phys. B **116**, 603–607 (2014). [CrossRef]

**27. **S. A. Goorden, M. Horstmann, A. P. Mosk, B. Skoric, and P. W. H. Pinkse, “Quantum-secure authentication of a physical unclonable key,” Optica **1**, 421–424 (2014). [CrossRef]

**28. **S. A. Goorden, J. Bertolotti, and A. P. Mosk, “Superpixel-based spatial amplitude and phase modulation using a digital micromirror device,” Opt. Express **22**, 17999–18009 (2014). [CrossRef] [PubMed]