joshday / OnlineStats.jl

⚡ Single-pass algorithms for statistics
https://joshday.github.io/OnlineStats.jl/latest/
MIT License
831 stars 62 forks source link

fix type stability in autocov and add a unit test #270

Closed vandenman closed 9 months ago

vandenman commented 9 months ago

Fixes https://github.com/joshday/OnlineStats.jl/issues/269

I tried to make the test a bit less copy-pasta with

for property in (:cross, :m1, :m2, :lag, :wlag, :v)
    @eval begin
        @test (@inferred ((o) -> o.property)(o)) === o.property
    end
end

but unfortunately, that doesn't work since @eval always works in global scope, so I just copy-pasted it.

You can test that this solves the issue with _fit! by running:

@code_warntype OnlineStats._fit!(AutoCov(10), randn(100))

Suggestions, comments, and feedback are welcome!

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7813dc2) 68.47% compared to head (842d085) 68.01%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #270 +/- ## ========================================== - Coverage 68.47% 68.01% -0.46% ========================================== Files 21 21 Lines 1973 1973 ========================================== - Hits 1351 1342 -9 - Misses 622 631 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.