sorted methods in matrix