added pointer abstraction to matrix class