Wrote a routine to dump matrix