1、安装:sudo apt-get install libeigen3-dev
2 、调整,默认安装路径是:/usr/include/eigen3
cd /usr/include/eigen3
Series:/usr/include/eigen3$ ls
Eigen signature_of_eigen3_matrix_library unsupported
需要执行复制命令,将Eigen文件夹放在/usr/include 下面
sudo cp Eigen/ .. -R
3、demo运行
vi myeigen.c
编辑文件
#include <iostream> #include <Eigen/Dense> //using Eigen::MatrixXd; using namespace Eigen; using namespace Eigen::internal; using namespace Eigen::Architecture; using namespace std; int main() { cout<<"*******************1D-object****************"<<endl; Vector4d v1; v1<< 1,2,3,4; cout<<"v1=\n"<<v1<<endl; VectorXd v2(3); v2<<1,3; cout<<"v2=\n"<<v2<<endl; Array4i v3; v3<<1,4; cout<<"v3=\n"<<v3<<endl; ArrayXf v4(3); v4<<1,3; cout<<"v4=\n"<<v4<<endl; }
编译 g++ myeigen.c
运行 ./a.out
结果:
*******************1D-object**************** v1= 1 2 3 4 v2= 1 2 3 v3= 1 2 3 4 v4= 1 2 3原文链接:https://www.f2er.com/ubuntu/351633.html