This is a static copy of a profile report

Home

mpower (Calls: 1, Time: 0.003 s)
Generated 16-Jul-2020 17:08:32 using performance time.
function in file /Applications/MATLAB_R2020a.app/toolbox/matlab/ops/mpower.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
hhsave_VFI_3OCfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
49
Z = integerMpower(X,Y);
10.002 s62.5%
47
if isscalar(Y) && isre...
10.000 s11.8%
48
&& size(X,1) == size(X...
10.000 s2.3%
53
end
10.000 s0.0%
20
if isscalar(X) && issc...
10.000 s0.0%
All other lines  0.001 s23.4%
Totals  0.003 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
mpower>integerMpowersubfunction10.002 s55.6%
Self time (built-ins, overhead, etc.)  0.002 s44.4%
Totals  0.003 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function53
Non-code lines (comments, blank lines)22
Code lines (lines that can run)31
Code lines that did run16
Code lines that did not run15
Coverage (did run/can run)51.61 %
Function listing
time 
Calls 
 line
   1 
function Z = mpower(X,Y)
   2 
%^   Matrix power.
   3 
%   Z = X^y is X to the y power if y is a scalar and X is square. If y
   4 
%   is an integer greater than one, the power is computed by repeated
   5 
%   squaring. For other values of y the calculation involves
   6 
%   eigenvalues and eigenvectors.
   7 
%
   8 
%   Z = x^Y is x to the Y power if Y is a square matrix and x is a scalar.
   9 
%   Computed using eigenvalues and eigenvectors.
  10 
%
  11 
%   Z = X^Y, where both X and Y are matrices, is an error.
  12 
%
  13 
%   C = MPOWER(A,B) is called for the syntax 'A ^ B' when A or B is an
  14 
%   object.
  15 
%
  16 
%   See also POWER.
  17 

  18 
%   Copyright 1984-2018 The MathWorks, Inc.
  19 

< 0.001 
      1 
  20
if isscalar(X) && isscalar(Y) 
  21 
    Z = X.^Y;
< 0.001 
      1 
  22
else 
< 0.001 
      1 
  23
    if isinteger(X) || isinteger(Y) 
  24 
        error(message('MATLAB:mpower:integerNotSupported'));
< 0.001 
      1 
  25
    end 
  26 

< 0.001 
      1 
  27
    if ~ismatrix(X) || ~ismatrix(Y) 
  28 
        error(message('MATLAB:mpower:inputsMustBe2D'));
< 0.001 
      1 
  29
    end 
  30 

< 0.001 
      1 
  31
    if isa(X,'single') || isa(Y, 'single') 
  32 
        try
  33 
            X = single(X);
  34 
            Y = single(Y);
  35 
        catch err
  36 
            if (strcmp(err.identifier, 'MATLAB:unimplementedSparseType'))
  37 
                error(message('MATLAB:mpower:sparseSingleNotSupported'))
  38 
            else
  39 
                rethrow(err);
  40 
            end
  41 
        end
< 0.001 
      1 
  42
    else 
< 0.001 
      1 
  43
        X = double(X); 
< 0.001 
      1 
  44
        Y = double(Y); 
< 0.001 
      1 
  45
    end 
  46 

< 0.001 
      1 
  47
    if isscalar(Y) && isreal(Y) && isfinite(Y) && round(Y) == Y ...  
      1 
  48
            && size(X,1) == size(X,2) 
  0.002 
      1 
  49
        Z = integerMpower(X,Y); 
  50 
    else
  51 
        Z = generalMpower(X,Y);
< 0.001 
      1 
  52
    end 
< 0.001 
      1 
  53
end 

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