Refactor matrix tests to increase readability
Fix a typo
Replace iterators by `for` loops

All the other functions use `for` loops instead of iterators. It's better
to be consistent.
Merge pull request #337 from thilinarmtb/refactor

Refactor Matrix module