January 2020
Intermediate to advanced
532 pages
13h 31m
English
The NamedDims.jl package adds names to each dimension of a multi-dimensional array. The source code can be found at https://github.com/invenia/NamedDims.jl.
Let's take a look at the definition of NamedDimsArray:
"""The `NamedDimsArray` constructor takes a list of names as `Symbol`s,one per dimension, and an array to wrap."""struct NamedDimsArray{L, T, N, A<:AbstractArray{T, N}} <: AbstractArray{T, N} # `L` is for labels, it should be an `NTuple{N, Symbol}` data::Aend
Don't be intimidated by the signature. It is actually quite straightforward.
NamedDimsArray is a subtype of the abstract array type AbstractArray{T, N}. It only contains a single field, data, which keeps track of the underlying data. Because ...
Read now
Unlock full access