# A Recursive Least-Squares Algorithm for the Identification of Trilinear Forms
## 3 RLS Algorithm for Trilinear Forms  
In the following, for the sake of consistency with the development of the NLMS-TF algorithm, we will keep the framework and notation from [17]. Therefore, let us consider the output of a multiple-input single-output (MISO) system (with real-valued data) at the discrete-time index \(n\) defined as:  
\[y(n) =\mathbf{\mathcal{X}}(n)\times_{1}\mathbf{h}_{1}^{T}\times_{2} \mathbf{h}_{2}^{T}\times_{3}\mathbf{h}_{3}^{T}\] \[=\sum_{l_{1}=1}^{L_{1}}\sum_{l_{2}=1}^{L_{2}}\sum_{l_{3}=1}^{L_{3 }}x_{l_{1}l_{2}l_{3}}(n)h_{1,l_{1}}h_{2,l_{2}}h_{3,l_{3}}, \tag{12}\]  
where the tensorial form \(\mathbf{\mathcal{X}}(n)\in\mathbb{R}^{L_{1}\times L_{2}\times L_{3}}\) groups the input signals, with:  
\[\left[\mathbf{\mathcal{X}}(n)\right]_{l_{1}l_{2}l_{3}}=x_{l_{1}l_{2}l_{3}}(n),\;l_ {i}=1,2,\ldots,L_{i},\;i=1,2,3,\]  
and the vectors \(\mathbf{h}_{i},\;i=1,2,3\) (of lengths \(L_{1}\), \(L_{2}\), and \(L_{3}\), respectively) define the three impulse responses, i.e.,  
\[\mathbf{h}_{i}=\left[ \begin{array}{cccc}h_{i,1}&h_{i,2}&\cdots&h_{i,L_{i}} \end{array} \right]^{T},\;i=1,2,3.\]  
As we can notice, \(y(n)\) represents a trilinear form (see (12) as compared to (8)), because it is a linear function of each of the vectors \(\mathbf{h}_{i},\;i=1,2,3\), if the other two are fixed. Next, we can also introduce a rank-1 tensor of dimension \(L_{1}\times L_{2}\times L_{3}\), using the three impulse responses of the MISO system:  
\[\mathbf{\mathcal{H}}=\mathbf{h}_{1}\circ\mathbf{h}_{2}\circ\mathbf{h}_{3}, \tag{13}\]  
whose elements are:  
\[\left(\mathbf{\mathcal{H}}\right)_{l_{1}l_{2}l_{3}}=h_{1,l_{1}}h_{2,l_{2}}h_{3,l_ {3}},\;l_{i}=1,2,\ldots,L_{i},\;i=1,2,3.\]  
Consequently, the output signal results in:  
\[y(n)=\operatorname{vec}^{T}\left(\mathbf{\mathcal{H}}\right)\operatorname{vec} \left[\mathbf{\mathcal{X}}(n)\right], \tag{14}\]where:  
\[\text{vec}\left(\mathbf{\mathcal{H}}\right) =\left[ \begin{array}{c}\text{vec}\left(\mathbf{H}_{:1}\right)\\ \vdots\\ \text{vec}\left(\mathbf{H}_{:=L_{3}}\right)\end{array} \right], \tag{15}\] \[\text{vec}\left[\mathbf{\mathcal{X}}(n)\right] =\left[ \begin{array}{c}\text{vec}\left[\mathbf{X}_{:1}(n) \right]\\ \vdots\\ \text{vec}\left[\mathbf{X}_{:L_{3}}(n)\right]\end{array} \right], \tag{16}\]  
with \(\mathbf{H}_{::l_{3}}\) and \(\mathbf{X}_{::l_{3}}(n)\) (\(l_{3}=1,2\ldots,L_{3}\)) being the frontal slices of \(\mathbf{\mathcal{H}}\) and \(\mathbf{\mathcal{X}}(n)\), respectively. At this point, we can introduce the notation:  
\[\mathbf{h} \triangleq\text{vec}\left(\mathbf{\mathcal{H}}\right)=\mathbf{h}_{ 3}\otimes\mathbf{h}_{2}\otimes\mathbf{h}_{1}, \tag{17}\] \[\mathbf{x}(n) \triangleq\text{vec}\left[\mathbf{\mathcal{X}}(n)\right], \tag{18}\]  
where \(\mathbf{h}\) and \(\mathbf{x}(n)\) are two long vectors, each of them having \(L_{1}L_{2}L_{3}\) elements. Thus, the output signal can also be expressed as:  
\[y(n)=\mathbf{h}^{T}\mathbf{x}(n). \tag{19}\]  
The main goal is to estimate the output of the MISO system, which is usually corrupted by an additive noise. Hence, the reference signal results in:  
\[d(n) =y(n)+w(n)\] \[=\mathbf{h}^{T}\mathbf{x}(n)+w(n), \tag{20}\]  
where \(w(n)\) is a zero-mean additive noise, which is uncorrelated with the input signals. Alternatively, we could estimate the global impulse response \(\mathbf{h}\), using an adaptive filter \(\widehat{\mathbf{h}}(n)\) (of length \(L_{1}L_{2}L_{3}\)). At this point, we may also define the error signal:  
\[e(n) =d(n)-\widehat{y}(n)\] \[=d(n)-\widehat{\mathbf{h}}^{T}(n-1)\mathbf{x}(n), \tag{21}\]  
which represents the difference between the reference signal and the estimated signal, \(\widehat{y}(n)\). Based on (17), we can notice that the global impulse response \(\mathbf{h}\) (of length \(L_{1}L_{2}L_{3}\)) results based on a combination of the shorter impulse responses \(\mathbf{h}_{i},\ i=1,2,3\), of lengths \(L_{1}\), \(L_{2}\), and \(L_{3}\), respectively.