Unapplied patches
Ben Abbott
bpabbott at mac.com
Tue Jul 14 16:09:15 CDT 2009
I'd hoped to have pushed this by now. If no one else gets to it, I'll
be able to in a few days.
Ben
On Jul 14, 2009, at 1:10 PM, "Robert T. Short" <octave at phaselockedsystems.com
> wrote:
> Attached are two patches that I submitted some time ago. Is there
> any interest in applying these?
>
> Bob
> # HG changeset patch
> # User Robert T. Short <octave at phaselockedsystems.com>
> # Date 1246206264 25200
> # Node ID 9b82ea57212f14a2a93091817da49fd6f53e4318
> # Parent 66eaa435bc16bf1f8c4ac797d030e9cb18fa5891
> * scripts/polynomial/conv.m: Fix MATLAB incompatibility, add tests.
>
> diff -r 66eaa435bc16 -r 9b82ea57212f scripts/ChangeLog
> --- a/scripts/ChangeLog Tue Jun 02 16:57:22 2009 -0700
> +++ b/scripts/ChangeLog Sun Jun 28 09:24:24 2009 -0700
> @@ -1,3 +1,7 @@
> +2009-06-28 Robert T. Short <octave at phaselockedsystems.com>
> +
> + * polynomial/conv.m: Fix MATLAB incompatibility, add tests.
> +
> 2009-06-25 Ben Abbott <bpabbott at mac.com>
>
> * plot/gnuplot_drawnow.m: Apply feature 'wxt_has_size'.
> diff -r 66eaa435bc16 -r 9b82ea57212f scripts/polynomial/conv.m
> --- a/scripts/polynomial/conv.m Tue Jun 02 16:57:22 2009 -0700
> +++ b/scripts/polynomial/conv.m Sun Jun 28 09:24:24 2009 -0700
> @@ -49,7 +49,7 @@
>
> ## Use the shortest vector as the coefficent vector to filter.
> ## Preserve the row/column orientation of the longer input.
> - if (la < lb)
> + if (la <= lb)
> if (ly > lb)
> if (size (b, 1) <= size (b, 2))
> x = [b, (zeros (1, ly - lb))];
> @@ -75,47 +75,40 @@
>
> endfunction
>
> -%!assert(all (all (conv (ones (3, 1), ones (3, 1)) == [1; 2; 3; 2;
> 1])));
> -
> -%!assert(all (all (conv (ones (1, 3), ones (3, 1)) == [1, 2, 3, 2,
> 1])));
> -
> -%!assert(all (all (conv (3, [1, 2, 3]) == [3, 6, 9])));
> -
> -%!error conv ([1, 2; 3, 4], 3);
> -
> -%!assert(conv (2, 3),6);
> -
> -%!error conv (2, []);
> +%!test
> +%!shared a, b, c, x
> +%! x = ones(3,1);
> +%! y = ones(1,3);
> +%! b = 2;
> +%! c = 3;
> +%! assert(all (conv (x,x) == [1; 2; 3; 2; 1]));
> +%! assert(all (conv (y,y) == [1, 2, 3, 2, 1]));
> +%! assert(all (conv (x,y) == [1, 2, 3, 2, 1])); % MATLAB
> +%! assert(all (conv (y,x) == [1; 2; 3; 2; 1]));
> +%% assert(all (conv (x,y) == [1; 2; 3; 2; 1])); % octave
> +%% assert(all (conv (y,x) == [1, 2, 3, 2, 1]));
> +%! assert(all (conv (c,x) == [3; 3; 3]));
> +%! assert(all (conv (c,y) == [3, 3, 3]));
> +%! assert(all (conv (x,c) == [3; 3; 3]));
> +%! assert(all (conv (y,c) == [3, 3, 3]));
> +%! error conv ([1, 2; 3, 4], 3);
> +%! assert(conv (b, c), 6);
> +%! error conv (2, []);
>
> %!test
> -%! a = 1:10;
> -%! b = 1:3;
> -%! c = conv (a, b);
> -%! assert (size(c), [1, numel(a)+numel(b)-1])
> -%!test
> -%! a = (1:10).';
> -%! b = 1:3;
> -%! c = conv (a, b);
> -%! assert (size(c), [numel(a)+numel(b)-1, 1])
> -%!test
> -%! a = 1:10;
> -%! b = (1:3).';
> -%! c = conv (a, b);
> -%! assert (size(c), [1, numel(a)+numel(b)-1])
> +%! a = 1:10;
> +%! b = 1:3;
> +%! assert (size(conv(a,b)), [1, numel(a)+numel(b)-1])
> +%! assert (size(conv(b,a)), [1, numel(a)+numel(b)-1])
>
> %!test
> -%! b = 1:10;
> -%! a = 1:3;
> -%! c = conv (a, b);
> -%! assert (size(c), [1, numel(a)+numel(b)-1])
> +%! a = (1:10).';
> +%! b = 1:3;
> +%! assert (size(conv(a,b)), [numel(a)+numel(b)-1, 1])
> +%! assert (size(conv(b,a)), [numel(a)+numel(b)-1, 1])
> +
> %!test
> -%! b = (1:10).';
> -%! a = 1:3;
> -%! c = conv (a, b);
> -%! assert (size(c), [numel(a)+numel(b)-1, 1])
> -%!test
> -%! b = 1:10;
> -%! a = (1:3).';
> -%! c = conv (a, b);
> -%! assert (size(c), [1, numel(a)+numel(b)-1])
> -
> +%! a = 1:10;
> +%! b = (1:3).';
> +%! assert (size(conv(a,b)), [1, numel(a)+numel(b)-1])
> +%! assert (size(conv(b,a)), [1, numel(a)+numel(b)-1])
> # HG changeset patch
> # User Robert T. Short <octave at phaselockedsystems.com>
> # Date 1246319239 25200
> # Node ID d86f024922ed74e795c6bed3de8e346daaedb92e
> # Parent 9b82ea57212f14a2a93091817da49fd6f53e4318
> * src/DLD-FUNCTIONS/filter.cc: add tests
>
> diff -r 9b82ea57212f -r d86f024922ed src/ChangeLog
> --- a/src/ChangeLog Sun Jun 28 09:24:24 2009 -0700
> +++ b/src/ChangeLog Mon Jun 29 16:47:19 2009 -0700
> @@ -1,3 +1,7 @@
> +2009-06-29 Robert T. Short <octave at phaselockedsystems.com>
> +
> + * DLD-FUNCTIONS/filter.cc: add tests
> +
> 2009-06-28 Michael Goffioul <michael.goffioul at gmail.com>
>
> * Makefile.in (INCLUDES): Install txt-eng.h and txt-eng-ft.h.
> diff -r 9b82ea57212f -r d86f024922ed src/DLD-FUNCTIONS/filter.cc
> --- a/src/DLD-FUNCTIONS/filter.cc Sun Jun 28 09:24:24 2009 -0700
> +++ b/src/DLD-FUNCTIONS/filter.cc Mon Jun 29 16:47:19 2009 -0700
> @@ -690,6 +690,64 @@
> filter (MArray<FloatComplex>&, MArray<FloatComplex>&,
> MArrayN<FloatComplex>&, int dim);
>
> /*
> +%!shared a, b, x, r
> +%!test
> +%! a = [1 1];
> +%! b = [1 1];
> +%! x = zeros(1,10); x(1) = 1;
> +%! assert(all(filter(b, [1], x ) == [1 1 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, [1], x.') == [1 1 0 0 0 0 0 0 0 0].'))
> +%! assert(all(filter(b.', [1], x ) == [1 1 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b.', [1], x.') == [1 1 0 0 0 0 0 0 0 0].'))
> +%! assert(all(filter([1], a, x ) == [+1 -1 +1 -1 +1 -1 +1 -1 +1
> -1] ))
> +%! assert(all(filter([1], a, x.') == [+1 -1 +1 -1 +1 -1 +1 -1 +1
> -1].'))
> +%! assert(all(filter([1], a.', x ) == [+1 -1 +1 -1 +1 -1 +1 -1 +1
> -1] ))
> +%! assert(all(filter([1], a.', x.') == [+1 -1 +1 -1 +1 -1 +1 -1 +1
> -1].'))
> +%! assert(all(filter(b, a, x ) == [1 0 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b.', a, x ) == [1 0 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, a.', x ) == [1 0 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b.', a, x ) == [1 0 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, a, x.') == [1 0 0 0 0 0 0 0 0 0].'))
> +%! assert(all(filter(b.', a, x.') == [1 0 0 0 0 0 0 0 0 0].'))
> +%! assert(all(filter(b, a.', x.') == [1 0 0 0 0 0 0 0 0 0].'))
> +%! assert(all(filter(b.', a, x.') == [1 0 0 0 0 0 0 0 0 0].'))
> +%!
> +%!test
> +%! r = sqrt(1/2)*(1+i);
> +%! a = a*r;
> +%! b = b*r;
> +%! assert(all(filter(b, [1], x ) == r*[1 1 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, [1], r*x ) == r*r*[1 1 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, [1], x.' ) == r*[1 1 0 0 0 0 0 0 0 0].' ))
> +%! assert(all(filter(b, a, x ) == [1 0 0 0 0 0 0 0 0 0] ))
> +%! assert(all(filter(b, a, r*x ) == r*[1 0 0 0 0 0 0 0 0 0] ))
> +%!
> +%!shared a, b, x, y, so
> +%!test
> +%! a = [1,1]; b=[1,1];
> +%! x = zeros(1,10); x(1) = 1;
> +%! [y, so] = filter(b, [1], x, [-1]);
> +%! assert(all(y == [0 1 0 0 0 0 0 0 0 0]))
> +%! assert(so,0)
> +%!
> +%!test
> +%! x = zeros(10,3); x(1,1)=-1; x(1,2)=1;
> +%! y0 = zeros(10,3); y0(1:2,1)=-1; y0(1:2,2)=1;
> +%! y = filter(b,[1],x);
> +%! assert(all(all(y==y0)))
> +%!
> +%!test
> +%! a = [1,1]; b=[1,1];
> +%! x = zeros(4,4,2); x(1,1:4,1) = +1; x(1,1:4,2) = -1;
> +%! y0 = zeros(4,4,2); y0(1:2,1:4,1) = +1; y0(1:2,1:4,2) = -1;
> +%! y = filter(b, [1], x);
> +%! assert(all(all(all(y==y0))))
> +
> +%% Should put some tests of the "DIM" parameter in here.
> +
> + */
> +
> +/*
> ;;; Local Variables: ***
> ;;; mode: C++ ***
> ;;; End: ***
More information about the Octave-maintainers
mailing list