Checks if two matrices have equal sizes.