This is a static copy of a profile report

Home

ismember>ismemberClassTypes (Calls: 3, Time: 0.016 s)
Generated 04-Jun-2021 04:11:21 using performance time.
subfunction in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\ops\ismember.m
Copy to new window for comparing multiple runs

Parents (calling functions)

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

Line NumberCodeCallsTotal Time% TimeTime Plot
447
[uA,~,icA] = unique(a(:),'sort...
30.008 s50.6%
462
lia = ismemberBuiltinTypes(icA...
20.002 s10.9%
449
uB = unique(b(:),'sorted');
20.001 s8.0%
466
[lia,locb] = ismemberBuiltinTy...
10.001 s7.6%
451
[uB,ib] = unique(b(:),'sorted'...
10.001 s4.7%
All other lines  0.003 s18.2%
Totals  0.016 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
uniquefunction60.009 s53.1%
ismember>ismemberBuiltinTypessubfunction30.002 s15.1%
Self time (built-ins, overhead, etc.)  0.005 s31.8%
Totals  0.016 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function71
Non-code lines (comments, blank lines)10
Code lines (lines that can run)61
Code lines that did run33
Code lines that did not run28
Coverage (did run/can run)54.10 %
Function listing
time 
Calls 
 line
 406 
function [lia,locb] = ismemberClassTypes(a,b)
< 0.001 
      3 
 407
if issparse(a) 
 408 
    a = full(a);
< 0.001 
      3 
 409
end 
< 0.001 
      3 
 410
if issparse(b) 
 411 
    b = full(b);
< 0.001 
      3 
 412
end 
 413 
% Duplicates within the sets are eliminated
< 0.001 
      3 
 414
if isempty(a)||isempty(b) 
 415 
    lia = false(size(a));
 416 
    locb = zeros(size(a));
 417 
    return
< 0.001 
      3 
 418
end 
< 0.001 
      3 
 419
if isscalar(a) || isscalar(b) 
 420 
    if strcmp(class(a),class(b))
 421 
        if any(size(a)==numel(a)) && any(size(b)==numel(b))
 422 
            % a and b do not need to be reshaped if they are n-dimensional
 423 
            % vectors
 424 
            lia = a==b;
 425 
        else
 426 
            lia = a(:)==b(:);
 427 
        end
 428 
    else
 429 
        ab = [a(:);b(:)];
 430 
        numa = numel(a);
 431 
        lia = ab(1:numa)==ab(1+numa:end);
 432 
    end
 433 
    if ~any(lia)
 434 
        lia  = false(size(a));
 435 
        locb = zeros(size(a));
 436 
        return
 437 
    end
 438 
    if ~isscalar(b)
 439 
        locb = find(lia);
 440 
        locb = locb(1);
 441 
        lia = any(lia);
 442 
    else
 443 
        locb = double(lia);
 444 
    end
< 0.001 
      3 
 445
else 
 446 
    % Duplicates within the sets are eliminated
  0.008 
      3 
 447
    [uA,~,icA] = unique(a(:),'sorted'); 
< 0.001 
      3 
 448
    if nargout <= 1 
  0.001 
      2 
 449
        uB = unique(b(:),'sorted'); 
      1 
 450
    else 
< 0.001 
      1 
 451
        [uB,ib] = unique(b(:),'sorted'); 
< 0.001 
      3 
 452
    end 
 453 
    
 454 
    % Sort the unique elements of A and B, duplicate entries are adjacent
< 0.001 
      3 
 455
    [sortuAuB,IndSortuAuB] = sort([uA;uB]); 
 456 
    
 457 
    % Find matching entries
< 0.001 
      3 
 458
    d = sortuAuB(1:end-1)==sortuAuB(2:end);         % d indicates the indices matching entries 
< 0.001 
      3 
 459
    ndx1 = IndSortuAuB(d);                          % NDX1 are locations of repeats in C 
 460 
    
< 0.001 
      3 
 461
    if nargout <= 1 
  0.002 
      2 
 462
        lia = ismemberBuiltinTypes(icA,ndx1);       % Find repeats among original list 
      1 
 463
    else 
< 0.001 
      1 
 464
        szuA = size(uA,1); 
< 0.001 
      1 
 465
        d = find(d); 
  0.001 
      1 
 466
        [lia,locb] = ismemberBuiltinTypes(icA,ndx1);% Find locb by using given indices 
< 0.001 
      1 
 467
        newd = d(locb(lia));                        % NEWD is D for non-unique A 
< 0.001 
      1 
 468
        where = ib(IndSortuAuB(newd+1)-szuA);       % Index values of uB through UNIQUE 
< 0.001 
      1 
 469
        locb(lia) = where;                          % Return first or last occurrence of A within B 
< 0.001 
      3 
 470
    end 
      3 
 471
end 
< 0.001 
      3 
 472
lia = reshape(lia,size(a)); 
< 0.001 
      3 
 473
if nargout > 1 
< 0.001 
      1 
 474
    locb = reshape(locb,size(a)); 
< 0.001 
      3 
 475
end 
< 0.001 
      3 
 476
end 

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