06.08.2013 Views

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mccstartup not found.<br />

exm3* not found.<br />

!copy h:\mywork\temp\exm3.m d:\mywork<br />

mcc -L Cpp exm3 %<br />

1 file(s) copied<br />

??? Error: The options specified will not generate any output files.<br />

Please use one of the following options to generate an executable output<br />

file:<br />

-x (generates a MEX-file executable using C)<br />

-m (generates a stand-alone executable using C)<br />

-p (generates a stand-alone executable using C++)<br />

-S (generates a Simulink MEX S-function using C)<br />

-B sgl (generates a stand-alone graphics library executable using C<br />

(requires the SGL))<br />

-B sglcpp (generates a stand-alone graphics library executable using<br />

C++ (requires the SGL))<br />

-B pcode (generates a MATLAB P-code file)<br />

Or type mcc -? for more usage information.<br />

Error in ==> D:\MATLAB6P5\toolbox\compiler\mcc.dll<br />

!copy h:\mywork\temp\mccstartup C:\WINDOWS\Applic~1\MathWorks\MATLAB<br />

\R13<br />

mcc -L Cpp exm3 %<br />

dir exm3* %<br />

!del mccstartup<br />

1 file(s) copied<br />

exm3.cpp exm3.hpp exm3.m<br />

11.5 编译文件的性能优化<br />

11.5.1 优化数组<br />

【例 11.5.1-1】优化标量。假设有以下文件,要求对之编译,比较得到 MEX 文件的性能。<br />

[foo.m]<br />

function y = foo(x)<br />

y = 2*pi*x;<br />

分别运行以下编译指令:<br />

mcc -O none -x foo<br />

tic;foo(1:10);toc<br />

elapsed_time =<br />

0.5500<br />

mcc -O none -O fold_scalar_mxarrays:on -x foo<br />

tic;foo(1:10);toc<br />

elapsed_time =<br />

0.1100<br />

【例 11.5.1-2】而对于非标量的情况,相应的可激活优化选项 fold_non_scalar_mxarrays。优<br />

化编译以下文件:<br />

[test.m]<br />

function y = test<br />

y = [ 1 0; 0 1] * [ pi pi/2; -pi -pi/2 ];<br />

7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!