Code for "Coding the matrix"