Hello,

What is the optimum representation to use to store vectors over a discrete field.

For example, the discrete field being the 2D pixels of an image or the 3D voxels of an image volume?

I’ll use the 2D pixel field as an example, as the generalization to 3D should be straightforward.

A 2D array with can be instantiated as

an_array::Array{Float64, 2} = zeros(Float64, (n_rows, n_cols))

wheree n_rows and n_cols are the number of rows and columns of, say, an image, respectively.

A 3D vector can be instantiated as

a_vector::Vector{Float64} = [0.0, 0.0, 0.0]

How can I combine the two data structures such that a vector is associated with each pixel?

A concrete example would be the gradient vector at each pixel of an image.