Initial implementation of the sparse matrix.

@bsoetaer 
Tests pass when the contracts are disabled.
Pretty sure they do actually have each_with_index as I have used them like that but it is probably doing the same thing underneath.