Home of ALP/GraphBLAS and ALP/Pregel, featuring shared- and distributed-memory auto-parallelisation of linear algebraic and vertex-centric programs. Soon with more to come!
InterleavedIterators wrap n input iterators and returns another iterator that iterates over the elements of each of the input iterators in an interleaved fashion. E.g., if there are two input iterators i and j that iterate over the following vectors:
i: {1,54,3,76,12,65 };
j: {243, 2, 76 };
then an interleaved iterator iterates over the following virtual vector: {1, 243, 54, 2, 3, 76, 76, 12, 65 };
[ ] finish rename from ChainedIterator to InterleavedIterator
[ ] The ChainedIterator currently implements += and -= as a loop-over ++ and --. The implicit contract for += is that it can skip forward multiple places in O(1) time, otherwise it's like std::forward instead
[ ] Relatedly, the iterator category of the chained iterator / interleaved iterator should be a forward iterator or a bi-directional iterator -- even if it derives exclusively from random access iterators. The reason is item no. 6 directly above this point. (See e.g. also the filteredIterator, which also discards any random access property of the sub-iterator for similar reasons.)
[ ] Alternatively, the implementation of InterleavedIterator could rely on mod and div operations to have it support true (O(1)) random access iteration. However, this only applies for the case where all input iterators it employs are also random access-- otherwise again necessarily the composed iterator cannot be random access.
InterleavedIterators wrap n input iterators and returns another iterator that iterates over the elements of each of the input iterators in an interleaved fashion. E.g., if there are two input iterators i and j that iterate over the following vectors:
then an interleaved iterator iterates over the following virtual vector:
{1, 243, 54, 2, 3, 76, 76, 12, 65 };