changed format of comparing matrices