help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: found a small bug in residue corection


From: John W. Eaton
Subject: Re: found a small bug in residue corection
Date: Mon, 26 Nov 2007 15:31:03 -0500

On 26-Nov-2007, Ben Abbott wrote:

| John, I'm not sitting at my usual machine with the cvs setup. When I try 
"test residue", I get a failure.
| 
| test residue
|   ***** test
|  b = [1, 1, 1];
|  a = [1, -5, 8, -4];
|  [r, p, k, e] = residue (b, a);
|  assert (abs (r - [-2; 7; 3]) < 1e-5
|    && abs (p - [2; 2; 1]) < 1e-7
|    && isempty (k)
|    && e == [1; 2; 1]);
|  k = [1 0];
|  b = conv (k, a) + prepad (b, numel (k) + numel (a) - 1, 0);
|  a = a;
|  [br, ar] = residue (r, p, k);
|  assert ((abs (br - b) < 1e-12
|    && abs (ar - a) < 1e-12));
|  [br, ar] = residue (r, p, k, e);
|  assert ((abs (br - b) < 1e-12
|    && abs (ar - a) < 1e-12));
| !!!!! test failed
| error: assert ((abs (br - b) < 1e-12 && abs (ar - a) < 1e-12)) failed
| 
| Can you verify the problem exists for the cvs as well?
| 
| I was originally thinking of adding an additional test to the residue 
function to verify the functionality handled Doug's case correctly.
| In the event you or someone else looks into this error before I, it may also 
be prudent to add that test as well.
| 
| %!test
| %! b = [1];
| %! a = [1, 10, 25];
| %! [r, p, k, e] = residue(b, a);
| %! r1 = [0; 1];
| %! p1 = [-5; -5];
| %! assert (abs (r - r1) < 1e-7 && abs (p - p1) < 1e-7
| %!   && isempty (k)
| %!   && e == [1; 2]);
| %! [br, ar] = residue (r, p, k);
| %! assert ((abs (br - b) < 1e-12
| %!   && abs (ar - a) < 1e-12));
| 
| Ben

I added the test and all four tests for residue pass.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]