如何使用MATLAB提供的BLAS库?
我注意到 MATLAB 提供了 BLAS 和 LAPACK 标头等:
$ 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
我想将它们用于我编译的代码,因此我尝试使用以下
编译以下内容: ex_blas.c
#include <blas.h>
int main()
{
return 0;
}
命令
$ mex ex_blas.c
:但是这个返回错误:
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’
MATLAB 提供的 blas.h
是否可由 MATLAB 外部的第 3 方应用程序使用?如果是的话,是什么原因导致上述错误呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定它是否能完全解决您的问题,但您可能还必须包含 < code>stddef.h 因为这是定义
ptrdiff_t
类型的地方。I'm not sure if it will completely resolve your problems, but you may also have to include
stddef.h
since that is where theptrdiff_t
type is defined.