title: Sort a numpy matrix based on its diagonal
body: <p>I have a matrix that should have ones on the diagonal but the columns are mixed up. </p>
  
  <p><img src="https://i.stack.imgur.com/uZS20.png" alt="Messed up matrix"></p>
  
  <p>But I don't know how, without the obvious for loop, to efficiently interchange rows to get unity on the diagonals. I'm not even sure what key I would pass to sort on. </p>
  
  <p>Any suggestions?</p>