let assertMatrix more flexible
improve the iterators (only iterates nonzero entries) and tests