## 2 Methods
### Improved Calculation Method
#### 2.4.3 Measurement Expression and Framework Implementation  
Reformulations (11)-(13) are very useful and have huge advantages. If we want to get enough benefits from the algorithmic framework developed by FNNs, then we must calculate the following equation accurately:  
\[prox_{\lambda\psi}^{Q}(Z)=\underset{U\in R^{k\times N}}{\text{argmin}}\frac{1} {2}\|U-Z\|_{F,Q}^{2}+\lambda\psi(U) \tag{14}\]  
Among the rest, \(\|\cdot\|_{F,Q}=\sqrt{tr\Big{(}(\cdot)Q(\cdot)^{T}\Big{)}}\) is the norm, and it is Q-weighted Frobenius. It is apparent that Z is a matrix where the N samples associated with the training set have been stacked columnwise. A similar convention is used to construct X and Y from \(\big{(}x_{i}\big{)}_{1\leq j\leq N}\) and \(\big{(}y_{j}\big{)}_{1\leq j\leq N}\). An elastic-net-like regularization is chosen by setting  
\[\psi=\|\cdot\|_{1}+l_{[0,+\infty)}^{k*N}+\frac{\beta}{2\lambda}\|\cdot\|_{F}^ {2}\text{ with }\beta\in(0,+\infty) \tag{15}\]  
We observed that the last quadratic term has a positive influence on increasing stability and avoiding overfitting. Equation (14) is actually equivalent to solving the next problem:  
\[\underset{U\in[0,+\infty)^{k\times N}}{\text{minimize}}\frac{1}{2}\|D(U-Z)\|_ {F}^{2}+\frac{\alpha}{2}\|U-Z\|_{F}^{2}+\frac{\beta}{2}\|U\|_{F}^{2}+\lambda \|U\|_{1} \tag{16}\]Various iterative splitting methods can be used to discover the unique minimization of the optimized convex function [77; 78]. Our goal is to develop an algorithmic solution for which classical NN learning techniques can be applied in a fast and convenient manner. We show next the following property. The solution of Equation (16) is obtained as an iteration of the form:  
\[U_{t+1}=\text{Re}LU\Big{(}\Big{(}h1^{T}\Big{)}\Theta Z+\widetilde{W}(U_{t}-Z)- b1^{T}\Big{)} \tag{17}\]  
Among the rest, \(\widetilde{W}\) is a symmetric k\(\ast\)k matrix, \(h\in[0,1]^{k},b\in[0,+\infty]^{k}\), and one more point \(1=[1,\ldots,1]^{T}\in R^{N}\). By a complete subdifferent calculus, the solution U to the problem (14) satisfies the following important optimal condition:  
\[0\in Q(U-Z)+\beta U+\lambda\partial\widetilde{\psi}(U) \tag{18}\]  
where \(\widetilde{\psi}=\|\cdot\|_{1}+l_{[0,+\infty)}^{\ast N}\). For Equation (16), every \(i\in\{1,\ldots,k\}\), and \(j\in\{1,\ldots,N\}\), and the following equality holds:  
\[0\in\sum\limits_{l=1}^{k}q_{i,l}\Big{(}u_{lj}-z_{lj}\Big{)}+\beta u_{i,j}+ \left\{ \begin{array}{l}(-\infty,\lambda],u_{i,j}=0\\ \lambda,u_{i,j}>0\\ \Phi,u_{i,j}<0\end{array} \right. \tag{19}\]  
Let us adopt a block-coordinate approach and update the i row of U by fixing all the other ones. As Q is a positive definite matrix, \(q_{i,i}>0\), and Equation (19) implies that all of these things can be expressed and calculated. Although \(\widetilde{W}\), \(h\), and \(b\) are defined on the basis of matrix \(Q\), for more flexibility, we will treat them as decoupled variables. Then, given independent \(\widetilde{W}\), \(h\), and \(b\), they can be viewed as an RNN structure for which \(U_{t}\) is the hidden variable and \(Z\) is a constant input over time. By taking advantage of existing gradient backpropagation techniques for RNNs, \(\Big{(}\widetilde{W},h,b\Big{)}\) can thus be directly computed in order to minimize the global loss \(L\). This shows that q-metric learning has been recast as the training of a specific RNN. Note that \(Q\) is a \(k\times k\) symmetric matrix. In order to reduce the number of parameters and increase the ease of optimizing them, we choose a block-diagonal structure for Q. In addition, for each of the blocks, either an arbitrary or convolution structure can be adopted. Since the structure of \(Q\) is reflected by the structure of \(\widetilde{W}\), this leads to fully connected or convolution layers where the channel outputs are linked to nonoverlapping blocks of the inputs. We finally transformed our deep dictionary learning network approach in an alternation of linear layers and specific RNNs.