This is a static copy of a profile report

Home

tformarray>CombinedGrid (1721 calls, 2.223 sec)
Generated 05-Nov-2014 07:52:39 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/tformarray.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
tformarray>ConstructGridsubfunction1721
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
340
x = repmat(  x, [ D(1:i-1)    ...
34420.941 s42.3%
328
G = zeros([D N]);
17210.371 s16.7%
341
G(colons{:},i) = x;
34420.320 s14.4%
331
colons = repmat({':'},[1 N]);
17210.320 s14.4%
339
x = reshape( x, [ones(1,i-1) D...
34420.070 s3.2%
All other lines  0.200 s9.0%
Totals  2.223 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
repmatfunction51631.132 s50.9%
Self time (built-ins, overhead, etc.)  1.092 s49.1%
Totals  2.223 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function50
Non-code lines (comments, blank lines)30
Code lines (lines that can run)20
Code lines that did run17
Code lines that did not run3
Coverage (did run/can run)85.00 %
Function listing
   time   calls  line
294 function G = CombinedGrid(varargin)
295
296 % If N >= 2, G = COMBINEDGRID(x1,x2,...,xN) is a memory-efficient
297 % equivalent to:
298 %
299 % G = cell(N,1);
300 % [G{:}] = ndgrid(x1,x2,...,xN);
301 % G = cat(N + 1, G{:});
302 %
303 % (where x{i} = varargin{i} and D(i) is the number of
304 % elements in x{}).
305 %
306 % If N == 1, COMBINEDGRID returns x1 as a column vector. (The code
307 % with NDGRID replicates x1 across N columns, returning an N-by-N
308 % matrix -- which is inappropriate for our application.)
309 %
310 % N == 0 is not allowed.
311
0.01 1721 312 N = length(varargin);
0.01 1721 313 if N == 0
314 error(message('images:tformarray:combinegridCalledNoArgs'));
315 end
316
0.01 1721 317 D = zeros(1, N);
1721 318 for i=1:N
3442 319 D(1,i) = numel(varargin{i});
3442 320 end
321
0.01 1721 322 if N == 1
323 % Special handling required to avoid calling RESHAPE
324 % with a single-element size vector.
325 G = varargin{1}(:);
1721 326 else
327 % Pre-allocate the output array.
0.37 1721 328 G = zeros([D N]);
329
330 % Prepare to generate a comma-separated list of N colons.
0.32 1721 331 colons = repmat({':'},[1 N]);
332
0.05 1721 333 for i=1:N
334 % Extract the i-th vector, reshape it to run along the
335 % i-th dimension (adding singleton dimensions as needed),
336 % replicate it across all the other dimensions, and
337 % copy it to G(:,:,...,:,i) -- with N colons.
0.03 3442 338 x = varargin{i}(:);
0.07 3442 339 x = reshape( x, [ones(1,i-1) D(i) ones(1,N-i)] );
0.94 3442 340 x = repmat( x, [ D(1:i-1) 1 D(i+1:N) ] );
0.32 3442 341 G(colons{:},i) = x;
0.03 3442 342 end
1721 343 end

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