changeset 25379:71cc81aad717

maint: merge stable to default.
author Rik <rik@octave.org>
date Tue, 15 May 2018 11:47:21 -0700
parents b75d55b3dbb7 (current diff) 8e30ef611002 (diff)
children 072494014e76
files
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/polynomial/residue.m	Tue May 15 01:28:40 2018 -0400
+++ b/scripts/polynomial/residue.m	Tue May 15 11:47:21 2018 -0700
@@ -261,8 +261,11 @@
   endfor
 
   ## Solve for the residues.
-
-  r = A \ B;
+  ## FIXME: Use a pre-conditioner d to make A \ B work better (bug #53869).
+  ##        It would be better to construct A and B so they are not close to
+  ##        singular in the first place.
+  d = max (abs (A), [], 2);
+  r = (diag (d) \ A) \ (B ./ d);
 
 endfunction
 
@@ -373,7 +376,7 @@
 %! assert (isempty (k));
 %! assert (e, [1; 2; 1; 2]);
 %! [br, ar] = residue (r, p, k);
-%! assert (br, [0,b], 1e-12);
+%! assert (br, b, 1e-12);
 %! assert (ar, a, 1e-12);
 
 %!test