simplify definition of matrix classes