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

...at were failing tests.
@isupeene 
s/trace/transpose/