I have a few small packages for dealing with arrays of arrays, and similar things, which perhaps deserve announcement here:
-
LazyStack.jl has one function
stack
which glues an array of arrays into one big one. It is also happy to take a generator, likestack(f(x) for x in eachslice(A))
, or a function to map over slices, likestack(f, eachcol(x), eachcol(y))
, in which case it writes into a new array, widening the type if necessary. The slices must all be the samesize
, and are stacked along new dimension(s).
There is also a ragged variant rstack
, which makes enough space for the largest slice. You can use OffsetArrays to control their positions.
-
SliceMap.jl is much narrower, aiming to provide a fast, differentiable, version of
mapslices
, primarily for columns of a matrix. There are various versions of this, some with static-array slices, and some which run multi-threaded. (By differentiable I mean that it defines gradients for Tracker & Zygote.) -
StarSlice.jl is an experiment with notation for slicing, which overloads
A[:,*]
to meancollect.(eachcol(A))
, and variants of that. Perhaps useful formapslices
type things, and perhaps as a way to write reductions. (This is not yet registered.)