weave function

Float32List weave(
  1. List<num> a,
  2. List<num> b
)

combine two lists into one with alternating elemnts a1, a2, a3, b1, b2, b3 -> a1, b1, a2, b2, a3, b3 ...

Implementation

Float32List weave(List<num> a, List<num> b) {
  final res = Float32List.fromList(List<double>.filled(a.length + b.length, 0));
  for (int i = 0; i < a.length; i++) {
    res[2 * i] = a[i].toDouble();
    res[2 * i + 1] = b[i].toDouble();
  }
  return res;
}