## 5 MPDD Algorithm
### Least Squares and Constrained Least Squares  
In [12], the Least Squares (LS) problem was simply the minimisation of the error \(\epsilon\) in Equation (3). To reduce false alarms caused by noise, an updated version has been developed corresponding to the problem:  
\[\begin{array}{ll}\min&\epsilon\\ \text{subject to}&w_{i}>0,\ i=1,\ldots,M.\end{array} \tag{7}\]  
This is a Constrained Least Squares (CLS) minimisation of Equation (3) with the constraint that the coefficients of the filter are all positive. This means that only positive ideal correlations are used to model the measured correlation. We can adopt this model even if we know that components in counter-phase introduce negative correlations. The negative data will be erroneously modelled, since the method is constrained to assign positive weights to each correlation replica. If the replica is negative the algorithm will construct multiple weights in an effort to minimise the minimum Mean Square Error (MSE). This does not allow the correct identification of the negative replica, but the multiple weights indicate that a replica exists, and this is sufficient for detecting the presence of anomalies.  
The decision metric is the same of the original algorithm, so we compute the square distances between \(\hat{\mathbf{w}}\) and a dictionary of sample vectors \(V\). By observing these distances we are able to decide if the correlation function presents distortions. The dictionary \(V\) takes into account different scenarios, including LOS condition with no extra signals (\(\mathbf{w}_{LOS}\)) and multipath with multiple rays (\(\mathbf{w}_{k}\)).  
\[E_{LOS}=\|\hat{\mathbf{w}}-\mathbf{w}_{LOS}\|^{2}\]  
and  
\[E_{k}=\|\hat{\mathbf{w}}-\mathbf{w}_{k}\|^{2}\qquad k=1,2,...N_{v}-1\]  
where \(N_{v}\) is the number of vectors in the dictionary \(V\). The anomalies are present if  
\[E_{k}<E_{LOS}\qquad k=1,2,...N_{v}-1\]  
or  
\[\min_{k=1,2,...N_{v}-1}(E_{k},E_{LOS})\
eq E_{LOS}\]  
The advantage of CLS is the reduction of the possible entries of the dictionary in the decision phase.  
The CLS minimization adopted here is based on the Non-Negative Least Squares, method described in [24]. In the presence of noise the traditional LS estimates the input noise as a weighted sum of delayed replicas of the input signal, which is a suitable model for the MP channel but does not fit well to the WGN channel. As a consequence, the system adds a high number of positive and negative \(w_{i}\) coefficients in order to model the WGN contribution. The result is a highly noisy solution.  
A constraint is then put here on the possible values of the \(w_{i}\) coefficients. In particular, they can be only positive. As already said, this constraint appears not suitable to estimate a MP channel where LOS and MP components have different phase sign. In such cases, in order to properly estimate the signal components, negative \(w_{i}\) coefficients would be needed. However, it has to be noted that the goal of the algorithm is not to properly estimate the signal as a weighted sum of components, but to detect if anomalies are present in the signal, discriminating between the only-LOS case and all the other unwanted cases. If a counter-phase component is present, then the CLS estimates non-null \(w_{i}\) coefficients with shorter delay with respect to the LOS. Such an anomalous behaviour detects the presence of counter-phase MP.  
In case of only LOS presence without noise, the LS and CLS solutions are equivalent. In general, the CLS algorithm will give less non-null coefficients than LS.