Initial implementation of the sparse matrix.

@bsoetaer 
Tests pass when the contracts are disabled.
I have no idea - it may be that it has different semantics, or it may just be a question of efficiency.