Add matrix class