Matrix function contracts, equals contract, and fixed other contracts th...

...at were failing tests.
@isupeene 
I like this. :)