JuliennedArrays.jl

JuliennedArrays.jl

struct True
source
struct False
source
Slices(array, code...)

Slice array into views. code shows which dimensions will be replaced with : when slicing.

julia> using JuliennedArrays

julia> it = [1 2; 3 4];

julia> slices = Slices(it, False(), True())
2-element Slices{SubArray{Int64,1,Array{Int64,2},Tuple{Int64,Base.OneTo{Int64}},true},1,Array{Int64,2},Tuple{False,True}}:
 [1, 2]
 [3, 4]

julia> slices[1] == it[1, :]
true
source
Align(it, along...)

Align an array of arrays, all with the same size. along shows which dimensions will be taken up by the inner arrays. Inverse of Slices.

julia> using JuliennedArrays

julia> array = [[1, 2], [3, 4]];

julia> aligned = Align(array, False(), True())
2×2 Align{Int64,2,Array{Array{Int64,1},1},Tuple{False,True}}:
 1  2
 3  4

julia> aligned[1, :] == array[1]
true
source