Accelerate.framework 中的数据类型

发布于 2024-09-24 14:49:52 字数 536 浏览 0 评论 0原文

我正在开发一个使用 Accelerate 框架(针对 LAPACK)的程序,但有几个问题。代码是用 C 编写的,但需要包含 C++ 头文件。我将该文件重命名为 .cpp,但它导致了两个错误,如下所示。

C++ Error Image

所以我意识到尝试 #include 来包含标头,因为我们的 LAPACK 编码器所做的是在文件开头重新输入定义(dgemm_()、dposv_() 等),并依靠编译器/链接器来解决问题。所以我注释掉了这些,然后做了#include。结果是这样的:

Accelerate Error Image

那么,如何在 C++ 文件中使用 Accelerate 来使用 LAPACK 函数?我对 LAPACK 不太熟悉,所以我不确定该框架通常如何工作。

I'm working on a program that uses the Accelerate framework (for LAPACK) and I have several issues. The code is written in C but needs to include C++ headers. I renamed the file to .cpp but it caused two errors, shown below.

C++ Error Image

So I then realized tried to #include <Accelerate/Accelerate.h> to include the headers, since what our LAPACK coder did was retype the definitions (dgemm_(), dposv_(), etc.) at the beginning of the file and rely on the compiler/linker to work things out. So I commented out those and just did the #include. What came out was this:

Accelerate Error Image

So, how do I use the LAPACK functions using Accelerate in a C++ file? I'm not that familiar with LAPACK, so I'm not sure how that framework normally works.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日久见人心 2024-10-01 14:49:52

您应该使用类型 __CLPK_integerlong 而不是 int 来调用 dgemm_dposv_ >。该错误是因为 C++ 中的 long* 无法隐式转换为 int*

typedef long int    __CLPK_integer;
typedef long int    __CLPK_logical;
typedef float       __CLPK_real;
typedef double      __CLPK_doublereal;
typedef __CLPK_logical  (*__CLPK_L_fp)();
typedef long int    __CLPK_ftnlen;

You should use call dgemm_ and dposv_ using the type __CLPK_integer or long instead of int. The error is because a long* cannot be implicitly converted to an int* in C++.

typedef long int    __CLPK_integer;
typedef long int    __CLPK_logical;
typedef float       __CLPK_real;
typedef double      __CLPK_doublereal;
typedef __CLPK_logical  (*__CLPK_L_fp)();
typedef long int    __CLPK_ftnlen;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文