Initial implementation of the sparse matrix.

@bsoetaer 
Tests pass when the contracts are disabled.
Should probably not check for contract presence as it couples the contracts into our classes.