- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是使用库的新手,我在使用 lapack++ 和让它工作时遇到了一些问题。我将解释到目前为止我所做的和尝试的事情。
首先,我安装了 BLAS 和 LAPACK,一切顺利。我现在已经安装了 LAPACK++ 版本 2.5.2 (http://lapackpp.sourceforge.net/),因此我可以在 C/C++ 中调用各种线性代数例程。在我配置、make 然后 make install 之后,它将所有 C/C++ 头文件放在/usr/local/include/lapackpp/中,其中一些是..
arch.h
bmd.h
gmf.h
lapackc.h
lautil.h
spdmd.h
ultgmd.h
bfd.h
...
还有/usr/local/lib 中的以下文件
liblapackpp.la
liblapackpp.so
liblapackpp.so.14
liblapackpp.so.14.2.0
现在如果我尝试使用 g++ 编译简单的代码
#include <lapackpp/lapackpp.h>
using namespace std;
int main(int argc, char** argv) {
return 0;
}
我得到以下输出...
In file included from /usr/local/include/lapackpp/lapackc.h:14,
from /usr/local/include/lapackpp/lapack.h:10,
from /usr/local/include/lapackpp/lapackpp.h:16,
from test.cpp:1:
/usr/local/include/lapackpp/lacomplex.h:45:23: error: laversion.h: No such file or directory
/usr/local/include/lapackpp/lacomplex.h:48:17: error: f2c.h: No such file or directory
In file included from /usr/local/include/lapackpp/lapackpp.h:47,
from test.cpp:1:
/usr/local/include/lapackpp/latmpl.h:36:22: error: lafnames.h: No such file or directory
我通过在导致问题的头文件中明确写入头文件的位置来解决这个问题。
例如。我换了 #包括和 #包括
执行此操作后,我的代码可以正常编译。
现在如果我尝试编译代码
#include <cstdlib>
#include <iostream>
#include <lapackpp/lapackpp.h>
using namespace std;
int main(int argc, char** argv) {
LaGenMatDouble A(5,5);
cout << "This is a test." << endl;
return 0;
}
通过输入
g++ test.cpp -o test -I usr/local/include/lapackpp
我得到以下错误
/tmp/ccAq6nkP.o: In function `main':
test.cpp:(.text+0x22): undefined reference to `LaGenMatDouble::LaGenMatDouble(int, int)'
test.cpp:(.text+0x4f): undefined reference to `LaGenMatDouble::~LaGenMatDouble()'
test.cpp:(.text+0x67): undefined reference to `LaGenMatDouble::~LaGenMatDouble()'
collect2: ld returned 1 exit status
(关于 LaGenMatDouble 的信息是 here )
这表明我可能链接到库有误?
经过一番谷歌搜索后,我意识到我需要使用 -I 链接到头文件,通过 -L 链接到共享库,通过 -llapackpp 链接到库本身,所以我输入了
g++ test.cpp -o test -I usr/local/include/lapackpp -L usr/local/lib -llapackpp
它编译了代码,现在当我通过输入 ./test 运行程序时我出错了
./test: error while loading shared libraries: liblapackpp.so.14: cannot open shared object file: No such file or directory
现在我很困惑。
我不确定这是否与问题有关,但是当我输入时
pkg-config lapackpp --libs
我明白了
在 pkg-config 搜索路径中找不到软件包 lapackpp。也许你应该添加包含 `lapackpp.pc' 的目录到 PKG_CONFIG_PATH 环境变量找不到包 'lapackpp'
lapack 和 blas 也是如此。
我不确定该怎么做。非常感谢任何帮助,谢谢!
最佳答案
链接正常,因为你告诉链接器库在哪里,但执行失败,因为加载器不知道你的库的位置(你可以检查执行 ldd yourapp
,它显示了您的应用程序所需的库)。
通常,您可以通过变量 LD_LIBRARY_PATH
告诉加载器库的位置来解决这个问题,但这是一个粗糙的工具。一种不同的解决方案是直接在可执行文件中对该指令进行编码,如所述here ,或者简单地使用开关 -static
关于c++ - 尝试安装和使用 LAPACK++,加载共享库时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10718800/
如果我有一个 1,000 x 1,000 的方阵,Lapack 可以计算这个矩阵的特征向量和特征值吗?如果可以,需要多长时间?对于 10,000 x 10,000 矩阵甚至 1,000,000 x 1
我正在使用 LAPACK 的 zheev(在英特尔 MKL 中)。我得到了 int INFO=99。我一直在互联网上搜索这对应的内容,但找不到包含所有整数错误代码及其含义列表的文档。 有没有人有指向
通过以下方式安装 lapack 后: yum install lapack lapack-devel 并重新启动 httpd 服务我仍然得到 Fatal error: Class 'Lapack' n
Lapack 很可能没有任何计算行列式的例程。但是,我们可以使用 LU、QR 或 SVD 分解来计算它。我更喜欢使用 LU 分解。现在 lapack 使用一些 dgetrf 子程序将矩阵 A 分解为带
根据官方用户指南,sgelsd用于解决最小二乘问题 min_x || b - Ax ||_2 并允许矩阵 A 为矩形且秩亏。并且根据sgelsd源码中的接口(interface)描述,b作为输入输出参
我用 Eigen 和 实现了一段代码。我希望 Eigen 使用 BLAS 和 LAPACK 。 我看过here ,这是可能的,但我不知道如何或将这些值/指令放在代码中的位置。 我必须在某处指定值 EI
简介:我用 C++ 开发了一个应用程序,它在 Windows 上使用 LAPACK(LAPACKE) 和 MPI。在 Windows 中工作正常(编译和链接通过 Code::Blocks IDE 处理
我最近从 Linux 切换到 Mac OS。我需要 BLAS 和 LAPACK 来做一些计算。通过查看 BLAS 的维基百科,我了解到这两个库已经在 Mac OS 中实现。不过,据说 Apple's
我基于以下链接为我的 Visual Studio 2008 构建了 LAPACKE 的 DLL 和库: http://icl.cs.utk.edu/lapack-for-windows/lapack/
我很好奇用于在 MATLAB 中计算 SVD 的 DGESVD 函数。据我从 Gene H. Golub 和 Charles F. Van Loan 的“矩阵计算”中可以看出,使用了两种可能的双对角化
我是数值线性代数的新手,我刚刚开始使用 LAPACK 和 BLAS。 是否有可以在打包存储和完整存储之间复制/转换对称矩阵的例程? 我找到了 dtrttp ,我可以用它来将 double 全对称矩阵转
根据我的理解,需要进行分解/因式分解(LU、QR、Cholesky 等),然后基于因式分解进行矩阵逆计算。还有其他方法可以解决这个问题吗(我试图弄清楚我是否可以坚持使用 CULAtools 试用版中免
我正在尝试编写一个函数,该函数可以为代表性不足的方程组生成单一解(例如,描述该系统的矩阵宽大于高)。为了做到这一点,我一直在 LAPACK 文档中寻找一种将矩阵行归约到它的归约梯队形式的方法,类似于
我是使用 LAPACK 例程的新手,所以我对它们不是很了解,我想在并行化循环(openmp)中使用它们。 我使用 Ubuntu 14.04LTS 并使用我的包管理器安装了 LAPACK。安装的版本是:
我在允许我求逆矩阵的 c 代码中使用 LAPACK。更准确地说,我使用 dgetrf_ 然后使用 dgetri_ 进行反演。 但是当我处理大矩阵并且我不知道矩阵是否可逆时,我浪费了很多时间来反转不可逆
我想使用Fortran和LAPACK对角化一个实对称矩阵。 LAPACK基本上提供了两个例程,一个例程在完整矩阵上运行,另一个例程在打包存储中的矩阵上运行。虽然后者肯定会使用较少的内存,但我想知道关于
我正在使用 LAPACK 库中的 DSYEV 和 DSYEVD 来查找特征值和特征向量(编译语法: gfortran -llapack )。但是,我发现特定矩阵的错误特征值(-0.44,0.35,0.
我想计算对称矩阵的特征值,并希望使用 C++ 中英特尔 MKL 库中的 LAPACKE_dsyev 函数来计算。但我对矩阵需要传递的形式有点困惑。 来自文档https://software.intel
我使用链接:./configure --with-blas-incdir="-L/home/moritz/build/CoinIpopt_test/ThirdParty/openblas/includ
我想安装最新版本的numpy(Python的数值库),版本(v1.6.1)还没有在Ubuntu Oneiric repositories .当我继续手动安装它时,我阅读了 INSTALL numpy
我是一名优秀的程序员,十分优秀!