add matrix class

added matrix class and tests