optimize matrix type