This is a static copy of a profile report

Home

ismember>ismemberClassTypes (Calls: 170, Time: 0.100 s)
Generated 16-Jul-2020 17:08:53 using performance time.
subfunction in file /Applications/MATLAB_R2020a.app/toolbox/matlab/ops/ismember.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ismember>ismemberR2012asubfunction170
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
432
[uA,~,icA] = unique(a(:),'sort...
1080.038 s38.6%
434
uB = unique(b(:),'sorted');
1080.023 s23.1%
440
[sortuAuB,IndSortuAuB] = sort(...
1080.006 s6.3%
417
lia = ab(1:numa)==ab(1+numa:en...
620.006 s5.7%
415
ab = [a(:);b(:)];
620.005 s5.5%
All other lines  0.021 s20.8%
Totals  0.100 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
uniquefunction2160.055 s55.8%
ismember>ismemberBuiltinTypessubfunction1080.002 s2.4%
Self time (built-ins, overhead, etc.)  0.042 s41.8%
Totals  0.100 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function56
Non-code lines (comments, blank lines)8
Code lines (lines that can run)48
Code lines that did run34
Code lines that did not run14
Coverage (did run/can run)70.83 %
Function listing
time 
Calls 
 line
 406 
function [lia,locb] = ismemberClassTypes(a,b)
< 0.001 
    170 
 407
if issparse(a) 
 408 
    a = full(a);
< 0.001 
    170 
 409
end 
< 0.001 
    170 
 410
if issparse(b) 
 411 
    b = full(b);
< 0.001 
    170 
 412
end 
 413 
% Duplicates within the sets are eliminated
  0.003 
    170 
 414
if isscalar(a) || isscalar(b) 
  0.005 
     62 
 415
    ab = [a(:);b(:)]; 
< 0.001 
     62 
 416
    numa = numel(a); 
  0.006 
     62 
 417
    lia = ab(1:numa)==ab(1+numa:end); 
< 0.001 
     62 
 418
    if ~any(lia) 
< 0.001 
     16 
 419
        lia  = false(size(a)); 
< 0.001 
     16 
 420
        locb = zeros(size(a)); 
< 0.001 
     16 
 421
        return 
< 0.001 
     46 
 422
    end 
  0.001 
     46 
 423
    if ~isscalar(b) 
< 0.001 
     46 
 424
        locb = find(lia); 
< 0.001 
     46 
 425
        locb = locb(1); 
< 0.001 
     46 
 426
        lia = any(lia); 
 427 
    else
 428 
        locb = double(lia);
< 0.001 
     46 
 429
    end 
< 0.001 
    108 
 430
else 
 431 
    % Duplicates within the sets are eliminated
  0.038 
    108 
 432
    [uA,~,icA] = unique(a(:),'sorted'); 
< 0.001 
    108 
 433
    if nargout <= 1 
  0.023 
    108 
 434
        uB = unique(b(:),'sorted'); 
 435 
    else
 436 
        [uB,ib] = unique(b(:),'sorted');
< 0.001 
    108 
 437
    end 
 438 
    
 439 
    % Sort the unique elements of A and B, duplicate entries are adjacent
  0.006 
    108 
 440
    [sortuAuB,IndSortuAuB] = sort([uA;uB]); 
 441 
    
 442 
    % Find matching entries
  0.004 
    108 
 443
    d = sortuAuB(1:end-1)==sortuAuB(2:end);         % d indicates the indices matching entries 
< 0.001 
    108 
 444
    ndx1 = IndSortuAuB(d);                          % NDX1 are locations of repeats in C 
 445 
    
< 0.001 
    108 
 446
    if nargout <= 1 
  0.003 
    108 
 447
        lia = ismemberBuiltinTypes(icA,ndx1);       % Find repeats among original list 
 448 
    else
 449 
        szuA = size(uA,1);
 450 
        d = find(d);
 451 
        [lia,locb] = ismemberBuiltinTypes(icA,ndx1);% Find locb by using given indices
 452 
        newd = d(locb(lia));                        % NEWD is D for non-unique A
 453 
        where = ib(IndSortuAuB(newd+1)-szuA);       % Index values of uB through UNIQUE
 454 
        locb(lia) = where;                          % Return first or last occurrence of A within B
< 0.001 
    108 
 455
    end 
< 0.001 
    154 
 456
end 
  0.001 
    154 
 457
lia = reshape(lia,size(a)); 
< 0.001 
    154 
 458
if nargout > 1 
 459 
    locb = reshape(locb,size(a));
< 0.001 
    154 
 460
end 
  0.001 
    154 
 461
end 

Other subfunctions in this file are not included in this listing.