documentation for coding the matrix