## SPcovLXpc

#### Routine

double SPcovLXpc (const float *Cov[], float pc[], int Np)

#### Purpose

Find predictor coefficients using the covariance lattice method

#### Description

This routine calculates the parameters for a lattice predictor which minimizes the sum of the forward and backward errors. The reflection coefficients which describe the lattice filter are converted to the predictor coefficients which are returned. This procedure guarantees a minimum phase prediction error filter.

Consider a linear predictor with Np coefficients,

```          Np
y(k) = SUM p(i) x(k-i) ,
i=1
```
where x(i) is the input signal. This routine finds the predictor cofficients.

This procedure is based on Makhoul's covariance lattice method. The reflection coefficients are chosen to minimize the sum of the forward and backward prediction errors.

The computation uses a correlation matrix Cov with elements defined as

```  Cov(i,j) = E[x(k-i) x(k-j)],  for 0 <= i,j <= Np.
```

The expectation operator E[.] is often replaced by a sum over k over a finite interval. Minimization of the prediction error over this interval defines the so-called covariance method for determining the linear prediction coefficients.

Reference:
1: J. Makhoul, "Stable and efficient lattice methods for linear prediction", IEEE Trans. Acoustics, Speech, Signal Processing, vol. ASSP-25, pp. 423-428, October 1977.

Predictor coefficients are usually expressed algebraically as vectors with 1-offset indexing. The correspondence to the 0-offset C-arrays is as follows.

```  p(1) <==> pc       predictor coefficient corresponding to lag 1
p(i) <==> pc[i-1]     1 <= i < Np
```

#### Parameters

<- double SPcovCXpc
Resultant prediction error energy
-> const float *Cov[]
Cov is an array of pointers to the rows of an Np+1 by Np+1 symmetric positive definite correlation matrix. Only the lower triangular portion of Cov is accessed. Note that with ANSI C, if the actual parameter is not declared to have the const attribute, an explicit cast to (const float **) is required.
<- const float pc[]
Np element vector of predictor coefficients. Coefficient pc[i] is the predictor coefficient corresponding to lag i+1.
-> int Np
Number of prediction coefficients

#### Author / revision

P. Kabal / Revision 1.9 2003/05/09