Mex file generated using codegen behaves differently than original Matlab code ... why?

1 回表示 (過去 30 日間)
Alexandre
Alexandre 2013 年 11 月 12 日
Hi everyone,
I am currently trying to speed up some code of mine that is part of an event-driven integration scheme for hybrid systems. In that perspective, I use codegen to compile a function as an external mex library. However, it turns out that in specific situations (which I have not yet been able to circumscribe) the mex function does not return the same outputs as the original Matlab function.
Files required to reproduce this behavior can be downloaded from this archive (too much struggle with attachment limitations). Any help will be appreciated. Thank you.
Attachment descriptions:
  • main.m: this file compiles the mex library (assuming the setup is fine), loads test data into memory and outputs the responses to the input data of the original Matlab function and its supposedly equivalent mex library
  • testFct.m : this file computes real zeros of Hermite interpolants in the interval [0,1]; it is to be compiled as a mex function using codegen
  • build_testFct.m : function that compiles testFct.m as a mex file using codegen
  • bugData.mat : input data to reproduce the unexpected behavior
  • testFct_mex.mexa64 : mex file compiled on Ubuntu 12.04 LTS 64-bit with gcc compiler and Matlab R2012a
  • testFct_mex.mexw64 : mex file compiled on Windows 7 Professional 64-bit with MS Visual C++ 2008 compiler and Matlab R2012a
Alex

回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by