Solution 839592

Submitted on 28 Feb 2016 by Jan Orwat
  • Size: 15
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass

2   Pass
% Functionality Tests L=128; a=randi(4,L,16,'uint8')-1; b=randi(4,L,16,'uint8')-1; assert(isequal(ismember(a,b,'rows'),ismember_fast_rows(a,b))) b=a; assert(isequal(ismember(a,b,'rows'),ismember_fast_rows(a,b))) L=256; a=randi(4,L,16,'uint8')-1; b=randi(4,L,16,'uint8')-1; a(16:32,:)=b(32:48,:); assert(isequal(ismember(a,b,'rows'),ismember_fast_rows(a,b)))

3   Pass
L=4000000; % ismember 40 fast 5.2 % 34 sec 4M tic a=randi(4,L,16,'uint8')-1; b=randi(4,L,16,'uint8')-1; toc ta=clock; idx = ismember_fast_rows(a,b); t1=etime(clock,ta)*1000; fprintf('Elapsed time = %.0f msec\n',t1) %assert(isequal(ismember(a,b,'rows'),idx)) t2=min(40000,t1); % ismember scores 40000 msec feval(@assignin,'caller','score',floor(t2));

Elapsed time is 2.107158 seconds. Elapsed time = 22517 msec