This is a static copy of a profile report

Home

Function details for mpowerThis is a static copy of a profile report

Home

mpower (Calls: 5, Time: 0.001 s)
Generated 03-Jul-2019 20:31:53 using performance time.
function in file C:\Program Files\MATLAB\R2019a\toolbox\matlab\ops\mpower.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
eigs>checkInputssubfunction5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
20
if isscalar(X) && issc...
50.000 s45.5%
53
end
50.000 s0.3%
21
Z = X.^Y;
50.000 s0.2%
All other lines  0.001 s53.9%
Totals  0.001 s100% 
Children (called functions)
No children
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 run3
Code lines that did not run28
Coverage (did run/can run)9.68 %
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 
      5 
  20
if isscalar(X) && isscalar(Y) 
< 0.001 
      5 
  21
    Z = X.^Y; 
  22 
else
  23 
    if isinteger(X) || isinteger(Y)
  24 
        error(message('MATLAB:mpower:integerNotSupported'));
  25 
    end
  26 

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

  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
  42 
    else
  43 
        X = double(X);
  44 
        Y = double(Y);
  45 
    end
  46 

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

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