Is there a function to check if a matrix is ​​a diagonal dominant (row dominance)

A matrix is diagonally dominant (row by row) if its diagonal value in the absolute sense is greater than the sum of all other absolute values ​​in this row. The same goes for columns, just the opposite.

Is there a function in matlab for this? (I could write a simple loop, but I'm trying to leave them).

+3
source share
2 answers

Why a cycle?

You can easily sum the absolute values ​​in a given line.

sum(abs(A),2)

Can you compare this to the absolute diagonal elements in each row?

abs(diag(A)) >= sum(abs(A),2)

, , . , .

(2*abs(diag(A))) >= sum(abs(A),2)

, . . , .

all((2*abs(diag(A))) >= sum(abs(A),2))
+14

, . , .

%# create an array
array = magic(3);

%# take the absolute of the array
absArray = abs(array);

%# To be diagonally dominant, the row and column sums have to be less
%# than twice the diagonal
rowSum = sum(absArray,1)';%#' (formatting comment)
colSum = sum(absArray,2);
dia    = diag(absArray);

%# test
isDiagonallyDominantByRow = all(rowSum <= 2 * dia); 
isDiagonallyDominantByCol = all(colSum <= 2 * dia);
isTotallyDominant = isDiagonallyDominantByRow && isDiagonallyDominantByCol;
+2

Source: https://habr.com/ru/post/1739315/


All Articles