Initial implementation of the sparse matrix.

@bsoetaer 
Tests pass when the contracts are disabled.
why the _? I believe it will work with just |type|