slice method

FVector slice(
  1. int offset,
  2. int length
)

Implementation

FVector slice(int offset, int length) {
  FVector newVec = FVector.zero(length);
  assert(offset + length <= nRows && offset >= 0 && length > 0);
  var dest32 = newVec.columnData.buffer.asInt32List();
  var source32 = columnData.buffer.asInt32List(offset * 4);
  int start = 0;
  if (offset % 4 == 0) {
    for (int i = 0; i < length ~/ 4; ++i)
      newVec.columnData[i] = columnData[i + offset ~/ 4];
    start = length - (length % 4);
  }
  for (int i = start; i < length; ++i) {
    dest32[i] = source32[i];
  }
  return newVec;
}