Closed fintzij closed 2 years ago
Hi @fintzij,
I'm working on a more extensive generic interface for nested arrays that will also support the upcoming Base.Slices, that'll likely end up in ArrayInterface and will come with a general way or "inverting" a flatten operation.
For now, you can do this as a workaround:
VV_nested = VectorOfVectors(VV_flat, VV.elem_ptr)
VV_nested == VV # true
A nicer API to handle elem_ptr
is also on my to-do list.
Thanks for the quick reply @oschulz! I'll implement your suggestion and keep an eye out for updates to the interface.
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