Unify and simplify matrices and vectors.