Refactoring matrix and vector tests according to their implementation.