33
44Solve Yule-Walker equations using Durbin algorithm.
55
6- Solution of NxN system is obtained iteratively, by solving 1x1, 2x2 , ...
6+ Solution of N×N system is obtained iteratively, by solving 1×1, 2×2 , ...
77in succession. For use in computing partial autocorrelation matrix,
8- return the last elements of the successive solutions in vector p[] .
8+ return the last elements of the successive solutions in vector `p` .
99
10- The section 4.7 of Golub,VanLoan "Matrix Computations," 4th ed.,
11- discusses the algorithm in detail.
10+ Reference: Golub, G. H., and C. F. Van Loan. "Matrix computations 4th edition the johns hopkins university press." Baltimore, MD (2013), section 4.7
1211
1312# Arguments
14- - `r::AbstractVector`: first column of a herimitian positive definite
13+ - `r::AbstractVector`: first column of a Herimitian positive definite
1514 Toeplitz matrix, excluding the diagonal element (equal to one).
1615- `y::AbstractVector`: work vector for solution, should have the same length
17- as r[]
16+ as `r`
1817- `p::AbstractVector`: last elements of the successive solutions, should
19- have the same length as r[]
18+ have the same length as `r`
2019
2120# Returns
22- - `y::AbstractVector`: same as the second argument
21+ - `y::AbstractVector`: return the solution vector ( same as the second argument)
2322"""
24- function durbin! (r:: AbstractVector{T} , y:: AbstractVector{T} , p:: AbstractVector{T} ) where T
23+ function durbin! (r:: AbstractVector{T} , y:: AbstractVector{T} , p:: AbstractVector{T} ) where {T}
2524 n = length (r)
2625 n <= length (p) || n <= length (y) || throw (DimensionMismatch (" Auxiliary vectors cannot be shorter than data vector" ))
2726 y[1 ] = - r[1 ]
@@ -48,7 +47,7 @@ function durbin!(r::AbstractVector{T}, y::AbstractVector{T}, p::AbstractVector{T
4847 end
4948 return y
5049end
51- durbin (r:: AbstractVector{T} ) where T = durbin! (r, zeros (T, length (r)), zeros (T, length (r)))
50+ durbin (r:: AbstractVector{T} ) where {T} = durbin! (r, zeros (T, length (r)), zeros (T, length (r)))
5251
5352function levinson! (r:: AbstractVector{T} , b:: AbstractVector{T} , x:: AbstractVector{T} ) where T<: BlasReal
5453 n = length (b)
0 commit comments