write static method
Writes matrices to path under key, through a temporary file and
a rename so a reader never maps a half-written cache.
Implementation
static void write(
String path,
String key,
Map<String, CachedMatrix> matrices,
) => writeEach(path, key, [
for (final MapEntry(key: name, value: m) in matrices.entries)
(name, m.format, m.rows, m.cols),
], (name) => matrices[name]!);