You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A somewhat frequently-requested feature (e.g. #197, #590, #607) is to provide methods to create Array instances from nested Vec and/or ArrayBase instances (e.g. Array2<A> from Vec<Vec<A>> or Array3<A> from Vec<Array2<A>>).
Note that it's generally advisable to avoid nested Vec/ArrayBase types like this because they require extra heap allocations, can scatter data all over memory, cause unnecessary indirection, fail to enforce consistent shape within the nested Vecs/ArrayBases, and are generally more difficult to work with.
I think we should:
Improve the documentation to explain why these nested data structures are best avoided and the best way to handle the use cases (primarily constructing an Array by appending rows).
For users who need to use nested data structures anyway, either add the methods to perform the conversions or suggest how they could perform the conversion manually. (data.iter().flatten().cloned().collect::<Vec<_>>() followed by from_shape_vec seems pretty clean if the user is confident that the nested Vecs/ArrayBases are all the same length/shape).
The text was updated successfully, but these errors were encountered:
A somewhat frequently-requested feature (e.g. #197, #590, #607) is to provide methods to create
Array
instances from nestedVec
and/orArrayBase
instances (e.g.Array2<A>
fromVec<Vec<A>>
orArray3<A>
fromVec<Array2<A>>
).Note that it's generally advisable to avoid nested
Vec
/ArrayBase
types like this because they require extra heap allocations, can scatter data all over memory, cause unnecessary indirection, fail to enforce consistent shape within the nestedVec
s/ArrayBase
s, and are generally more difficult to work with.I think we should:
Array
by appending rows).data.iter().flatten().cloned().collect::<Vec<_>>()
followed byfrom_shape_vec
seems pretty clean if the user is confident that the nestedVec
s/ArrayBase
s are all the same length/shape).The text was updated successfully, but these errors were encountered: