This is a static copy of a profile report

Home

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 NameFunction TypeCalls
padarrayfunction53999
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
125
b         = mkconstarray(class...
5399910.615 s49.0%
126
b(idx{:}) = a;
539993.124 s14.4%
118
idx{k}   = (1:M) + padSize(k);
579020.961 s4.4%
107
M = size(a,k);
1079980.801 s3.7%
106
for k = 1:numDims
539990.791 s3.7%
All other lines  5.357 s24.7%
Totals  21.650 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
images/private/mkconstarrayfunction539999.573 s44.2%
Self time (built-ins, overhead, etc.)  12.077 s55.8%
Totals  21.650 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function29
Non-code lines (comments, blank lines)10
Code lines (lines that can run)19
Code lines that did run19
Code lines that did not run0
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.