How do I use the BLAS library provided by MATLAB?

帅比萌擦擦* 提交于 2020-02-04 05:31:05

问题


I have noticed that MATLAB provides the BLAS and LAPACK headers among others:

$ ls ${MATLAB_DIR}/extern/include/
blas.h            engine.h    lapack.h           mat.h            mclmcr.h      mex.h           mwutil.h
blascompat32.h    fintrf.h    libmatlbm.mlib     matrix.h         mclmcrrt.h    mwdebug.h       tmwtypes.h
emlrt.h           io64.h      libmatlbmx.mlib    mclcppclass.h    mcr.h         mwservices.h

I would like to use them for my compiled code, so I tried to compile the following:

ex_blas.c

#include <blas.h>

int main()
{
    return 0;
}

with the following command:

$ mex ex_blas.c

But this returns an error:

In file included from ex_blas.c:1:
/Applications/MATLAB_R2009b.app/extern/include/blas.h:51: error: syntax error before ‘*’ token
/Applications/MATLAB_R2009b.app/extern/include/blas.h:62: error: syntax error before ‘*’ token
/Applications/MATLAB_R2009b.app/extern/include/blas.h:77: error: syntax error before ‘*’ token
/Applications/MATLAB_R2009b.app/extern/include/blas.h:92: error: syntax error before ‘*’ token
/Applications/MATLAB_R2009b.app/extern/include/blas.h:103: error: syntax error before ‘ptrdiff_t’
/Applications/MATLAB_R2009b.app/extern/include/blas.h:122: error: syntax error before ‘ptrdiff_t’

Is the blas.h provided by MATLAB usable by a 3rd party application outside of MATLAB? If yes, what is causing the error above?


回答1:


I'm not sure if it will completely resolve your problems, but you may also have to include stddef.h since that is where the ptrdiff_t type is defined.



来源:https://stackoverflow.com/questions/1735985/how-do-i-use-the-blas-library-provided-by-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!