offsets method
Matrix name's format and the byte offsets and lengths in file of
its values and scales, or null if it is absent or of another shape.
Implementation
({String format, int qs, int scales, int end})? offsets(
String name,
int rows,
int cols,
) {
final e = _entries[name];
if (e == null || e['rows'] != rows || e['cols'] != cols) return null;
final format = (e['format'] ?? 'q8') as String;
final scales = e['scales'] as int;
final scaleBytes = rows * cols ~/ 32 * (format == 'q4' ? 2 : 4);
return (
format: format,
qs: e['qs'] as int,
scales: scales,
end: scales + scaleBytes,
);
}