Abstract:
Methods are known for implementing general optical functions using wave splitters. However, these methods rely on these wave splitters having maximal extinction ratio, which is difficult to achieve in practice. The present invention provides methods for automatically adjusting wave splitters to provide maximal extinction ratio.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     This application claims the benefit of U.S. provisional patent application 62/138,160, filed on Mar. 25, 2015, and hereby incorporated by reference in its entirety. 
    
    
     GOVERNMENT SPONSORSHIP 
     This invention was made with Government support under contract number FA9550-09-0704 awarded by The Air Force Office of Scientific Research and under contract number FA9550-10-1-0264 awarded by The Air Force Office of Scientific Research. The Government has certain rights in this invention. 
    
    
     FIELD OF THE INVENTION 
     This invention relates to providing optical interferometers with improved extinction ratio. 
     BACKGROUND 
     It has been shown in the literature that interferometers can be used as building blocks to synthesize any desired input-output relation in an optical system. This work is described in detail in application U.S. Ser. No. 14/092,565 by the present inventor entitled “Self-configuring linear component algorithm” (SCLA), filed on Nov. 27, 2013. However, this work assumed that the interferometers being used were capable of providing ideal (or nearly ideal) extinction ratios, where all (or nearly all) of the output power of the interferometer is in one of the two interferometer outputs when the interferometer phase is adjusted appropriately. 
     In practice, it is difficult to fabricate interferometers to provide ideal extinction ratios. For individual device applications of interferometers, trimming each device after it is fabricated to improve the extinction ratio has been performed. However, this process of individually trimming each device one by one is most undesirable for the SCLA application, where a large number of interferometers may be needed in a system. Individual trimming of each interferometer in such a system could easily be prohibitively expensive. 
     Accordingly, it would be an advance in the art to provide improved extinction ratios in interferometers, especially in a manner that easily scales to a large number of interferometers. 
     SUMMARY 
     In this work, the above-identified problem is addressed by providing methods to automatically adjust interferometers to provide ideal or nearly ideal extinction ratios. Here we assume that the interferometer includes a first wave splitter and a second wave splitter. Formally, it is convenient to label inputs and outputs of these wave splitters as follows. Wave splitter  1  has an input I 1 - 1  and may have an optional input I 1 - 2 . Its outputs are O 1 - 1  and O 1 - 2 . Wave splitter  2  has inputs I 2 - 1  and I 2 - 2  and has outputs O 2 - 1  and O 2 - 2 . In the description below, informal terminology of ‘top’ (T), ‘bottom’ (B), ‘left’ (L) and ‘right’ (R) is used for interferometer inputs and outputs. This informal terminology can be understood by reference to  FIG. 4A . 
     Here a wave splitter is a passive component that has one or two inputs and two outputs, and which coherently splits power provided to its input or its inputs between its two outputs. Examples include a bulk optics beam splitter as shown on  FIG. 4A  and waveguide devices such as waveguide Mach-Zehnder interferometers, as shown on  FIGS. 2A-C  and  FIGS. 4B-C . The power splitting can be described in terms of percent transmission from input to outputs. For example, equal output power splitting from input I 1 - 1  would be 50% of the power at input I 1 - 1  going to output O 1 - 1  and 50% of the power input I 1 - 1  going to output O 1 - 2 . Such percent transmission T can range, in principle, from 0%&lt;T&lt;100%. As indicated below, wave splitters for this application preferably have a split ratio in a range from 15:85 to 85:15. Such wave splitters would have percent transmission T in a range from 15%&lt;T&lt;85%. 
     The interferometer includes the first wave splitter, the second wave splitter and a phase adjuster. More specifically, O 1 - 1  is connected to I 2 - 1  and O 1 - 2  is connected to I 2 - 2  by the phase adjuster, where the phase adjuster provides a relative phase θ between these two connections. 
     Ideally, the first and second wave splitters would split power equally between their two outputs in cases where only a single input is illuminated. However, this is not usually realized in practice, so it is convenient to quantify the departure from equal power splitting as follows. The first wave splitter has an adjustable first split error E 1 =R 1 −½, where R 1  is the power transmittance from I 1 - 1  to O 1 - 1 . Similarly, the second wave splitter has an adjustable second split error E 2 =R 2 −½, where R 2  is the power transmittance from I 2 - 1  to O 2 - 1 . As indicated above, these split errors are assumed to be adjustable, and maximizing interferometer extinction ratio proceeds by systematically and automatically adjusting these split errors. In the description given below, the first and wave splitters are labeled “left” and “right” instead of being numbered “1” and “2” to expedite the description. Thus E 1  and E 2  above correspond to the quantities δR L  and δR R  below, respectively. 
     It is convenient to define ‘bar’ and ‘cross’ states of the interferometer as follows. In the bar state, θ is selected to maximize transmission from I 1 - 1  to O 2 - 1  relative to transmission from I 1 - 1  to O 2 - 2 . In the cross state θ is selected to maximize transmission from I 1 - 1  to O 2 - 2  relative to transmission from I 1 - 1  to O 2 - 1 . Although these definitions suffice to precisely define the bar and cross states of an interferometer (once a labeling of the inputs and outputs is chosen), other equivalent definitions of the cross and bar state are possible. For example, the bar state could also be defined by having θ selected to maximize transmission from I 1 - 2  to O 2 - 2  relative to transmission from I 1 - 2  to O 2 - 1 . Similarly, the cross state could also be defined by having θ selected to maximize transmission from I 1 - 2  to O 2 - 1  relative to transmission from I 1 - 2  to O 2 - 2 . Such equivalences are well known in the art. Another point to note is that the labeling of the interferometer inputs and output is arbitrary. Any consistent labeling can be employed, as is also well known in the art. 
     Having defined our terms, the basic idea of the present approach can be succinctly stated. Automatic adjustment proceeds via an alternating sequence of the following two steps until a stopping condition is reached. 
     A) Adjusting E 1  and E 2  to optimize cross state performance, where changes to E 1  and E 2  are linked such that their values change by substantially equal amounts; and 
     B) Adjusting E 1  and E 2  to optimize bar state performance, where changes to E 1  and E 2  are linked such that their values change by substantially equal and opposite amounts. 
     A highly significant feature of this approach is that the 2-D optimization of E 1  and E 2  to maximize extinction ratio is performed as a series of 1-D optimizations. This greatly reduces the difficulty and complexity of performing this optimization. Such simplicity is especially significant in situations where a large number of interferometers needs to be automatically adjusted. 
     Here ‘optimizing’ cross state and bar state performance means first setting θ to put the interferometer in the relevant state and then adjusting E 1  and E 2  as indicated to maximize the observed extinction ratio while holding θ fixed. The sequence used can be ABABAB etc. or BABABA etc. (i.e., it does not matter which step is performed first). 
     Those of ordinary skill in the art will realize that there are various ways to implement the above approach. For example, maximizing an extinction ratio in practice is often most conveniently done by adjusting E 1  and E 2  to minimize the power emitted from the ‘incorrect’ output of the interferometer. However, it is also possible to perform this optimization by maximizing the power emitted from the ‘correct’ output of the interferometer, or by directly measuring the extinction ratio and adjusting E 1  and E 2  to maximize the measured extinction ratio. These are all equivalent ways to perform the same adjustment, because the resulting optimal point is the same for all cases. 
     As indicated above, the split errors E 1  and E 2  must be adjustable. In cases where the wave splitters are themselves implemented as Mach-Zehnder interferometers, adjustment is via the relative phase of the interferometer used within the wave splitter. Analysis has shown that 50:50 power splitting in the fabricated wave splitters within such an interferometer (as in the wavesplitters inside blocks BSL or BSR in  FIG. 2B ) is not required. Instead, sufficient adjustment is possible for interferometric wave splitters having a fabricated split ratio in a range from 15:85 to 85:15. Equivalently, it is sufficient that there is some setting of the phase shifters of θ L  and θ R  respectively that allows blocks BSL and BSR respectively of  FIG. 2B  each to achieve 50:50 split ratio. 
     As described in greater detail below, it is necessary to monitor power emitted from interferometer outputs in order to provide the required information for automatic adjustment. Tap detectors are preferred for this monitoring, where a tap detector absorbs a small fraction of the incident light (preferably 1% or less) and transmits the rest so that its effect on overall system performance is negligible. 
     Various stopping conditions can be employed to end the iterations (ABABAB or BABABA etc.). A predetermined maximum number of iterations can be implemented. The stopping condition can be going below a predetermined minimum power threshold during power minimization. The stopping condition can be having a change between two successive iterations be below a predetermined threshold during power maximization. These ideas can be combined. For example, combining a maximum number of iterations with a power-based stopping condition will guarantee that an infinite loop cannot occur. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  shows an exemplary optical system including several interferometers. 
         FIG. 2A  shows an exemplary implementation of an interferometer. 
         FIG. 2B  shows another exemplary implementation of an interferometer. 
         FIG. 2C  shows the example of  FIG. 2C  using systematic notation for inputs and outputs of wave splitters. 
         FIGS. 3A-B  show examples of how maximizing interferometer extinction ratio via automatic adjustments can occur. 
         FIGS. 4A-C  show further exemplary interferometer implementations. 
         FIGS. 4D-E  schematically show bar and cross states of an interferometer. 
         FIG. 5  shows another exemplary optical system including several interferometers. 
     
    
    
     DETAILED DESCRIPTION 
     Advanced optical functions, such as arbitrary spatial mode converters for telecommunications, linear optical quantum computing gates and circuits, and other non-traditional optics, are challenging to design and implement. Recent work has, however, shown that with meshes of perfect Mach-Zehnder interferometers (MZIs) in technologies such as silicon photonics we could automatically design or even adaptively self-configure any spatial linear optical function. Unfortunately, actual wave splitter ratios inside MZIs may differ significantly from the perfect 50:50 split, preventing such large systems from working properly. We provide a new architecture and a novel self-adjustment approach that can automatically compensate for imperfect fabricated split ratios anywhere from 85:15 to 15:85. Hence, one universal field-programmable linear array (FPLA) optical element could be mass-fabricated, with broad process tolerances. Optimum adjustment and the desired linear function could be simply programmed in the field with progressive automated algorithms, without calculations, allowing implementation of a wide range of complex, precise, linear optical functions. 
     Attempts to make arbitrary unitary optical processors have shown notable successes in waveguide CNOT gates, for example. Accurately setting the required calculated component values is challenging, however, and both performance and any increased functionality are limited by fabrication and calibration precision. Many design, calibration and setup issues for arbitrary finite-dimensional linear networks can be avoided using self-configuring approaches. Such approaches work by training the network using desired optical inputs and outputs together with a succession of simple single-parameter feedback loops that set up components values one by one by minimizing or maximizing power on photodetectors. The photodetectors can be inside the mesh or external to it. This training automatically designs the network without calculations or multiparameter iteration, and allows adaptation to the problem of interest. Any linear network can be made using only fixed 50:50 wave splitters and phase shifters, but all these approaches implicitly assume precise fabricated wave splitter ratios for perfect operation. Here we show how to relax even that requirement. 
       FIG. 1  shows a unitary transformer for an example 3×3 mesh. The input is the vector of optical amplitudes at some wavelength in the input waveguides WIi. (For mode converters, the actual beam may be sampled in segments, e.g., by grating couplers, into such waveguides.) The mesh multiplies this vector by a unitary matrix defined by the split ratios and phase shifts in the MZI blocks Bij, which can be set by training, giving an output vector as the amplitudes in the channel waveguides WCj. The detectors D 1 -D 3  are optional, depending on whether detectors are included within the blocks. For non-unitary operations, the channel waveguides are fed through modulators to another such unitary block run backwards to give final outputs. The dashed boxes represent optional “dummy” blocks set to the “bar” (straight-through) state that could be added for greater equality of loss or phase delay. Addition of such optional dummy MZI blocks means that all beams interfering on the photodetectors used in feedback loops have passed through the same number of MZIs, so with a given loss in the MZIs, that loss is equal on all such paths, giving a unitary transform that is “perfect” within an overall loss factor. Finally, it can be convenient to refer to input rows I 1 , I 2 , I 3  and to channel rows C 1 , C 2 , C 3 . 
       FIGS. 2A-B  show example MZI block implementations. Here “Top” (T), “Bottom” (B), “Left” (L) and “Right” (R) label waveguides in correspondence with the faces of a conventional wave splitter. BSL and BSR are the nominally 50:50 wave splitters. The fabricated split ratios of all wave splitters may differ from this ideal split ratio. DR and DB are optional detectors, which will be mostly transparent, sampling a small amount of the power in their respective waveguides to give the signal for the feedback loops used to set up the block&#39;s function.  FIG. 2B  shows those wave splitters (BSL and BSR) themselves implemented with additional MZIs that may also include wave splitters with fabricated split ratios unintentionally different from 50:50. Here C and D on  FIG. 2B  refer to the outputs of wave splitter BSL. 
     These MZI blocks include phase shifter  202  of angle θ to control the split ratio of the MZI and phase shifter  204  of angle φ to control an additional phase. On  FIG. 2B , phase shifter  206  of angle θ L  is within wave splitter BSL, and phase shifter  208  of angle θ R  is within wave splitter BSR. We expect now that the “left” (BSL) and “right” (BSR) wave splitters inside the MZI have fabricated power “reflectivities” R L =|r L | 2  and R R =|r R | 2  respectively (for field “reflectivities” r L  and r R  respectively) that possibly differ from 50%. (“Reflectivity” here means the fraction of the top left input that appears at the upper right output for a given wave splitter or MZI.) 
     We presume we have some physical way of adjusting the split ratios of wave splitters BSL and BSR (both up and down) after initial fabrication. This could be some trimming of the wave splitters themselves; alternatively, we could use the “Double Mach-Zehnder Interferometer” (DMZI) configuration of  FIG. 2B  in which the wave splitters are implemented with additional MZIs that may themselves be made with imperfect wave splitters. Here the split ratios of BSL and BSR can be varied by altering the phase shifts θ L  and θ R , respectively. 
       FIG. 2C  shows the example of  FIG. 2B  where more systematic notation is used for inputs and outputs of BSL and BSR. Here I 1 - 1  and I 1 - 2  are the inputs of wave splitter BSL, and O 1 - 1  and O 1 - 2  are its outputs. Similarly, I 2 - 1  and I 2 - 2  are the inputs of wave splitter BSR, and O 2 - 1  and O 2 - 2  are its outputs. 
     Now we construct an algorithm, based only on minimizing or maximizing power in detectors DB or DR, that allows us to set BSL and BSR to 50:50 wave splitting ratios, without calibrating any component. 
     Defining the reflectivity differences compared to 50%, δR L =R L −½ and δR R =R R −½, then, for unit input power in a coherent beam into the “top” port T, the power emerging from the “right” R port is
 
 P   R =½+2{δ R   L   δR   R −[(¼−δ R   L   2 )(¼−δ R   R   2 )] 1/2  cos θ}  (1)
 
θ here includes all the phase differences between the two paths inside the interferometer, and we presume the positive square root. For simplicity, we presume that changing δR L  (or δR R ) does not change the relative phase of the resulting beams in the interferometer arms (though we can handle such phase changes as described below).
 
     Note in Eq. (1), independent of δR L  and δR R , that the power in detector or monitoring point DR is minimized for the same choice of phase θ—here a choice such that cos θ=1 (e.g., θ=0)—giving
 
 P   Rmin =½+2{δ R   L   δR   R −[(¼−δ R   L   2 )(¼−δ R   R   2 )] 1/2 }  (2)
 
Such a choice also maximizes the power at output B, with P Bmax =1−P Rmin . The power at output R is maximized by choosing a phase θ such that cos θ=−1 (e.g., 0=π), giving
 
 P   Rmax =½+2{δ R   L   δR   R +[(¼−δ R   L   2 )(¼−δ R   R   2 )] 1/2 }  (3)
 
The condition for maximum power in output R also corresponds to minimum power P Bmin  in output B.
 
     The function 1−P Rmax =P Bmin  (which is easier to visualize than P Rmax ) is graphed in  FIG. 3A , showing a minimum of zero (so a maximum in P Rmax ) along the line δR L =δR R . The graph of P Rmax  is essentially identical but rotated by 90° in the (R L , R R ) plane, with its minimum of zero along the line δR L =−δR R . These straight lines are sketched in  FIG. 3B . 
     The extinction ratio for the “bar” and “cross” states can be written as P Rmax /P Bmin , and P Bmax /P Rmin , respectively. Note that for the interferometer to allow both extinction ratios to approach the “perfect” condition of being arbitrarily large we require δR L =δR R =0—i.e., 50:50 wave splitters, which corresponds to the point in the center of  FIG. 3B  where the straight lines cross. 
     These lines and the convex properties of the functions P Rmax (R L , R R ) and P Rmin (R L , R R ) allow an algorithm, based only on minimizing and maximizing powers at DR, that sets both δR L , and δR R  to zero, thereby making both wave splitters have a 50:50 split ratio. 
     This “Wave splitter 50:50 setup algorithm” (WFSA) proceeds as follows. We shine a constant power only into the “top” T port throughout the algorithm. 
     (1) Set the phase shift θ to minimize the power at DR. 
     (2) Adjust δR L  and δR R  together, in the same sense (ideally by equal amounts) to minimize the power at DR. 
     (3) Set the phase shift θ to maximize the power at DR. 
     (4) Adjust δR L  and δR R  together, but in the opposite sense (ideally by equal but opposite amounts) to maximize the power at DR. 
     Repeat steps (1) to (4) if necessary until the minimum power in step (2) is zero (or as small as can be attained) and the maximum power in step (4) is 1 (or as large as can be attained). 
     (We could also run this algorithm using detector DB, minimizing power (P Bmin ) at DB in steps (3) and (4), and/or maximizing power (P Bmax ) at DB in steps (1) and (2).) 
     We can see why this works by looking at  FIG. 3B . In the ideal case (solid straight arrows) where we can change δR L  and δR R  by exactly equal amounts for step (2) and by exactly equal and opposite amounts in step (4), this algorithm will converge in one pass through steps (1) to (4). In a more general case (curved dashed lines), as long as the sense of the relative changes is correct in the simultaneous adjustments of δR L  and δR R  in steps (2) and (4), the algorithm can converge in multiple passes. 
     For the DMZI implementation, as long as we keep θ L  and θ R  both within a range, such as θ to π, so that both cos θ L  and cos θ R  are both monotonic in the same sense throughout, we would make same-sense adjustments of θ L  and θ R  to change δR L  and δR R  in the same sense for step (2) and make opposite sense adjustments of θ L  and θ R  to change δR L  and δR R  in the opposite sense for step (4). 
     So far we have presumed that we can adjust the left and right wave splitters BSL and BSR to be 50:50 splitters; in the DMZI implementation, we are presuming some values of θ L  and θ R  allow us to achieve this. We can use our analysis of a MZI above to understand just what range of fabricated wave splitter ratios we can tolerate while still allowing the resulting MZIs to function as 50:50 wave splitters after appropriate adjustment. Specifically, we can re-use the result Eq. (2) above, applying it now to the MZI that constitutes either BSL or BSR in  FIG. 2A . Consider BSL for definiteness; now take δR L  and δR R  to refer to the fixed fabricated wave splitters within BSL and θ to refer to θ L . 
     Our goal is to be able to set BSL to be overall a 50:50 wave splitter by adjusting θ (i.e., θ L ). So we want P B  to be ½, and hence from Eq. (1)
 
δ R   L   δR   R =[(¼−δ R   L   2 )(¼−δ R   R   2 )] 1/2  cos θ  (4)
 
Squaring both sides and noting that cos 2  θ≦1 gives
 
δ R   L   2   δR   R   2 ≦[(¼−δ R   L   2 )(¼−δ R   R   2 )]  (5)
 
which can be rearranged to give
 
δ R   L   2   +δR   R   2 ≦¼  (6)
 
Therefore to impose a limit on the variation δR that can be tolerated in all fabricated wave splitters, we need δR 2 ≦⅛, which in turn means
 
                          δ   ⁢           ⁢   R          ≤     1     8       ≈   0.35           (   7   )               
So, as long as the fabricated power split ratio in the physical wave splitters lies in the range of 15% to 85%, there is some setting of the phase shifter in the MZI that allows the MZI overall to behave as a 50:50 wave splitter.
 
     Hence, even with fabricated wave splitter ratios anywhere from 15:85 to 85:15, we can make an overall MZI block that behaves as if it had “perfect” 50:50 wave splitters, and we have shown a simple algorithm based only on power maximization or minimization that allows us to set this condition. Finally, we can add a further progressive “Mesh 50:50 setup algorithm (MFSA)” (as described below) that allows us to set all the blocks in the mesh using this approach. Versions of this algorithm can run using detectors either embedded in each block or only externally at the outputs. 
     After running MFSA, we are then ready to configure the resulting “perfect” mesh for its ultimate function using the “Self-configuring linear component algorithm” (SLCA) “training” approach of U.S. Ser. No. 14/092,565 by the present inventor, filed on Nov. 27, 2013. Such an FPLA element can perform various functions. Unitary examples include a three-way splitter, a C-NOT gate, a Hadamard transform, a Fourier transform, and the equivalent of a lens. Non-unitary examples include spatial differentiation and integration, and power splitters. 
     Alternate Mach-Zehnder Block Configurations 
     In the implementations of Mach-Zehnder interferometers (MZIs), in general two phase shifters are required somewhere so that both the split ratio and the phase of at least the “Right” output can be controlled. For the automatic algorithms, as long as both of these degrees of freedom exist, various configurations are possible for the MZI blocks. Additional possible configurations are shown in  FIGS. 4A-C . As above, T, B, L and R refer to ‘top’, ‘bottom’, ‘left’ and ‘right’ interferometer ports, respectively, and DR and DB are optional tap detectors. 
     The configuration of  FIG. 4A  shows a conceptual implementation based on a conventional bulk optics beam splitter  400  including a controllable reflector  402  and a phase shifter  404  with phase delay φ in the path from the “Right” port. The waveguide MZI version of  FIG. 4B  is functionally equivalent to the configuration of  FIG. 4A . The split ratio of the MZI in the version of  FIG. 4B —the ratio between the “Right” and “Bottom” output powers for a power incident on the “Top” port—is the equivalent of the reflectivity of the controllable reflector in the version of  FIG. 4A . In the version of  FIG. 4B , this is controlled by two phase shifters  406  and  408  driven differentially, which give a controlled phase difference of θ between the two interferometer arms. The configuration of  FIG. 4C  is particularly compact and symmetric, using differential drive of phase shifters  410  and  412  to control the split ratio by altering the phase angle θ, and common mode drive of phase shifters  410  and  412  to vary the output phase angle φ. 
     These different configurations differ functionally in that they can give rise to different phase shifts of the beam in the “Bottom” output port. For the automatic alignment algorithms, it is of no consequence whether the phase of that “Bottom” output is changed or not. That “Bottom” output is fed into the next “Channel row” of the linear network, and that next row is configured later in the algorithms; that next row can configure itself to take any phase of inputs to the “Top” of its MZIs from the “Bottom” of the preceding row. Though the automatic algorithm does not care about which implementation of the MZI blocks is used, of course the calculated values of the settings of the φ phase shifters will be different for different MZI block configurations. 
       FIG. 4D  schematically shows a wave splitter  420  in a ‘bar’ configuration, where connections are mainly made between the T and R ports and between the L and B ports.  FIG. 4E  schematically shows a wave splitter  420  in a ‘cross’ configuration, where connections are mainly made between the T and B ports and between the L and R ports. 
     “No Relative Phase Change” Condition 
     In the description above, we presumed for simplicity a “no relative phase change” condition in our analysis, by which we mean that, if we shine a beam in the “top” port T in  FIG. 2A , the relative phase of the beams transmitted into arms C and D is not changed as we vary the magnitude of the reflectivity r L  of the left wave splitter. That is the behavior that the Double Mach-Zehnder interferometer (DMZI) configuration ( FIG. 2B ) will show. This is not quite a necessary condition in general for a loss-less wave splitter—an arbitrary phase shift could be added just before point C in  FIG. 2B , for example, without violating unitarity. If there were such a relative phase change, in the algorithms below we would need to re-optimize the phase θ after each adjustment of r L , though that step would be simple to add to the algorithms. 
     Algorithm for Setting the Wave Splitter Ratios in the Mesh of MZI Blocks 
     Before introducing the various algorithms formally, we can introduce the algorithm for setting up all the MZI blocks in a unitary mesh as in  FIG. 1  so that all the blocks have their (effective) wave splitters set to 50:50. We will call this the “mesh 50:50 setup algorithm” or MFSA for short. For the moment, we presume we have either the DR or DB (mostly-transparent) detectors or power sampling points in the blocks (or possibly both), as shown in  FIGS. 2A-B . For this setup, we presume we have sources that we can shine into inputs WI 1  to WI 3  in  FIG. 1 , one by one. Here, we will describe the algorithm for these 3 input and 3 output unitary meshes, but the extensions to larger meshes are straightforward. We give formal general versions of all the algorithms below. WFSA below is the “wave splitter 50:50 setup algorithm” as described above. 
     i) Shine power into WI 1  only. 
     i1) Run WFSA for B 11 . After completing WFSA, arrange that some power emerges from the lower (“bottom”) port of B 11  (e.g., by adjusting θ if necessary). 
     i2) Run WFSA for B 21 , similarly leaving some power emerging from its “bottom” port. 
     i3) Run WFSA for B 31  (if needed—this block need only be a phase shifter) 
     ii) Shine power into WI 2  only. 
     iii) Run WFSA for B 12 , leaving some power emerging from its “bottom” port. 
     ii2) Run WFSA for B 22  (if needed—this block need only be a phase shifter) 
     iii) Shine power into WI 3  only. 
     iii1) Run WFSA for B 13  (if needed—this block need only be a phase shifter) 
     This MFSA algorithm therefore allows us to set all the (effective) wave splitters in all the MZI blocks to be 50:50. 
     Thus far, we have described how to set up the (effective) wave splitters using detectors at one or both outputs of each MZI block. We can also run a slightly amended version of the MFSA algorithm without detectors inside the mesh (i.e., inside each MZI block); specifically, we can set up the wave splitter ratios in the entire mesh using only detectors D 1 -D 3 , external to the mesh, on the outputs WC 1 -WC 3  respectively, effectively using them instead of the DR detectors inside the blocks. (Again, these need only sample a small amount of the power emerging from these waveguides.) We do this basically by working progressively first through all the MZI blocks on a given input row. A key point is that, after setting up the 50:50 ratios in all the MZI blocks in a row (e.g., B 11 -B 31 ) in this way we add an algorithm, working backwards up through the row to set all those MZI blocks to the “bar” state—equivalent to perfect “reflection” from “top” to “right” and from “left” to “bottom”; effectively, this makes any such “bar” state MZI block appear as if it were not there at all. The details of this algorithm are given below. 
     By this additional process of setting all the MZI blocks to the bar state, we leave the mesh in the starting state required for training the mesh for its ultimate function using only the external detectors D 1 -D 3  to run the “Self-configuring linear component algorithm” (SLCA) for the final training of the mesh. If we are using the mostly transparent detectors DB within the mesh, it is not necessary to set the MZI blocks to the bar state before training. Indeed, one major advantage of having the (mostly-transparent) DB detectors in the blocks is that we can be continually retraining the mesh if necessary as the problem changes, without having to reset all the blocks to the “bar” state before any such retraining, allowing a more incremental retraining to proceed all the time, as in tracking moving physical sources, for example. 
     General Formal Versions of the Alignment Algorithms 
     We presume there are M C  channel rows and M I  input rows; these numbers need not be equal in general for such processors (though  FIG. 1  is drawn for M C =M I )—we might be mapping M C  orthogonal M I -dimensional vectors to M C  single-mode output waveguides (or channels), for example, where M C &lt;M I . 
     For these algorithms, we use the terminology as in  FIGS. 1 and 2A -B of the main text, though for greater clarity of notation we will write B(m, n) instead of Bmn in labeling the blocks, WI(n) and WC(m) instead of WIn and WCm respectively, and D(m) instead of Dm. 
     Several of these algorithms run over all the blocks B(m, n) in the mesh. For simplicity in stating the algorithms, such algorithms can be written to run over n=1 to M I  and m=1 to M C . Because we only actually have a “triangle” of blocks at most in a given unitary mesh (see, e.g.,  FIG. 1 ), or fewer if M C &lt;M I , we test to see if the block exists using an “If block B(m, n) exists” statement. Formally, a block exists if m≦M I −n+1, which means it fits within the “triangle”, and if m≦M C , which means it is in one of the channel rows actually implemented in the device. 
     There are two versions of many of these algorithms depending on whether (i) we embed mostly-transparent detectors or power sampling points inside the mesh or (ii) we use only detectors or power sampling points D( 1 )-D(M C ) at the channel “outputs” WC( 1 )-WC(M C ). We presume the elements are all loss-less. If we use the additional dummy blocks as discussed at the end of this section, loss in the MZI blocks does not affect the algorithms or the final function of the mesh as long as the loss in all blocks is the same and constant; the output is then simply multiplied by a constant corresponding to the loss in M I  successive blocks. 
     The algorithms are given in pseudo-code here, with a syntax that is self-evident and similar to BASIC. Non-executable commenting statements are given in italics, starting with “Comment:”. 
     These algorithms are only representative and are meant to indicate that there is at least one reasonable way of implementing all of these configurations and adjustments. There are variations possible, some of which are mentioned here, and alternative approaches that could also be taken. 
     Algorithm 1—Wave Splitter 50:50 Setup Algorithm (WFSA) 
     For a given block B(m, n) 
     Set StoppingCondition to “False” 
     While StoppingCondition is “False” 
     
         
         
           
             Comment: if the StoppingCondition variable has the value “True”, this statement will exit the loop without executing further statements 
             Set the phase shift θ to minimize the power at DR (if present) or at D(m) or to maximize the power at DB (if present) 
             Adjust δR L  and δR R  together in the same sense (ideally by equal amounts) (e.g., by adjusting θ L  and θ R  together in the same sense by approximately equal amounts) to minimize the power at DR (if present) or at D(m) or to maximize the power at DB (if present) 
             Set the phase shift θ to maximize the power at DR (if present) or at D(m) or to minimize the power at DB (if present) 
             Adjust δR L  and δR R  together but in the opposite sense (ideally by equal but opposite amounts) (e.g., by adjusting θ L  and θ R  together in the opposite sense by approximately equal amounts) to maximize the power at DR (if present) or at D(m) or to minimize the power at DB (if present) 
             If the appropriate stopping condition is met, set StoppingCondition to “True”. Comment: There are various different stopping conditions that could be set here. If using power minimization, we can test for the power at DB being below a chosen threshold. If using power maximization, at DR or D(m), we can test to see how close we are to the previous measured maximized value to see if we are below some chosen threshold of difference. Or, we can simply run the loop a specified number of times that we presume is enough for convergence, setting the StoppingCondition to “True” after a loop counter reaches that number
 
Loop Comment: loop back to the “While” statement
 
Algorithm 2—Mesh 50:50 Setup Algorithm (MFSA)
 
Version with Embedded Detectors DR and/or DB in Each Block
 
For n=1 to M I  
 
             Shine power into WI(n) only 
             For m=1 to M I −n+1 Comment: it may not be necessary to run this for m=M C  since that block may just be a phase shifter
           If block B(m, n) exists, run WFSA for B(m, n) using DR and/or DB to detect minimum and maximum powers as required   Arrange that some (possibly all) power emerges from the lower (“bottom”) port of B(m, n) by adjusting θ bin block B(m, n) so some (possibly all) power is detected in DB in that block or so DR power is reduced at least somewhat from its maximum (possibly to zero). Comment: this puts the block in a partial or complete “cross” state. This gives some power into the “top” port of the block in the next channel row (next m) so we will be able to run WFSA on it next.   
         
             Next m 
             Comment: this next part of the algorithm works back up through the line of blocks for a given n to set them all to the “bar” state. This is optional, since it is not required just to set up the 50:50 splits, but it is a more desirable and well-defined final state of the mesh for subsequent programming. 
             For m=M I −n+1 to 1 step−1 Comment: it may not be necessary to run this for m=M I −n+1 since that block may just be a phase shifter
           If block B(m, n) exists, adjust bin block B(m, n) so DB power is minimized or DR power is maximized   
         
             Next m
 
Next n
 
Version without Embedded Detectors
 
For n=1 to M I  
 
             Shine power into WI(n) only 
             For m=1 to M C  Comment: it may not be necessary to run this for m=M I −n+1 since that block may just be a phase shifter
           If block B(m, n) exists, run WFSA for B(m, n) using D(n) to detect minimum and maximum powers as required   Arrange that some (possibly all) power emerges from the lower (“bottom”) port of B(m, n) by adjusting θ in block B(m, n) so D(n) power is reduced at least somewhat from its maximum (possibly to zero) Comment: this puts the block in a partial or complete “cross” state. This gives some power into the “top” port of the block in the next channel row (next m) so we will be able to run WFSA on it next.   
         
             Next m 
             Comment: this next part of the algorithm works back up through the line of blocks to set them all to the “bar” state. Though this part of the corresponding algorithm above (for the case with embedded detectors) was optional, here it is needed so that input row of blocks we have just set now appears as if it is essentially not there as we set up the blocks in the next input row. 
             For m=M I −n+1 to 1 step−1 Comment: it may not be necessary to run this for m=M I −n+1 since that block may just be a phase shifter 
             If block B(m, n) exists, adjust θ in block B(m, n) so D(m−n+1) power is maximized 
             Next m
 
Next n
 
This version has both set up all the (effective) wave splitters in the MZIs to 50:50 and set all the MZI blocks are in their bar states (i.e., the mesh is implementing an identity matrix).
 
Algorithm 3—Cross-State Setup Algorithm (CSSA)
 
           
         
       
    
     This auxiliary algorithm can be used to set up all the blocks (except the lowest row of blocks, which are operating only as phase shifters and hence are always intended to be in their “bar” state if they even contain MZIs) in their “cross” state, where “top” is transmitted completely to “bottom” and “left” is transmitted completely to “right” in each block. This algorithm should be run only after setting all the internal (effective) wave splitters in the blocks to 50:50, i.e., after running Algorithm 2 (MFSA). The blocks can otherwise be in any internal state, i.e., with any starting values of θ and φ in each block. 
     For n=1 to M I −1 
     Comment: the upper limit of n=M I −1 is sufficient since the only block with n=MI is in the lowest row, and we do not want to set any of the blocks in the lowest row to the cross state since they are only operating as phase shifters. 
     
         
         
           
             Shine power into WI(n) only 
             For m=1 to M I −n
           Comment: this choice of upper limit is so we do not attempt to put the lowest row of blocks (which may anyway just be phase shifters) into the cross state   If block B(m, n) exists
               Adjust θ in B(m, n) to maximize power in DB (if present) or maximize power in any of D( 1 )-D(M C ) in which power is present except for D(m) Comment: Because we do not yet know the state of any blocks of larger m values, we have to consider that power from the “bottom” port of block B(m, n) could in some cases be routed to any of these other outputs. D(m) is the detector in which power will be present if power is coming out of the “right” port of block B(m, n) (which is power we are trying to minimize rather than maximize) so we do not want to maximize with respect to any power in D(m); note that this power is routed there because all of the blocks with smaller values of n have already been set to the “cross” state.   
               End if   
         
             Next m
 
Next n
 
We could also construct a version of this algorithm based on minimizing power in DR or in D(m).
 
Algorithm 4—Bar-State Setup Algorithm (BSSA)
 
           
         
       
    
     This auxiliary algorithm can be used to set up all the blocks (including the lowest row of blocks, which are operating only as phase shifters and hence are always intended to be in their “bar” state if they even contain MZIs) in their “bar” state, where “top” is transmitted completely to “right” and “left” is transmitted completely to “bottom” in each block. This algorithm should be run only after setting all the internal (effective) wave splitters in the blocks to 50:50, i.e., after running Algorithm 2 (MFSA). The blocks can otherwise be in any internal state, i.e., with any starting values of θ and φ in each block. 
     Version with Embedded Detectors 
     For n=1 to M I  Shine power into WI(n) only 
     
         
         
           
             For m=1 to M C    
             If block B(m, n) exists
           Adjust θ in block B(m, n) so DB power is minimized or DR power is maximized   
         
             End if 
             Next m
 
Next n
 
Version without Embedded Detectors
 
Run Algorithm CSSA to set all blocks (except the bottom blocks, which may just be phase shifters) in their “cross” state.
 
For n=1 to M I  
 
             Shine power into WI(n) only 
             For m=M I −n+1 to 1 step−1
           If block B(m, n) exists
               Adjust θ in block B(m, n) so D(m+n−1) power is maximized   
               End if   
         
             Comment: we are working back up each “Input” row of blocks, from largest m to smallest m in each row, changing them from “cross” to “bar” states 
             Next m
 
Next n
 
Note that the function of this algorithm is built into the version of Algorithm 2 (MFSA) for the case without embedded detectors, but is only optional in the version with embedded detectors.
 
Note on Requirements on Phase Shift Elements
 
           
         
       
    
     All the algorithms presume that we have some way of changing and holding the values of the phases θ, φ, θ L , and θ R  that we may adjust for each block while running the algorithms. We could be controlling the phases through heaters or through voltages on phase shift elements, in which case we would need (e.g., electronic) memories to hold the necessary drive voltages so as to retain these phases between algorithm steps and after we are finished with the algorithms. Alternatively, we might be physically trimming phase shifting elements by adding or subtracting material or physically permanently or semi-permanently changing refractive index. 
     To run the wave splitter 50:50 setup algorithm (WFSA), we have to be able to change θ by approximately π (i.e., 180°) multiple times, so it may be particularly useful to make that phase shifter voltage-controlled in some fashion, at least during the initial training phase. Otherwise, if we only want a “set-it-and-forget-it” device that we configure only once, the phase shifts could be set by physical trimming. If we use forms of the MZIs with phase shifters in both upper and lower arms, we can increase (decrease) θ, θ L , and θ R  by adding (subtracting) phase delay in the upper arm, and we can decrease (increase) them by adding (subtracting) phase delay in the lower arm; hence we can utilize trimming techniques that can only physically change phase delay in one sense (e.g., by adding material or by removing material). This could be particularly attractive for the θ L  and θ R  phase shifts, which we would hope only to have to adjust once to compensate for fabrication tolerances. To adjust φ, however, we do need to be physically capable of both increasing and decreasing this phase. Also, having both the θ and φ phase shifters voltage-controlled allows the overall function of the device to be reprogrammed. 
     Use of Dummy Blocks to Equalize Loss 
     The mesh as shown explicitly in  FIG. 1  has all the necessary blocks for arbitrary configuration of the network, but has different numbers of blocks in different possible “paths” through the network. For example, the path from WI 1  to WC 1  only passes through one block, whereas the path from WI 3  to WC 3  passes through three blocks. If we want to equalize background loss or overall delay on all paths, we can add dummy blocks, ultimately to be set in their “bar” state (i.e., complete transmission from “top” to “right” and from “left” to “bottom”). Such a configuration for a 4-input, 4-output mesh is shown in  FIG. 5 . This shows a 4-input, 4-output mesh with added blocks (with dashed outlines) so all paths from inputs WI 1 -WI 4  to outputs WC 1 -WC 4  through the network encounter the same number of blocks. Ultimately, all of the additional blocks here will be set to their “bar” state so they perform no mathematical function. Here it can be convenient to refer to input rows I- 1 , I 0 , I 1 , I 2 , I 3 , I 4  and to channel rows C- 1 , C 0 , C 1 , C 2 , C 3 , C 4 , where rows I- 1 , I 0 , C- 1  and C 0  are dummy rows. 
     To achieve the equal numbers of blocks per path, we only need to add the dummy blocks that lie horizontally on the rows connected to the actual signal paths (i.e., on the horizontal lines from WI 3  to WC 3 , from WI 2  to WC 2  and from WI 1  to WC 1  in  FIG. 5 ), which in this example is the set of blocks B 03 , B 02 , B 01 , B 10 , B 20 , B 30 , B- 12 , and B 2 - 1 . To allow training of all of these additional dummy blocks so that their internal (effective) wave splitters are 50:50 and so that they are all set to the “bar” state, we add the rest of the dummy blocks (here B- 10 , B- 1 - 1 , B 0 - 1 , B 1 - 1 , and BOO). We can essentially then use all the same algorithms as we would use for the simpler mesh without the dummy blocks, merely extending Algorithm 2, the mesh 50:50 setup algorithm (MFSA), to also include these dummy blocks. The simplest way to view that extension is as if we had “completed the triangle” of blocks in  FIG. 5 , imagining that we extended the input rows and channel rows to the bottom of the figure. In the case of  FIG. 5 , this would involve hypothetically adding blocks B- 13 , B- 14 , B- 15  to channel row C- 1 , B 04  to channel row C 0 , and similar hypothetical extensions for input rows I 0  and I- 1 . Then we imagine running MFSA for this larger mesh, just as before, though of course there are no actual settings to set in these hypothetical blocks. The additional inputs (e.g., WI 0 , WI- 1 , WI- 2 , and WI- 3  in  FIG. 5 ) and outputs (e.g., the waveguides WC 0 , WC- 1 , WC- 2 , and WC- 3  and detectors D 0 , D- 1 , D- 2 , and D- 3 ) are used during the MFSA algorithm (which should also be run to leave all the blocks in the “bar” state at the end). 
     Note now that every pair of beams that interferes at a given block has passed through the same number of blocks. So, if there is equal loss in every block, the pair of beams has experienced the same attenuation. Hence, the settings the alignment algorithm gives to a particular block are the same as if there was no loss in the blocks. This in turn leads to a conservation of the orthogonality properties of the unitary transform even if the blocks are lossy. The resulting mesh of blocks will behave the same as the lossless set of blocks except for multiplication by a factor that corresponds to the loss in passing through one complete path from input to output. Of course, different loss in different blocks does not lead to this kind of behavior. This does mean, however, that losses like waveguide loss and wave splitter loss do not matter to the function of the system, within an overall loss factor, as long as the waveguide loss and wave splitter loss are sufficiently uniform for all waveguides and wave splitters.