Note: This package is deprecated in favor of a StaticKernels.jl based implementation.
This package lets you map a function over sliding window slices.
Think of it like Base.mapslices
for sliding window map operations.
A fork of RollingFunctions.jl.
- Functions are named like this
map{slide}
(where slide can beex
,roll
, etc) to follow Julia Base conventions map{slide}
functions work withAbstractArray
not justAbstractVector
- No multi vector methods, use an
AbstractArray
to operate over multiple vectors - No wrappers such as
maproll(mean, ...)
- Currently no weighted map slides
- AccurateArithmetic was removed, no deps other than
DocStringExtensions
for docs
ex
: maps function to expanding slice from current index to the beginning.roll
: maps function to fixed width moving window slices. This operation truncates byτ
.exroll
:ex
for the firstτ
elements (to prevent truncation),roll
thereafter.padroll
: constant padding for the firstτ
elements (to prevent truncation),roll
thereafter.
Use the map{slide}any
to infer the output eltype from the function output instead of using the input array eltype.
Use map{slide}!
(in-place version) if you want to set the output eltype manually.
The roll dimension was hardcoded to the first dimension to avoid type instability with selectdim.
Experiment with map{slide}{!,any}
variations to see if better performance can be found.
Make sure your map function does not introduce type instability.
Please open an issue if you see a potential performance improvement or pitfall.
This package is aimed to be relatively simple, flexible, generic, and readable while avoiding major performance pitfalls.
For very fast execution of common statistical functions you should look elsewhere, there is a lot of great work in that area, see related.
In particular ex
can get very slow for large arrays, mapping across moving slices is powerful but it can be unnecessary/inefficient for certain kinds of operations.
Might add ewm
for exponentially weighted moving map.
- RollingFunctions.jl
- The
mapwindow
function from ImageFiltering - The
slidingwindow
function from MLDataPattern produces a moving window view - StaticKernels
- Fast statistical functions over time: MaxMinFilters.jl, SortFilters