## 4 Mathematical Model of the SNN  
The elementary unit of an SNN has already demonstrated its ability to perform both supervised [18] and unsupervised [19] learning. In both cases, the X-junction contained in the elementary unit changes, switching its state from the initial neutral condition \(50-50\) to the final unbalanced one \(80-20\). This dynamic corresponds to the learning process of the single unit, and it is mathematically described by the matrix expression:  
\[\underline{Y}=W(E_{\textit{Bias}},X)\cdot\underline{X} \tag{1}\]  
Figure 2: Schematic architecture of an SNN used for bit-to-bit storage of information. (**A**) A single neural unit structure is constituted by a single X-junction; (**B**) one processing level in the network consists of several units in parallel; (**C**) successive levels of the network are connected in series with each other; (**D**) even-order levels have two fewer units. The suppression of these units is replaced with the insertion of the total reflections at the lateral edges of the substrate.  
where \(\underline{X}\) and \(\underline{Y}\) are the input and output vectors, respectively, and \(W\) is the gate transfer matrix, which depends on the photorefractive bias \(E_{Bias}\) on the input values \(x_{i}\). \(W\) is not constant and can change according to the learning of the unit. As can be observed, the matrix is nonlinear, which means it depends on \(X\) values as well. Therefore, the resolution of Equation (1) occurs recursively, as the learning process is \"slow\"--that is, it requires reinforcing over time the information channel to be stored.  
The general expression of \(W\) is given by  
\[W=\frac{1}{2}\begin{bmatrix}1+\frac{1}{2}\cdot\frac{Q_{1}}{Q_{1}+Q_{2}}(P_{1}+ \chi)&1-\frac{1}{2}\cdot\frac{Q_{2}}{Q_{1}+Q_{2}}(P_{2}+\chi)\\ 1-\frac{1}{2}\cdot\frac{Q_{1}}{Q_{1}+Q_{2}}(P_{1}+\chi)&1+\frac{1}{2}\cdot\frac {Q_{2}}{Q_{1}+Q_{2}}(P_{2}+\chi)\end{bmatrix} \tag{2}\]  
where  
\[P_{i}=P_{i}(t-1)=\frac{x_{i}(t-1)}{x_{1}(t-1)+x_{2}(t-1)+x_{D}} \tag{3}\]  
describes the normalized balance of the \(i\)-th channel at the previous iteration time, and  
\[Q_{i}=Q_{i}(t)=\frac{x_{i}(t)}{x_{1}(t)+x_{2}(t)+x_{D}} \tag{4}\]  
the normalized signal injected in the \(i\)-th channel at the time \(t\). In both Equations (3) and (4), \(x_{D}\) describes the power of the dark radiation circulating within the network.  
The parameter \(\chi\) in Equation (2) refers to the energy that has previously flowed through the junction with respect to the maximum possible saturation level, thanks to the SAT parameter. This defines the saturation dynamics and the structure imbalance values  
\[\chi=\frac{SAT}{1+\left(P_{1}+P_{2}\right)^{2}} \tag{5}\]  
The SAT parameter is the one responsible for the unbalance dynamics of each single unit. Different SAT values lead to different unbalance values (called here, SJR: Single Junction Ratio) of the elementary units of the SNN, as shown in Table 1.  
Starting from the transfer matrix of a single elementary unit in Equation (1), the model is extended to the whole network, analyzing the input-output interconnections between units. The input level, as described above, defines the input signals; therefore, it is not a processing but a definition level (Figure 2C). Then, the model analyses the interconnections between elementary units in the hidden levels: the outputs of the previous level constitute the inputs of the next one and so on.