File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -63,23 +63,23 @@ function autocov!(
6363 r:: AbstractVector ,
6464 x:: AbstractVector ,
6565 lags:: AbstractVector{<:Integer} ,
66- z= Vector {typeof(zero(eltype(x)) / 1)} (undef, size (x, 1 ));
66+ z:: Vector = Vector {typeof(zero(eltype(x)) / 1)} (undef, length (x ));
6767 demean:: Bool = true
68- )
68+ )
6969 lx = length (x)
7070 m = length (lags)
71- length (r) == m || throw (DimensionMismatch ())
71+ length (r) == length (z) == m || throw (DimensionMismatch ())
7272 check_lags (lx, lags)
7373 demean ? z .= x .- mean (x) : copyto! (z, x)
74- for k = 1 : m # foreach lag value
75- r[k] = _autodot (z, lx, lags[k] ) / lx
74+ @inbounds for (k, lags_k) in zip ( eachindex (r), lags) # foreach lag value
75+ r[k] = _autodot (z, lx, lags_k ) / lx
7676 end
7777 return r
7878end
7979
8080function autocov! (
8181 r:: AbstractMatrix , x:: AbstractMatrix , lags:: AbstractVector{<:Integer} ; demean:: Bool = true
82- )
82+ )
8383 T = typeof (zero (eltype (x)) / 1 )
8484 z = Vector {T} (undef, size (x, 1 ))
8585 for n in 1 : size (x, 2 )
You can’t perform that action at this time.
0 commit comments