A = [1 2 -1 1; -1 -2 -3 2; 2 1 -1 -5; 1 1 1 1]
A =
1 2 -1 1
-1 -2 -3 2
2 1 -1 -5
1 1 1 1
●
if A(K,K) < sum(A(K,:)) - A(K,K)
fprintf('A(%d,%d) is not dominant!\n', K, K);
end
A(1,1) is not dominant!
A(4,4) is not dominant!
If you look at that last row of all 1's, you can see that no matter which row you put it in, the diagonal element would be 1 and the sum of the non-diagonal entries in the row would be 3, so it is not possible to move the last row to a different row to make the overall matrix diagonally dominent.
if A(J,K) >= sum1 - A(J,K)
fprintf('A(%d,:) would be dominant if it were in row %d\n', J, K);
fprintf('A(%d,:) cannot be dominant in any row!\n', J);
end
A(1,:) would be dominant if it were in row 2
A(2,:) would be dominant if it were in row 1
A(2,:) would be dominant if it were in row 2
A(2,:) would be dominant if it were in row 4
A(3,:) would be dominant if it were in row 1
A(3,:) would be dominant if it were in row 2
A(3,:) would be dominant if it were in row 3
A(4,:) cannot be dominant in any row!
if NA(K,K) < sum(NA(K,:)) - NA(K,K)
fprintf('NA(%d,%d) is not dominant!\n', K, K);
So exchanging rows 1 and 2 gets you closer, but you still have the problem of that 4th row, which cannot be dominant no matter which row it is moved to.
Best Answer