- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在链接一个简单的 cblas 程序时遇到问题,这是我的最小示例:
extern "C"
{
#include <cblas.h>
}
#include <iostream>
int main() {
int lda = 3;
float A[] = { 0.11, 0.12, 0.13,
0.21, 0.22, 0.23 };
int ldb = 2;
float B[] = { 1011, 1012,
1021, 1022,
1031, 1032 };
int ldc = 2;
float C[] = { 0.00, 0.00,
0.00, 0.00 };
cblas_sgemm(CblasRowMajor,
CblasNoTrans,
CblasNoTrans,
2, 2, 3, 1.0, A, lda, B, ldb, 0.0, C, ldc);
std::cout << "[ " << C[0] << ", " << C[1] << "\n " << C[2]
<< ", " << C[3] << " ]\n";
}
现在我正在尝试用 g++ -lcblas test.cpp
编译程序,但这给了我
gdev-home@gdev-home:~/Documents$ g++ -lcblas test.cpp
/tmp/ccEwRr40.o: In function `main':
test.cpp:(.text+0x112): undefined reference to `cblas_sgemm'
collect2: error: ld returned 1 exit status
这意味着它没有正确链接。奇怪的是我确实有cblas库,我通过atlas安装了它们
gdev-home@gdev-home:~/Documents$ dpkg --get-selections | grep atlas
libatlas-base-dev install
libatlas-dev install
libatlas3-base install
如果你看看 /usr/lib
我有
gdev-home@gdev-home:/usr/lib$ ls | grep blas
libblas
libblas.a
libblas.so
libblas.so.3
libblas.so.3gf
libcblas.a
libcblas.so
libcblas.so.3
libcblas.so.3gf
libf77blas.a
libf77blas.so
libf77blas.so.3
libf77blas.so.3gf
有谁知道为什么这个程序链接失败?
最佳答案
我认为 -lcblas arg 应该在 test.cpp 之后。
关于c++ - undefined reference : Cblas not linking,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33419678/
我尝试使用 cblas.h(来自 openblas 库)来计算两个矩阵的乘积。更具体地,I具有维度为n*d的双数组A、维度为m*d的数组B和维度为n*m的数组C。我想计算乘积 A 'time' B 转
我需要使用cblas.h库启动一个程序。我下载 cblas.tgz 并反编译它,我运行命令: ln -s Makefile.LINUX Makefile.in 并尝试运行我的程序。 但是我有this错
我尝试使用英特尔 MKL 提供的 cblas 将两个矩阵(例如 A 和 B)的乘积转换为 C。有什么原因会导致错误吗? double * A, *B, *C; A = (double *) callo
这是我的第三篇文章,试图解决这个问题,首先使用 numpy.dot(A, A.T) 出现,其中 A 很大,有 150,000 x 265 个元素。 使用 numpy,我得到了一个包含许多缺失值的数组,
我使用了 cBLAS 并做了一些速度测试,我对结果感到惊讶: #include #include #include #include void matriz_matriz(float
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 8年前关闭。 Improve this qu
我在运行 gsl(gnu 科学库)的 cblas 部分时遇到问题。 下面的示例(来自 gsl 手册)完美地编译了链接,但是在运行时出现错误。这是在 Ubuntu 12.04 下。 gcc linsys
我使用以下代码来测试 Eigen 性能。 #include #include #define EIGEN_NO_DEBUG #include #include using namespace
我在链接一个简单的 cblas 程序时遇到问题,这是我的最小示例: extern "C" { #include } #include int main() { int lda
我正在用 C 语言做一些矩阵乘法,我正在尝试编译我的程序,但是编译失败,原因是: No such file or directory cblas.h 这是我用来编译的命令: gcc -o BLAS B
我正在使用 mkl cblas_dgemm,目前它与 CblasRowMajor、CblasNoTrans、CblasNotrans,用于我的矩阵。 我知道 c 是行主要语言,而 dgemm 是列主要
我试图反转的矩阵是: [ 1 0 1] A = [ 2 0 1] [-1 1 1] 真正的逆是: [-1 1 0] A^-1 = [-3 2 1]
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我正在用 C 语言编写一个需要矩阵和 vector 乘法的算法。我有一个矩阵 问 (W x W) 通过将 vector 的转置相乘 创建J (1 x W) 与自身并添加单位矩阵 我 , 使用标量 缩放
我一直在研究 iOS 4 中提供的 Accelerate 框架。具体来说,我尝试在我的 C 线性代数库中使用 Cblas 例程。现在我无法使用这些函数让我在非常基本的例程中获得任何性能提升。具体来说,
这是我的 earlier question 的扩展 , 但我是分开问的,因为我真的很沮丧,所以请不要投反对票! 问题:与密集矩阵的相同 cblas_sgemm 调用相比,对于具有大量零的矩阵,cbla
在我的 RHEL7 上,我正在尝试安装 py-earth并收到此链接错误: /usr/bin/ld: cannot find -lcblas 我安装了 blas、blas-devel、atlas 和
我正在尝试在 Accelerate 框架中使用 blas/cblas。 (如果重要,OS X 10.13)我找到了链接器选项“-framework Accelerate”,但找不到找到“cblas.h
我正在为我的项目尝试不同的 C 线性代数库,现在我想学习 BLAS (CBLAS)。我正在尝试按照教程here进行操作。我意识到 cblas 已经内置在 xcode 中并通过添加标志 gcc foo.
blas 的 C 接口(interface)(我使用的是 Intel MKL)在对单数据类型和双数据类型的输入数据进行操作时具有不同的函数。例如,cblas_dgemm 与 cblas_sgemm。
我是一名优秀的程序员,十分优秀!