sortByDimnames function

Sort matrix by dim names