interleavedSplit method

List<FVector> interleavedSplit(
  1. int count
)

Breaks the vector into count different vectors.

It considers the vector to be a table(LTR,TTB) with count columns, and returns each column as seperate vector. The length of the vector must be divisable by count

Implementation

List<FVector> interleavedSplit(int count) {
  assert(nRows % count == 0);
  int eachLength = nRows ~/ count;
  int eachLengthUp4 = roundUp4(eachLength);
  Int32List inputI32 = columnData.buffer.asInt32List();
  return List.generate(count, (index) {
    Int32List output = Int32List(eachLengthUp4);

    for (int p = index, c = 0; p < nRows; p += count, c++) {
      output[c] = inputI32[p];
    }
    return FVector.fromBuffer(eachLength, output.buffer.asFloat32x4List());
  });
}