Download Sysquake User Manual

Transcript
LME Reference — miscellaneous functions
213
function header does not correspond to any code and is not timed. To
improve the accuracy of the timing, we repeat the execution 10000
times.
for i=1:10000; x = logspace(1,10); end
profile report
13
0.000
function r = logspace(x1, x2, n)
14
0.000
15
0.055
8.9%
if nargin < 3
16
0.057
9.2%
n = 100;
17
0.047
7.6%
end
18
0.458 74.3%
r = exp(log(x1)+log(x2/x1)*(0:n-1)/(n-1));
Finally, here is a report with a different format: the first column is the
percentage as an integer, a space and the percent sign, followed by
spaces and the source code:
profile(’report’, ’%3.0p %% %s\n’)
function r = logspace(x1, x2, n)
9
9
8
74
%
%
%
%
if nargin < 3
n = 100;
end
r = exp(log(x1) + log(x2/x1) * (0:n-1) / (n-1));
See also
tic, toc, sprintf
10.16
Miscellaneous Functions
This section describes functions related to programming: function arguments, error processing, evaluation, memory.
assert
Check that an assertion is true.
Syntax
assert(expr)
assert(expr, str)
assert(expr, format, arg1, arg2, ...)
assert(expr, identifier, format, arg1, arg2, ...)