Minimize matrix.