Hello,
Is there a way to easily reconsitute a VectorOfVectors once it has been flattened?
using ArraysOfArrays
# original VectorOfVectors
VV = VectorOfVectors{Float64}()
push!(VV, rand(3))
push!(VV, rand2())
# need to flatten for AD
VV_flat = flatview(VV)
# wish I could do this
VV_nested = nestedview(VV_flat)
VV_nested == VV # please be true
In my use case, it is convenient to use a VectorOfVectors since it simplifies indexing groups of parameters that relate to different aspects of a model. Sadly, ForwardDiff doesn't play nice with this structure as it wants a single vector, hence the initial flattening. I would think this is not so problematic, except that reconsituting the nested view within the function to be optimized seems complicated once dual numbers are involved.
Thanks
Hello,
Is there a way to easily reconsitute a VectorOfVectors once it has been flattened?
In my use case, it is convenient to use a VectorOfVectors since it simplifies indexing groups of parameters that relate to different aspects of a model. Sadly, ForwardDiff doesn't play nice with this structure as it wants a single vector, hence the initial flattening. I would think this is not so problematic, except that reconsituting the nested view within the function to be optimized seems complicated once dual numbers are involved.
Thanks