This is a static copy of a profile report

Home

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

Home

kron (Calls: 4067, Time: 0.450 s)
Generated 20-Jul-2018 02:24:58 using performance time.
function in file C:\Program Files\MATLAB\R2018a\toolbox\matlab\ops\kron.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
kron_groups_simplefunction4062
qap_admm_blkdiagfunction5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
34
K = reshape(A.*B,[ma*mb na*nb]...
50.159 s35.3%
37
K = matlab.internal.sparse.kro...
40620.115 s25.6%
27
[ma,na] = size(A);
40670.059 s13.1%
32
A = reshape(A,[1 ma 1 na]);
50.026 s5.7%
28
[mb,nb] = size(B);
40670.017 s3.8%
All other lines  0.074 s16.4%
Totals  0.450 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function38
Non-code lines (comments, blank lines)26
Code lines (lines that can run)12
Code lines that did run10
Code lines that did not run2
Coverage (did run/can run)83.33 %
Function listing
time 
Calls 
 line
   1 
function K = kron(A,B)
   2 
%KRON   Kronecker tensor product.
   3 
%   KRON(X,Y) is the Kronecker tensor product of X and Y.
   4 
%   The result is a large matrix formed by taking all possible
   5 
%   products between the elements of X and those of Y. For
   6 
%   example, if X is 2 by 3, then KRON(X,Y) is
   7 
%
   8 
%      [ X(1,1)*Y  X(1,2)*Y  X(1,3)*Y
   9 
%        X(2,1)*Y  X(2,2)*Y  X(2,3)*Y ]
  10 
%
  11 
%   If either X or Y is sparse, only nonzero elements are multiplied
  12 
%   in the computation, and the result is sparse.
  13 
%
  14 
%   Class support for inputs X,Y:
  15 
%      float: double, single
  16 
%      integers: uint8, int8, uint16, int16, uint32, int32, uint64, int64
  17 

  18 
%   Thanks to Bruno Luong for full matrices implementation. 
  19 
%   See license.txt for license information.
  20 
%   Thanks to Paul Fackler and Jordan Rosenthal for previous versions.
  21 
%   Copyright 1984-2016 The MathWorks, Inc. 
  22 

< 0.001 
   4067 
  23
if ~ismatrix(A) || ~ismatrix(B) 
  24 
    error(message('MATLAB:kron:TwoDInput'));
  25 
end
  26 

  0.059 
   4067 
  27
[ma,na] = size(A); 
  0.017 
   4067 
  28
[mb,nb] = size(B); 
  29 

  0.006 
   4067 
  30
if ~issparse(A) && ~issparse(B) 
  31 
   % Both inputs full, result is full.
  0.026 
      5 
  32
   A = reshape(A,[1 ma 1 na]); 
  0.008 
      5 
  33
   B = reshape(B,[mb 1 nb 1]); 
  0.159 
      5 
  34
   K = reshape(A.*B,[ma*mb na*nb]); 
< 0.001 
   4062 
  35
else 
  36 
   % At least one input is sparse, result is sparse.
  0.115 
   4062 
  37
   K = matlab.internal.sparse.kronSparse(sparse(A), sparse(B)); 
  0.004 
   4067 
  38
end 

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