Hello, I am trying to build a loop that makes a matrix diagnolly dominant (I'm not sure if thats the right term... I mean where the values on the diagnol are from greatest to least... like this
like if I was given this:
I would get this:Code:2 3 7 8 9 2 3 4 5 9 0 6 3 8 4 3
with 9,8,7,6 making this diagnolly dominant.Code:9 2 3 4 3 8 4 3 2 3 7 8 5 9 0 6
I'm not looking for code but am wondering if anyone has any ideas on the simplest way to go about this...
I'm having a hard time thinking on how to approach this, I'm thinking
1) compare the entire first column
2) take the line with the largest first column value and switch
it with first line
3) lock the first line then compare colum 2 in the following 3 lines
put largest value for column 2 line as second line
4) lock the 2nd line check the third column last two lines
if the 3rd line has the larger value switch those as well....
at this point I'm thinking my algorithm is running into trouble...
any suggestions would be greatly appreciated.