This is a static copy of a profile reportHome
padarray>ConstantPad (53999 calls, 21.650 sec)
Generated 05-Nov-2014 07:52:50 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/padarray.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
padarray | function | 53999 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
125 | b = mkconstarray(class... | 53999 | 10.615 s | 49.0% |  |
126 | b(idx{:}) = a; | 53999 | 3.124 s | 14.4% |  |
118 | idx{k} = (1:M) + padSize(k); | 57902 | 0.961 s | 4.4% |  |
107 | M = size(a,k); | 107998 | 0.801 s | 3.7% |  |
106 | for k = 1:numDims | 53999 | 0.791 s | 3.7% |  |
All other lines | | | 5.357 s | 24.7% |  |
Totals | | | 21.650 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
images/private/mkconstarray | function | 53999 | 9.573 s | 44.2% |  |
Self time (built-ins, overhead, etc.) | | | 12.077 s | 55.8% |  |
Totals | | | 21.650 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 29 |
Non-code lines (comments, blank lines) | 10 |
Code lines (lines that can run) | 19 |
Code lines that did run | 19 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
98 function b = ConstantPad(a, padSize, padVal, direction)
99
0.43 53999 100 numDims = numel(padSize);
101
102 % Form index vectors to subsasgn input array into output array.
103 % Also compute the size of the output array.
0.55 53999 104 idx = cell(1,numDims);
0.47 53999 105 sizeB = zeros(1,numDims);
0.79 53999 106 for k = 1:numDims
0.80 107998 107 M = size(a,k);
0.53 107998 108 switch direction
0.36 107998 109 case 'pre'
0.35 25048 110 idx{k} = (1:M) + padSize(k);
0.16 25048 111 sizeB(k) = M + padSize(k);
112
0.23 82950 113 case 'post'
0.20 25048 114 idx{k} = 1:M;
0.08 25048 115 sizeB(k) = M + padSize(k);
116
0.27 57902 117 case 'both'
0.96 57902 118 idx{k} = (1:M) + padSize(k);
0.26 57902 119 sizeB(k) = M + 2*padSize(k);
0.10 57902 120 end
0.38 107998 121 end
122
123 % Initialize output array with the padding value. Make sure the
124 % output array is the same type as the input.
10.61 53999 125 b = mkconstarray(class(a), padVal, sizeB);
3.12 53999 126 b(idx{:}) = a;
Other subfunctions in this file are not included in this listing.