Adding basic functions to matrix class