Is there a simple way to vectorize this into an Array{Float64,1}? And more importantly, recover back the nested array with the initial structure?
While just working with non-nested arrays, I could easily use reshape() to vectorise and convert back. Perhaps there is an equivalent? Asking because they are decision variables to an optimizer that only accepts vector inputs.
Hmmm, did you consider having the data in an Array{Float64,1} (as needed by the solver), and then having your matrix of matrices containing views instead? I have to admit I have never created a matrix view from a Vector (i.e., two-dimensional view from one-dimensional data) but I think this direction is more probable than the opposite (one-dimensional view from multiple two-dimensional data sources).
Thanks! I think I made it work using reshape(view(vector, ...), n, m) as a way to recover the structure of the sub 2D arrays. The optimizer was happy with it!