Initial implementation of the sparse matrix.

@bsoetaer 
Tests pass when the contracts are disabled.
Test code that should be taken out once problem solved.