This is a static copy of a profile report

Home

circshift (1040 calls, 2.088 sec)
Generated 05-Aug-2011 13:03:51 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/elmat/circshift.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
calc_loadcorrect_finalfunction1030
apply_loadcorrect_finalfunction10
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
47
idx{k} = mod((0:m-1)-p(k), m)+...
20801.629 s78.0%
51
b = a(idx{:});
10400.415 s19.9%
33
[p, sizeA, numDimsA, msg] = Pa...
10400.033 s1.6%
48
end
20800 s0%
46
m      = sizeA(k);
20800 s0%
All other lines  0.011 s0.5%
Totals  2.088 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
circshift>ParseInputssubfunction10400.022 s1.0%
Self time (built-ins, overhead, etc.)  2.066 s99.0%
Totals  2.088 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function51
Non-code lines (comments, blank lines)38
Code lines (lines that can run)13
Code lines that did run9
Code lines that did not run4
Coverage (did run/can run)69.23 %
Function listing
   time   calls  line
1 function b = circshift(a,p)
2 %CIRCSHIFT Shift array circularly.
3 % B = CIRCSHIFT(A,SHIFTSIZE) circularly shifts the values in the array A
4 % by SHIFTSIZE elements. SHIFTSIZE is a vector of integer scalars where
5 % the N-th element specifies the shift amount for the N-th dimension of
6 % array A. If an element in SHIFTSIZE is positive, the values of A are
7 % shifted down (or to the right). If it is negative, the values of A
8 % are shifted up (or to the left).
9 %
10 % Examples:
11 % A = [ 1 2 3;4 5 6; 7 8 9];
12 % B = circshift(A,1) % circularly shifts first dimension values down by 1.
13 % B = 7 8 9
14 % 1 2 3
15 % 4 5 6
16 % B = circshift(A,[1 -1]) % circularly shifts first dimension values
17 % % down by 1 and second dimension left by 1.
18 % B = 8 9 7
19 % 2 3 1
20 % 5 6 4
21 %
22 % See also FFTSHIFT, SHIFTDIM, PERMUTE.
23
24 % Copyright 1984-2010 The MathWorks, Inc.
25 % $Revision: 1.11.4.5 $ $Date: 2010/11/17 11:25:58 $
26
27 % Error out if there are not exactly two input arguments
1040 28 if nargin < 2
29 error(message('MATLAB:circshift:NoInputs'))
30 end
31
32 % Parse the inputs to reveal the variables necessary for the calculations
0.03 1040 33 [p, sizeA, numDimsA, msg] = ParseInputs(a,p);
34
35 % Error out if ParseInputs discovers an improper SHIFTSIZE input
1040 36 if (~isempty(msg))
37 error(message('MATLAB:circshift:InvalidShiftType', msg));
38 end
39
40 % Calculate the indices that will convert the input matrix to the desired output
41 % Initialize the cell array of indices
1040 42 idx = cell(1, numDimsA);
43
44 % Loop through each dimension of the input matrix to calculate shifted indices
1040 45 for k = 1:numDimsA
2080 46 m = sizeA(k);
1.63 2080 47 idx{k} = mod((0:m-1)-p(k), m)+1;
2080 48 end
49
50 % Perform the actual conversion by indexing into the input matrix
0.42 1040 51 b = a(idx{:});

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