StaticThings.jl
StaticThings provides tools to help write generic code that works with both static and non-static values and arrays. It bridges between Static values, StaticArrays and FillArrays, as well as non-static values and arrays.
The package provides the type aliases StaticUnitRange, StaticOneTo, IntegerLike, RealLike, SizeLike, StaticSizeLike, AxesLike, StaticAxesLike, OneToLike, StaticOneToLike and StaticUnitRangeLike, as union-based super-types for related types across Static, StaticArrays and Base.
Built around these alias types, StaticThings provides:
Generative functions:
maybestatic_oneto,asnonstatic,maybestatic_fill,staticarray_typeandmaybestatic_reshape.Length/size/axes query functions:
maybestatic_length,maybestatic_size,maybestatic_axes,maybestatic_eachindex,maybestatic_first,maybestatic_lastandsize_from_type.Size/axes conversion functions:
axes2size,size2axes,size2length,asaxes,canonical_indices,canonical_sizeandcanonical_axes.
When creating arrays, StaticThings prefers allocation-free types like StaticArrays.SArray and FillArrays.Fill where feasible.