matrix class and unit tests