function [B,i] = diagdom (A,tol) % DIAGDOM % % [B, i] = diagdom (A, tol) % % DIAGDOM returns a diagonally dominant matrix B by modifying the % diagonal of A. If row i violates diagonal dominance, then A(i,i) is % modified by setting it so that its absolute value is (1+tol)*f, where % f is the sum of the absolute values of the off-diagonal entries in row i % (assuming f is large enough). If f is smaller than tol, then the absolute % value of A(i,i) is set to (1+tol)*tol. The sign of A(i,i) is preserved. % The input argument tol is optional; if not present, a default value of % 100*eps is used. The outputs are B (the modified matrix) and a vector i % that contains a list of the row indices of the rows that violated % diagonal dominance. % % MATLAB Primer, 6th Edition % Kermit Sigmon and Timothy A. Davis % Section 9.5, page 53. % error ('diagdom mexFunction not found') ;