Implemented matrixToString and isMatrix