Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.
Open in the MATLAB editor: f07at_example
function f07at_example fprintf('f07at example results\n\n'); a = [ -1.34 + 2.55i, 2.80e9 + 3.17e10i, -6.39 - 2.2i; -1.70 - 1.41i, 3.31e10 - 1.50e9i, -0.15 + 1.34i; 2.41e-10 + 3.9e-11i, -0.56 + 1.47i, -8.3e-11 - 6.9e-11i]; % Compute row and column scaling factors thresh = 0.1; [r, c, rowcnd, colcnd, amax, info] = ... f07at(a); % Print rowcnd, colcnd, amax and the scale factors format shorte; fprintf('rowcnd = %8.1e colcnd = %8.1e amax = %8.1e\n', rowcnd, colcnd, amax); fprintf('\nRow scale factors:\n'); disp(r'); fprintf('Column scale factors:\n'); disp(c'); % Compute values close to underflow and overflow small = x02am/(x02aj*x02bh); big = 1/small; if (rowcnd >= thresh) && (amax >= small) && (amax <= big) if colcnd<thresh % Just column scale A as = a*diag(c); end elseif colcnd>=thresh % Just row scale A as = diag(r)*a; else % Row and column scale A as = diag(r)*a*diag(c); end format short fprintf('Scaled Matrix:\n'); disp(as);
f07at example results rowcnd = 5.9e-11 colcnd = 1.4e-10 amax = 3.5e+10 Row scale factors: 2.8986e-11 2.8902e-11 4.9261e-01 Column scale factors: 7.2500e+09 1.0000e+00 4.0163e+09 Scaled Matrix: -0.2816 + 0.5359i 0.0812 + 0.9188i -0.7439 - 0.2561i -0.3562 - 0.2954i 0.9566 - 0.0434i -0.0174 + 0.1555i 0.8607 + 0.1393i -0.2759 + 0.7241i -0.1642 - 0.1365i