splitQ4_0 function
Q4_0 blocks (half scale, then 16 nibble bytes) split into the engine's nibble and scale arrays (lab_native.c); the nibble order is GGUF's.
Implementation
CachedMatrix splitQ4_0(Uint8List blocks, int rows, int cols) {
final count = rows * cols ~/ 32;
final qs = Uint8List(count * 16);
final scales = Uint8List(count * 2);
for (var b = 0; b < count; b++) {
scales[2 * b] = blocks[18 * b];
scales[2 * b + 1] = blocks[18 * b + 1];
qs.setRange(16 * b, 16 * b + 16, blocks, 18 * b + 2);
}
return _RawMatrix('q4', rows, cols, qs, scales);
}