91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 61KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-14
  • 語言: Matlab
  • 標簽: matlab??

資源簡介

matlab的功能函數(shù),屬于計時工具, Copyright (c) 2010, The MathWorks, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright

資源截圖

代碼片段和文件信息

function?[t?measurement_overhead?measurement_details]?=?timeit(f?num_outputs)
%TIMEIT?Measure?time?required?to?run?function.
%???T?=?TIMEIT(F)?measures?the?time?(in?seconds)?required?to?run?F?which?is?a
%???function?handle.??TIMEIT?calls?F?with?either?no?output?arguments?or?one
%???output?argument?depending?on?nargout(F).
%
%???T?=?TIMEIT(FN)?calls?F?with?N?output?arguments.??N?can?be?0?1?2?3?or?4.
%
%???TIMEIT?handles?automatically?the?usual?benchmarking?procedures?of?“warming
%???up“?F?figuring?out?how?many?times?to?repeat?F?in?a?timing?loop?etc.
%???TIMEIT?also?compensates?for?the?estimated?time-measurement?overhead
%???associated?with?tic/toc?and?with?calling?function?handles.??TIMEIT?returns
%???the?median?of?several?repeated?measurements.
%
%???Examples
%???--------
%???How?much?time?does?it?take?to?compute?sum(A.‘?.*?B?1)?where?A?is
%???12000-by-400?and?B?is?400-by-12000?
%
%???????A?=?rand(12000?400);
%???????B?=?rand(400?12000);
%???????f?=?@()?sum(A.‘?.*?B?1);
%???????timeit(f)
%
%???How?much?time?does?it?take?to?call?svd?with?three?output?arguments?
%
%???????X?=?[1?2;?3?4;?5?6;?7?8];
%???????f?=?@()?svd(X);
%???????timeit(f?3)
%
%???How?much?time?does?it?take?to?dilate?the?text.png?image?with
%???a?25-by-25?all-ones?structuring?element??(This?example?uses?Image?Processing
%???Toolbox?functions.)
%
%???????bw?=?imread(‘text.png‘);
%???????se?=?strel(ones(25?25));
%???????g?=?@()?imdilate(bw?se);
%???????timeit(g)

%???Steve?Eddins
%???Copyright?2008-2010?The?MathWorks?Inc.

if?nargin?????num_outputs?=?min(numOutputs(f)?1);
else
????if?num_outputs?>?4
????????warning(‘MATLAB:timeit:tooManyOutputs‘?...
????????????‘Too?many?function?output?arguments?specified.?timeit?will?call?your?function?with?4?output?arguments.‘);
????end
end

t_rough?=?roughEstimate(f?num_outputs);

%?Calculate?the?number?of?inner-loop?repetitions?so?that?the?inner?for-loop
%?takes?at?least?about?1ms?to?execute.
desired_inner_loop_time?=?0.001;
num_inner_iterations?=?max(ceil(desired_inner_loop_time?/?t_rough)?1);

%?Run?the?outer?loop?enough?times?to?give?a?reasonable?set?of?inputs?to?median.
num_outer_iterations?=?11;

%?If?the?estimated?running?time?for?the?timing?loops?is?too?long
%?reduce?the?number?of?outer?loop?iterations.
estimated_running_time?=?num_outer_iterations?*?num_inner_iterations?*?t_rough;
long_time?=?15;
min_outer_iterations?=?3;
if?estimated_running_time?>?long_time
????num_outer_iterations?=?ceil(long_time?/?(num_inner_iterations?*?t_rough));
????num_outer_iterations?=?max(num_outer_iterations?min_outer_iterations);
end

times?=?zeros(num_outer_iterations?1);

for?k?=?1:num_outer_iterations
????%?Coding?note:?An?earlier?version?of?this?code?constructed?an?“outputs“?cell
????%?array?which?was?used?in?comma-separated?form?for?the?left-hand?side?of
????%?the?call?to?f().??It?turned?out?though?that?the?comma-separated?output
????%?argument

評論

共有 條評論