for (int i = 0; i < columns(); i++) {
Serialization.writeMatrixRowCardinality(buffer, nonZerosInColumn(i));
ByteVectorIterator it = nonZeroColumnIterator(i);
while (it.hasNext()) {
it.next();
Serialization.writeMatrixRowIndex(buffer, it.index());
Serialization.writeMatrixValue(buffer, it.get());
}
}
buffer.rewind();