[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with sum (...)
From: |
Ben Abbott |
Subject: |
Re: problem with sum (...) |
Date: |
Sun, 4 Nov 2007 20:50:15 -0500 |
On Nov 4, 2007, at 1:00 PM, Søren Hauberg wrote:
Ben Abbott skrev:
In any event, you've done quite a bit more work on this than I. I
had added some additional tests to my version that produced
failures in the original. They pass in yours.
Are these tests part of the current set of tests? If not, then
please send them so they can be part of the test suite.
I've managed to break your efforts :-(
The problem is with these lines ...
a = cellstr(num2str(a))
S = cellstr(num2str(S))
The support for "rows" only works in the event that num2str() returns
the same number of characters for each member of 'a' and 'S'
Here are *all* the tests in my local version (the last one fails).
%!assert (ismember ([1;2], 1:4), logical([1;1]));
%!assert (ismember ({''}, {'abc', 'def'}), false);
%!assert (ismember ('abc', {'abc', 'def'}), true);
%!assert (ismember (('abc')', {'abc', 'def'}), logical ([0; 0; 0]));
%!assert (isempty (ismember ([], [1, 2])), true);
%!assert (isempty (ismember ({}, {'a', 'b'})), true);
%!xtest assert (ismember ('', {'abc', 'def'}), false);
%!xtest fail ('ismember ([], {1, 2})', 'error:.*');
%!fail ('ismember ({[]}, {1, 2})', 'error:.*');
%!xtest fail ('ismember ({}, {1, 2})', 'error:.*');
%!assert (ismember ({'foo', 'bar'}, {'foobar'}), logical ([0, 0]))
%!assert (ismember ({'foo'}, {'foobar'}), false)
%!assert (ismember ({'bar'}, {'foobar'}), false)
%!assert (ismember ({'bar'}, {'foobar', 'bar'}), true)
%!assert (ismember ({'foo', 'bar'}, {'foobar', 'bar'}), logical ([0,
1]))
%!assert (ismember ({'xfb', 'f', 'b'}, {'fb', 'b'}), logical ([0, 0,
1]))
%!assert (ismember ("1", "0123456789."), true)
%!assert (ismember ("1.1", "0123456789."), logical ([1, 1, 1]))
%!assert (ismember([1:3; 4:6], [0:2; 1:3; 2:4; 3:5; 4:6], 'rows'),
logical ([1; 1]))
%!assert (ismember([1.1,1.2,1.3; 2.1,2.2,2.3], [1.1,1.2,1.3;
2.12,2.22,2.32], 'rows'), logical ([1; 0]))
- problem with sum (...), Ben Abbott, 2007/11/03
- proposed patch for ismember.m, Ben Abbott, 2007/11/06
- proposed patch for ismember.m, John W. Eaton, 2007/11/07
- Re: proposed patch for ismember.m, Ben Abbott, 2007/11/07
- Re: proposed patch for ismember.m, John W. Eaton, 2007/11/07
- Re: proposed patch for ismember.m, Ben Abbott, 2007/11/07
- Re: proposed patch for ismember.m, John W. Eaton, 2007/11/07
- Re: proposed patch for ismember.m, Ben Abbott, 2007/11/08