adding simple template matrix class which supports matrix inversion