File tree 1 file changed +6
-6
lines changed 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -63,23 +63,23 @@ function autocov!(
63
63
r:: AbstractVector ,
64
64
x:: AbstractVector ,
65
65
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 ));
67
67
demean:: Bool = true
68
- )
68
+ )
69
69
lx = length (x)
70
70
m = length (lags)
71
- length (r) == m || throw (DimensionMismatch ())
71
+ length (r) == length (z) == m || throw (DimensionMismatch ())
72
72
check_lags (lx, lags)
73
73
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
76
76
end
77
77
return r
78
78
end
79
79
80
80
function autocov! (
81
81
r:: AbstractMatrix , x:: AbstractMatrix , lags:: AbstractVector{<:Integer} ; demean:: Bool = true
82
- )
82
+ )
83
83
T = typeof (zero (eltype (x)) / 1 )
84
84
z = Vector {T} (undef, size (x, 1 ))
85
85
for n in 1 : size (x, 2 )
You can’t perform that action at this time.
0 commit comments