Mercurial > hg > octave-nkf
comparison scripts/polynomial/polygcd.m @ 19416:5d3111977623
Change a polygcd test to one that is more numerically accurate (bug #42742).
* polygcd.m: Decreased the multiplier for the random polynomial coefficient
test and increased number of tests by a factor of ten.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Sun, 05 Oct 2014 11:23:25 -0500 |
parents | d63878346099 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19415:eeb2a01cdc26 | 19416:5d3111977623 |
---|---|
89 | 89 |
90 %!assert (polygcd (poly (1:8), poly (3:12)), poly (3:8), sqrt (eps)) | 90 %!assert (polygcd (poly (1:8), poly (3:12)), poly (3:8), sqrt (eps)) |
91 %!assert (deconv (poly (1:8), polygcd (poly (1:8), poly (3:12))), poly (1:2), sqrt (eps)) | 91 %!assert (deconv (poly (1:8), polygcd (poly (1:8), poly (3:12))), poly (1:2), sqrt (eps)) |
92 | 92 |
93 %!test | 93 %!test |
94 %! for ii=1:10 | 94 %! for ii=1:100 |
95 %! p = (unique (randn (10, 1)) * 10).'; | 95 %! ## Exhibits numerical problems for multipliers of ~4 and greater. |
96 %! p = (unique (randn (10, 1)) * 3).'; | |
96 %! p1 = p(3:end); | 97 %! p1 = p(3:end); |
97 %! p2 = p(1:end-2); | 98 %! p2 = p(1:end-2); |
98 %! assert (polygcd (poly (-p1), poly (-p2)), poly (- intersect (p1, p2)), sqrt (eps)); | 99 %! assert (polygcd (poly (-p1), poly (-p2)), |
100 %! poly (- intersect (p1, p2)), sqrt (eps)); | |
99 %! endfor | 101 %! endfor |
100 | 102 |