Coding the matrix