blkdiag (Calls: 18254, Time: 37.858 s)
Generated 20-Jul-2018 02:24:57 using performance time.
function in file C:\Program Files\MATLAB\R2018a\toolbox\matlab\elmat\blkdiag.m
Copy to new window for comparing multiple runs
Function Name | Function Type | Calls |
kron_groups_simple | function | 4063 |
qap_admm_blkdiag | function | 2 |
run_admm | function | 14189 |
Line Number | Code | Calls | Total Time | % Time | Time Plot |
45 | y(p1(k)+1:p1(k+1),m1(k)+1:m1(k... | 2809428 | 25.650 s | 67.8% | ![]() |
34 | if any(cellfun(@issparse,varar... | 18254 | 5.275 s | 13.9% | ![]() |
38 | [p2,m2] = cellfun(@size,vararg... | 14192 | 4.614 s | 12.2% | ![]() |
43 | y = zeros(p1(end),m1(end),outc... | 14192 | 0.604 s | 1.6% | ![]() |
20 | any(~cellfun('isclass',varargi... | 18254 | 0.371 s | 1.0% | ![]() |
All other lines | 1.342 s | 3.5% | ![]() | ||
Totals | 37.858 s | 100% |
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
elmat\private\blkdiagmex | function | 4062 | 0.173 s | 0.5% | ![]() |
Self time (built-ins, overhead, etc.) | 37.685 s | 99.5% | ![]() | ||
Totals | 37.858 s | 100% |
Line number | Message |
34 | Extra semicolon is unnecessary in IF statement before newline. |
Total lines in function | 47 |
Non-code lines (comments, blank lines) | 20 |
Code lines (lines that can run) | 27 |
Code lines that did run | 16 |
Code lines that did not run | 11 |
Coverage (did run/can run) | 59.26 % |
time | Calls | line | |
---|---|---|---|
1 | function y = blkdiag(varargin) | ||
2 | %BLKDIAG Block diagonal concatenation of matrix input arguments. | ||
3 | % | ||
4 | % |A 0 .. 0| | ||
5 | % Y = BLKDIAG(A,B,...) produces |0 B .. 0| | ||
6 | % |0 0 .. | | ||
7 | % | ||
8 | % Class support for inputs: | ||
9 | % float: double, single | ||
10 | % integer: uint8, int8, uint16, int16, uint32, int32, uint64, int64 | ||
11 | % char, logical | ||
12 | % | ||
13 | % See also DIAG, HORZCAT, VERTCAT | ||
14 | |||
15 | % Copyright 1984-2013 The MathWorks, Inc. | ||
16 | |||
0.005 | 18254 | 17 | if nargin > 0 |
0.362 | 18254 | 18 | outclass = class(varargin{1}); |
0.390 | 18254 | 19 | if isobject(varargin{1}) || ~isnumeric(varargin{1}) || ... |
18254 | 20 | any(~cellfun('isclass',varargin,outclass)) | |
21 | y = []; | ||
22 | for k=1:nargin | ||
23 | x = varargin{k}; | ||
24 | [p1,m1] = size(y); | ||
25 | [p2,m2] = size(x); | ||
26 | y = [y zeros(p1,m2); zeros(p2,m1) x]; %#ok | ||
27 | end | ||
28 | return | ||
29 | end | ||
30 | else | ||
31 | outclass = 'double'; | ||
0.001 | 18254 | 32 | end |
33 | |||
5.275 | 18254 | 34 | if any(cellfun(@issparse,varargin)); |
35 | % optimized MEX implementation for sparse double | ||
0.214 | 4062 | 36 | y = blkdiagmex(varargin{:}); |
0.001 | 14192 | 37 | else |
4.614 | 14192 | 38 | [p2,m2] = cellfun(@size,varargin); |
39 | %Precompute cumulative matrix sizes | ||
0.192 | 14192 | 40 | p1 = [0, cumsum(p2)]; |
0.049 | 14192 | 41 | m1 = [0, cumsum(m2)]; |
42 | |||
0.604 | 14192 | 43 | y = zeros(p1(end),m1(end),outclass); %Preallocate |
0.005 | 14192 | 44 | for k=1:nargin |
25.650 | 2809428 | 45 | y(p1(k)+1:p1(k+1),m1(k)+1:m1(k+1)) = varargin{k}; |
0.132 | 2809428 | 46 | end |
0.181 | 18254 | 47 | end |
Other subfunctions in this file are not included in this listing.