mergeBlocks method

List<double> mergeBlocks(
  1. int blocksSize
)

Implementation

List<double> mergeBlocks(int blocksSize) {
  var length = this.length;
  if (length <= blocksSize) return [mean];

  var merge = <double>[];

  for (var i = 0; i < length; i += blocksSize) {
    var end = i + blocksSize;
    if (end > length) end = length;
    var block = sublist(i, end);
    merge.add(block.mean);
  }

  return merge;
}