This is a static copy of a profile report

Home

categorical.eq (Calls: 74690, Time: 1.029 s)
Generated 04-Jun-2021 04:11:26 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\categorical\@categorical\eq.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
computecostfunction73138
getrowmostcostfunction776
getrowcostfunction388
computenumberfunction388
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
30
[acodes,bcodes] = reconcileCat...
746900.643 s62.5%
47
end
746900.241 s23.4%
41
t = (acodes == bcodes);
693000.051 s4.9%
40
if bcodes > 0  %categorical...
693000.005 s0.5%
33
if isscalar(acodes) % faster s...
746900.004 s0.4%
All other lines  0.085 s8.3%
Totals  1.029 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
@categorical\private\reconcileCategoriesfunction746900.476 s46.3%
Self time (built-ins, overhead, etc.)  0.553 s53.7%
Totals  1.029 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function47
Non-code lines (comments, blank lines)31
Code lines (lines that can run)16
Code lines that did run12
Code lines that did not run4
Coverage (did run/can run)75.00 %
Function listing
time 
Calls 
 line
   1 
function t = eq(a,b)
   2 
%EQ Equality for categorical arrays.
   3 
%   A == B does element by element comparisons between the categorical arrays A
   4 
%   and B and returns an array with elements set to logical 1 (TRUE) where the
   5 
%   relation is true and elements set to logical 0 (FALSE) where it is not. A
   6 
%   and B must have compatible sizes. In the simplest cases, they can be the
   7 
%   same size or one can be a scalar. Two inputs have compatible sizes if, for
   8 
%   every dimension, the dimension sizes of the inputs are either the same or
   9 
%   one of them is 1.
  10 
%
  11 
%   C = EQ(A,B) is called for the syntax 'A == B'.
  12 
%
  13 
%   If A and B are both ordinal, they must have the same sets of categories,
  14 
%   including their order. If neither A nor B are ordinal, they need not have
  15 
%   the same sets of categories, and the test is performed by comparing the
  16 
%   category names of each pair of elements.
  17 
%
  18 
%   A == S or S == A, where S is a scalar string or character vector, returns
  19 
%   a logical array the same size as A, containing logical 1 (true) where the
  20 
%   corresponding elements of A are equal to the category S.
  21 
%
  22 
%   Undefined elements are not comparable to any other categorical values,
  23 
%   including other undefined elements. EQ returns logical 0 (false) where
  24 
%   elements of A or B are undefined.
  25 
%
  26 
%   See also NE.
  27 

  28 
%   Copyright 2006-2020 The MathWorks, Inc.
  29 

  0.643 
  74690 
  30
[acodes,bcodes] = reconcileCategories(a,b,false); 
  31 

  32 
% Undefined elements cannot be equal to anything.
  0.004 
  74690 
  33
if isscalar(acodes) % faster scalar case 
< 0.001 
   5390 
  34
    if acodes > 0  %categorical.undefCode 
< 0.001 
   5005 
  35
        t = (acodes == bcodes); 
< 0.001 
    385 
  36
    else 
< 0.001 
    385 
  37
        t = false(size(bcodes)); 
< 0.001 
   5390 
  38
    end 
  0.003 
  69300 
  39
elseif isscalar(bcodes) % faster scalar case 
  0.005 
  69300 
  40
    if bcodes > 0  %categorical.undefCode 
  0.051 
  69300 
  41
        t = (acodes == bcodes); 
  42 
    else
  43 
        t = false(size(acodes));
  0.003 
  69300 
  44
    end 
  45 
else
  46 
    t = (acodes == bcodes) & (acodes ~= 0);
  0.241 
  74690 
  47
end 

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