Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

HaedronResearch/MapSlide.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapSlide.jl

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.

Differences to RollingFunctions.jl

  • Functions are named like this map{slide} (where slide can be ex, roll, etc) to follow Julia Base conventions
  • map{slide} functions work with AbstractArray not just AbstractVector
  • 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

Available Window Slides (w: window size, τ: lag (w-1))

  • 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.

Notes

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.

Performance Notes

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.

Future Work

Might add ewm for exponentially weighted moving map.

Related

Thanks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%