MAHOUT-1578 Optimizations in matrix serialization

MAHOUT-1578: Optimizations in matrix serialization