Is it possible to create a 2D array of (2D) arrays in Julia? If so, how can I do it?
I scoured the internet but I did not manage to find out whether this is possible or not. I only managed to find information on creating 1D arrays of arrays. E.g.
A = Array[ [1, 0], [0, 1] ]
creates a 2-element vector whose elements are 2-element vectors of type Int.
Note that with the construction given above, all the elements of the big array will point to the same location in memory, so modifying the elements of a will modify each entry of b
which creates a matrix of integers. We can either nest these, or find other ways to create a matrix per entry, for example we could create the same with constant entries
Then every entry is a 2x2 matrix, where each 2x2 matrix has the value from before.
You can also see in the type Matrix{Matrix{Float64}} that this is a matrix of matrices.
It creates a vector of Array, where Array has not specification of either dimensionality or element type. To get Vector{Vector{Int}}, remove the type specification at the start: