Coding the Matrix class from Philip Klein: my code for the class