mex

matlab mex clang C++11 thread -> Undefined symbols error

北战南征 提交于 2019-12-01 19:17:20
Goal: I want to use thread STL of C++11 in Matlab mex file (R2013a) using Xcode 4.6 I modified ~/.matlab/R2013a/mexopts.sh CC='clang++' # was llvm-gcc-4.2 CXX='clang++' # was llvm-g++-4.2 MACOSX_DEPLOYMENT_TARGET='10.8' # was 10.5. C++11 is supported >=10.7 CXXFLAGS="$CXXFLAGS -std=gnu++11 -stdlib=libc++" # additional flags Normal mex files without C++11 features are compiled well. Further, STL is well detected by the compiler except linking failure. >> mex mextest.cpp Undefined symbols for architecture x86_64: "std::__1::__thread_struct::__thread_struct()", referenced from: void* std::__1::_

Mex function not updated after recompile

强颜欢笑 提交于 2019-12-01 17:34:10
I have a simple mex function, which calls another C++ function from a library. I compile the source with mex -cxx mymexfunction.cpp -I/some/include -L/some/lib -lmylib The mylib library is dynamic (.so) and is linked itself against some other libraries (boost, OpenCV and some more). The problem I am having is that once I have called the function mymexfunction once, it will not get updated when I recompile the source code. I have tried clear clear all clear mex clear functions clear fun('mymexfunction') munlock('mymexfunction') unloadlibrary('mymexfunction') ...but nothing helps! I have to

running old mex file on new matlab releases

泪湿孤枕 提交于 2019-12-01 17:33:33
I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a) The program uses some mex files, and I get the following error when trying to run it: ??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx': normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version libmx.INTERNAL not defined in file libmx.so with link time reference. (the code I'm trying to tun is Normalized cut by Shi & Malic, and can be found here: http://www.cis.upenn.edu/~jshi/software/files/NcutClustering_7.zip ) If I try to run the code on the same system but Matlab 2007a it

matlab mex clang C++11 thread -> Undefined symbols error

本秂侑毒 提交于 2019-12-01 17:26:08
问题 Goal: I want to use thread STL of C++11 in Matlab mex file (R2013a) using Xcode 4.6 I modified ~/.matlab/R2013a/mexopts.sh CC='clang++' # was llvm-gcc-4.2 CXX='clang++' # was llvm-g++-4.2 MACOSX_DEPLOYMENT_TARGET='10.8' # was 10.5. C++11 is supported >=10.7 CXXFLAGS="$CXXFLAGS -std=gnu++11 -stdlib=libc++" # additional flags Normal mex files without C++11 features are compiled well. Further, STL is well detected by the compiler except linking failure. >> mex mextest.cpp Undefined symbols for

Makefile: Converting C-code to mex code (Linking error)

大憨熊 提交于 2019-12-01 16:25:32
I have a C-code which works fine using makefile. Now, I am trying to convert it to mex file so that I can run it from Matlab. Here also, I am using makefile approach . But, makefile for mex gives me error. Here is the tsnnls lib that I want to compile along with my mex file. Organization of C-project: tsnnls_test_DKU.c Include_4_TSNNLS.c Include_4_TSNNLS.h " Include_4_TSNNLS.* " files have function TestingLibraries() which call 3rd part libraries; while I tried to keep " tsnnls_test_DKU.c " very simple as: Original Code: tsnnls_test_DKU.c int TestingLibraries() ; int main( int argc, char* argv

Matlab: Does calling the same mex function repeatedly from a loop incur too much overhead?

这一生的挚爱 提交于 2019-12-01 16:23:50
I have some Matlab code which needs to be speeded up. Through profiling, I've identified a particular function as the culprit in slowing down the execution. This function is called hundreds of thousands of times within a loop. My first thought was to convert the function to mex (using Matlab Coder) to speed it up. However, common programming sense tells me the interface between Matlab and the mex code would lead to some overhead, which means calling this mex function thousands of times might not be a good idea. Is this correct? Or does Matlab do some magic when it's the same mex being called

Matlab: Does calling the same mex function repeatedly from a loop incur too much overhead?

◇◆丶佛笑我妖孽 提交于 2019-12-01 16:19:11
问题 I have some Matlab code which needs to be speeded up. Through profiling, I've identified a particular function as the culprit in slowing down the execution. This function is called hundreds of thousands of times within a loop. My first thought was to convert the function to mex (using Matlab Coder) to speed it up. However, common programming sense tells me the interface between Matlab and the mex code would lead to some overhead, which means calling this mex function thousands of times might

running old mex file on new matlab releases

隐身守侯 提交于 2019-12-01 16:15:18
问题 I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a) The program uses some mex files, and I get the following error when trying to run it: ??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx': normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version libmx.INTERNAL not defined in file libmx.so with link time reference. (the code I'm trying to tun is Normalized cut by Shi & Malic, and can be found here: http://www.cis.upenn.edu/~jshi

MATLAB's tic-toc & C's clock discrepancy

流过昼夜 提交于 2019-12-01 16:06:08
问题 I have written some C code which I call form MATLAB after I compile it using MEX. Inside the C code, I measure the time of a part of the computation using the following code: clock_t begin, end; double time_elapsed; begin = clock(); /* do stuff... */ end = clock(); time_elapsed = (double) ((double) (end - begin) / (double) CLOCKS_PER_SEC); Elapsed time should be the execution time in seconds. I then output the value time_elapsed to MATLAB (it is properly exported; I checked). Then MATLAB-side

Makefile: Converting C-code to mex code (Linking error)

夙愿已清 提交于 2019-12-01 15:13:59
问题 I have a C-code which works fine using makefile. Now, I am trying to convert it to mex file so that I can run it from Matlab. Here also, I am using makefile approach . But, makefile for mex gives me error. Here is the tsnnls lib that I want to compile along with my mex file. Organization of C-project: tsnnls_test_DKU.c Include_4_TSNNLS.c Include_4_TSNNLS.h " Include_4_TSNNLS.* " files have function TestingLibraries() which call 3rd part libraries; while I tried to keep " tsnnls_test_DKU.c "