matrix2d optimization