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

...at were failing tests.
@isupeene 
added