## 2 Principle of Operation
The output of the right DI enters the erbium-doped fiber amplifier (EDFA) to amplify the power to \(P_{XPM}\), which is required in the subsequent cross-phase modulation (XPM) process. Similarly, the BPSK target is periodically generated with a duration of \(nT\). Then, the phase information of the target is mapped into a power-modulated signal through the \(n\)-bit DI. Here, we assume that the electrical field of the BPSK target is denoted as \(E_{t}\), then the electrical fields of the upper arm \(E_{upper1-L}\) and lower arm \(E_{lower1-L}\) after entering the first Y branch in the left DI can be expressed as  
\[ \begin{bmatrix}E_{upper1-L}\\ E_{lower1-L}\end{bmatrix} = \begin{bmatrix}\sqrt{2}/2&j\sqrt{2}/2\\ j\sqrt{2}/2&\sqrt{2}/2\end{bmatrix}\begin{bmatrix}E_{t}\\ 0\end{bmatrix} = \begin{bmatrix}\sqrt{2}/2E_{t}\\ j\sqrt{2}/2E_{t}\end{bmatrix} . \tag{4}\]  
The electrical fields of the upper arm \(E_{upper2-L}\) and lower arm \(E_{lower2-L}\) after entering the second Y branch in the left DI can be expressed as Equation (5), where \(\Delta\varphi_{t}\) is the adjacent bit phase difference of the BPSK target. \[ \begin{bmatrix}E_{upper2-L}\\ E_{lower2-L}\end{bmatrix} = \begin{bmatrix}\sqrt{2}/2&j\sqrt{2}/2\\ j\sqrt{2}/2&\sqrt{2}/2\end{bmatrix}\begin{bmatrix}\sqrt{2}/2E_{t}\\ j\sqrt{2}/2E_{t}\cdot e^{i\Delta\varphi_{t}}\end{bmatrix} = \begin{bmatrix}1/2E_ {t}\big{(}1-e^{i\Delta\varphi_{t}}\big{)}\\ j1/2E_{t}\big{(}1+e^{i\Delta\varphi_{t}}\big{)}\end{bmatrix}  \tag{5}\]  
Again, we select the lower arm as the output, then the output power of the left DI \(P_{AMI-L}\) can be obtained as Equation (6), where \(P_{t}=\left|\,E_{t}\,\right|^{2}\) denotes the power of the target. Equations (4)-(6) describe the processing of the BPSK target \(E_{t}\) by the left DI. Their physical meaning and function align with those of the right DI, but they apply to a different signal. The setting of the following optical switch is the same as that of the right one. \[ \begin{array}{rl}P_{AMI-L}=\left|E_{lower2-L}\right|^{2}&=\left|j1/2E_{t} \big{(}1+e^{i\Delta\varphi_{t}}\big{)}\right|^{2}\\ &=\left|j1/2E_{t}\big{(}e^{i\Delta\varphi_{t}}\big{)}\right|^{2}\\ &=\left|j1/2E_{t}e^{i\Delta\varphi_{t}/2}\Big{(}e^{-j\Delta\varphi_{t}/2}+e^{ i\Delta\varphi_{t}/2}\Big{)}\right|^{2}\\ &=\left|jE_{t}e^{i\Delta\varphi_{t}/2}\cos(\Delta\varphi_{t}/2)\,\right|^{2}\\ &=P_{t}\cos^{2}(\Delta\varphi_{t}/2)\end{array}  \tag{6}\]  
Meanwhile, the continuous wave (CW) with a center frequency of \(\lambda_{\text{CW}}\) generated by the local laser is separated into two branches after traversing a unidirectional isolator and a 50:50 coupler. These two branches are injected into the NOLM using bidirectional HNLF as a nonlinear medium, and transmitted clockwise and counterclockwise, respectively, in the  
Figure 2: Schematic diagram of the proposed all-optical pattern recognition system. NOLM. If the electrical field of the local CW is denoted as \(E_{CW}\), the electrical fields of the clockwise carrier \(E_{C}\) and counterclockwise carrier \(E_{CC}\) can be expressed as  
\[ \begin{bmatrix}E_{C}\\ E_{CC}\end{bmatrix} = \begin{bmatrix}\sqrt{2}/2&j\sqrt{2}/2\\ j\sqrt{2}/2&\sqrt{2}/2\end{bmatrix}\begin{bmatrix}E_{CW}\\ 0\end{bmatrix} = \begin{bmatrix}\sqrt{2}/2E_{CW}\\ j\sqrt{2}/2E_{CW}\end{bmatrix}  \tag{7}\]  
Equation (7) describes the electric field distribution of the local CW \(E_{CW}\) divided into clockwise \(E_{C}\) and counterclockwise \(E_{CC}\) components. Then, the XPM effect occurs between the clockwise carrier, which serves as the probe, and the output of the left DI, which serves as the pump, inside the bidirectional HNLF. Similarly, the XPM effect occurs between the counterclockwise carrier and the output of the right DI at the same time. As the power of two pumps carries the phase information of the target and the input data, they are reloaded on the clockwise and counterclockwise carriers, respectively.