I found some discussion here about checking contiguity of a vector’s elements:
I might very well implement the inner-vectors as structs, so I think things get complicated. So we can rest the discussion here. Thanks for your help.
As a summary (so I can mark this post as a solution), here are the recommended options:
- vector-of-vectors:
- work well with broadcasting
- inner vectors might not be contiguous in memory
- might be preferable than the next option (see 2 below) if the inner vectors need to be read in arbitrary order
- matrices with inner-vectors as columns:
- would work if the inner-vectors have the same length
- preferable since matrix columns are contiguous in memory (if that’s important)
- columns should be retrieved as views so as not to copy data