## 3 The Proposed Localization Algorithm
### Localization Algorithm  
The proposed LSRR-LA contains the following three parts: the measurement part, the training part, and the localization part. **Part A (Measurement)**: Assuming that \(\mathbf{h}_{i}=[h_{1,i},\,...,\,h_{m,i}]^{\text{T}}\), \(i=1,\,...,\,m\) is the hop-count vector from anchor \(N_{i}\in\mathbf{A}\) to the other anchors, we thus can describe the hop-count matrix of all anchors as \(\mathbf{H}_{1}=[\mathbf{h}_{1},\,...,\,h_{m}]\). Accordingly, the Euclidean distance vector and matrix between anchors can be represented as \(\mathbf{d}_{i}=[d_{1,i},\,...,\,d_{m,i}]^{\text{T}}\), \(i=1,\,...,\,m\) and \(\mathbf{D}_{1}=[\mathbf{d}_{1},\,...,\,\mathbf{d}_{m}]\), respectively. For any sensor node \(N_{j}\in\mathbf{B}\), it has a hop-count vector to all anchors, \(\mathbf{h}_{j}=[h_{1,j},\,...,\,h_{m,j}]^{\text{T}}\), \(j=m+1,\,...,\,m+n\). Consequently, matrix \(\mathbf{H}_{2}=[\mathbf{h}_{m+1},\,...,\,\mathbf{h}_{m+n}]\) indicates the hop-count vectors from all of the sensor nodes to all of the anchors. On referring to Formula (10), we express the hop-count matrix \(\mathbf{H}\) (or the distance matrix \(\mathbf{D}\)) by splitting it into four parts. We denote by \(\mathbf{H}_{1}\) (resp. \(\mathbf{D}_{1}\)) the \(m\,\times\,m\) matrix for the anchors versus themselves, \(\mathbf{H}_{3}\) (resp. \(\mathbf{D}_{3}\)) the \(n\,\times\,m\) matrix for the anchors versus sensors, and \(\mathbf{H}_{4}\) (resp. \(\mathbf{D}_{4}\)) the \(n\,\times\,n\) matrix for the sensors versus themselves. It is easy to know that \(\mathbf{H}_{2}=\mathbf{H}_{3}{}^{\text{T}}\), \(\mathbf{D}_{2}=\mathbf{D}_{3}{}^{\text{T}}\). \[\mathbf{H}\mathbf{=}\left[ \begin{array}{ccccccccc}\mathbf{H}_{1}&\mathbf{H }_{2}\\ \mathbf{H}_{3}&\mathbf{H}_{4}\end{array} \right]=\left[ \begin{array}{ccccccccc} h_{1,1}&h_{1,2}&\cdots&h_{1,m}&h_{1,m+1}&h_{1,m+2}&\cdots&h_{1,m+n}\\ h_{2,1}&h_{2,2}&\cdots&h_{2,m}&h_{2,m+1}&h_{2,m+2}&\cdots&h_{2,m+n}\\ \vdots&\vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\ h_{m,1}&h_{m,2}&\cdots&h_{m,m}&h_{m,m+1}&h_{m,m+2}&\cdots&h_{m,m+n}\\ h_{m+1,1}&h_{m+1,2}&\cdots&h_{m+1,m}&h_{m+1,m+1}&h_{m+1,m+2}&\cdots&h_{m+1,m+ \pi}\\ h_{m+2,1}&h_{m+2,2}&\cdots&h_{m+2,m}&h_{m+2,m+1}&h_{m+2,m+2}&\cdots&h_{m+2,m+ \pi}\\ \vdots&\vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\ h_{m+n,1}&h_{m+n,2}&\cdots&h_{m+n,m}&h_{m+n,m+1}&h_{m+n,m+2}&\cdots&h_{m+n,m+ \pi}\\ \end{array} \right],\quad\mathbf{D}_{m}\left[ \begin{array}{cc}\mathbf{D}_{1}& \mathbf{D}_{2}\\ \mathbf{D}_{3}&\mathbf{D}_{4}\end{array} \right] \tag{10}\]  
Note that \(\mathbf{H}_{1}\), \(\mathbf{H}_{3}\), and \(\mathbf{H}_{4}\) are known, while \(\mathbf{D}_{3}\) and \(\mathbf{D}_{4}\) are unknown. The goal is to predict \(\mathbf{D}_{3}\) (or \(\mathbf{D}_{2}\)) from \(\mathbf{H}\) and \(\mathbf{D}_{1}\). **Part B (Training)**: Now, we have the input matrix denoted by \(\mathbf{H}_{1}\) and the output matrix represented as \(\mathbf{D}_{1}\), and then we can train our linear model proposed in formula (4). However, as a difference from (4), here the coefficient vector \(\mathbf{w}\) becomes a matrix \(\mathbf{W}\) with \(m\,\times\,m\), and the outputs are stored in the matrix \(\mathbf{D}_{1}\). Thus, the LLS solution becomes  
\[\hat{\mathbf{W}}={\left(\mathbf{H}_{1}^{\text{T}}\mathbf{H}_{1}\right)}^{-1} \mathbf{H}_{1}^{\text{T}}\mathbf{D}_{1}. \tag{11}\]  
In Formula (11), the variation range of the distance matrix \(\mathbf{D}_{1}\) is different from that of the hop-count matrix \(\mathbf{H}_{1}\). If the raw data is used directly, the calculation results will be affected due to the different variation range. We can eliminate this impact by preprocessing operations, such as normalization, making \(\mathbf{D}_{1}\) and \(\mathbf{H}_{1}\) have the same scale and to be equally emphasized. In this paper, the normalized matrices of \(\mathbf{H}_{1}\) and \(\mathbf{D}_{1}\) are represented by \(\mathbf{\widetilde{H}}_{1}\) and \(\mathbf{\widetilde{D}}_{1}\), respectively. When calculating the model parameter \(\mathbf{W}\), we use the data of anchor nodes.