MAtrix size check