Matrix shape predicates and tests