added generic matrix class