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

...at were failing tests.
@isupeene 
Here it might also be wise to assert that the matrices have the same dimension.  I should actually double-check my contracts to make sure this is the case, as well.