IndexFunArrays.jl provides a convenient way to work with index dependent functions.
In signal processing it often occurs that an array needs to processed (e.g. applying a window functions) depending on the indices. One could write for loops processing the data in-place. However, a different technique is to create arrays which do not allocate memory but instead generate the desired value when accessed.
The creation of an
IndexFunArray in principle only needs two parameters: size and an index operating function.
The index function operates on the index of an element and could for example create a window function. Size specifies the size of the output array. The resulting
AbstractArray and behaves almost like a normal array but apart from storing the size and the function there is no size dependent memory allocation needed. All values are calculated once they are accessed.
In our packages we already provide several window functions and other index related functions like
rr2 measuring the squared distance to a reference pixel and many more.
AbstractArray it usually can be incorporated to other packages easily.
We also provide several other keyword arguments to specify options like scaling.