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: f07af_example
function f07af_example fprintf('f07af example results\n\n'); a = [ 1.8e10, 2.88e10, 2.05, -8.9e09; 5.25, -2.95, -9.5e-09, -3.8; 1.58, -2.69, -2.9e-10, -1.04; -1.11, -0.66, -5.9e-11, 0.8]; % Compute row and column scaling factors thresh = 0.1; [r, c, rowcnd, colcnd, amax, info] = ... f07af(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);
f07af example results rowcnd = 3.9e-11 colcnd = 1.8e-09 amax = 2.9e+10 Row scale factors: 3.4722e-11 1.9048e-01 3.7175e-01 9.0090e-01 Column scale factors: 1.0000e+00 1.0000e+00 5.5263e+08 1.3816e+00 Scaled Matrix: 0.6250 1.0000 0.0393 -0.4269 1.0000 -0.5619 -1.0000 -1.0000 0.5874 -1.0000 -0.0596 -0.5341 -1.0000 -0.5946 -0.0294 0.9957