This is a static copy of a profile reportHome
nextpow2 (138 calls, 0.011 sec)
Generated 05-Aug-2011 13:03:46 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/elfun/nextpow2.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
23 | p(k) = f(k); | 138 | 0 s | 0% |  |
22 | k = ~isfinite(f); | 138 | 0 s | 0% |  |
19 | p(k) = p(k)-1; | 138 | 0 s | 0% |  |
18 | k = (f == 0.5); | 138 | 0 s | 0% |  |
15 | [f,p] = log2(abs(n)); | 138 | 0 s | 0% |  |
All other lines | | | 0.011 s | 100.0% |  |
Totals | | | 0.011 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 23 |
Non-code lines (comments, blank lines) | 18 |
Code lines (lines that can run) | 5 |
Code lines that did run | 5 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
1 function p = nextpow2(n)
2 %NEXTPOW2 Next higher power of 2.
3 % NEXTPOW2(N) returns the first P such that 2.^P >= abs(N). It is
4 % often useful for finding the nearest power of two sequence
5 % length for FFT operations.
6 %
7 % Class support for input N:
8 % float: double, single
9 %
10 % See also LOG2, POW2.
11
12 % Copyright 1984-2009 The MathWorks, Inc.
13 % $Revision: 5.11.4.4 $ $Date: 2009/07/06 20:37:15 $
14
138 15 [f,p] = log2(abs(n));
16
17 % Check for exact powers of 2.
138 18 k = (f == 0.5);
138 19 p(k) = p(k)-1;
20
21 % Check for infinities and NaNs
138 22 k = ~isfinite(f);
138 23 p(k) = f(k);