打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Ubuntu安装eigen

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.

 

1.官网下载源码

 ​http://eigen.tuxfamily.org/index.php?title=Main_Page​

2.解压后,在源码目录创建一个新目录

1) mkdir build

2) cd build

3) cmake ..

4) make 

5) sudo make install

3.默认安装到//usr/local/include/eigen3

cd  /usr/local/include/eigen3

sudo cp * ../  -a

PS:由于eigen是一个模板类,并没有实际编译成动态库,此处只是将相应头文件拷贝到系统默认目录下/usr/lcoa/include/

 

3.test

#include <iostream>
#include <vector>
#include "Eigen/Dense"

using std::cout;
using std::endl;
using std::vector;
using Eigen::VectorXd;
using Eigen::MatrixXd;

// Kalman Filter variables
VectorXd x; // object state
MatrixXd P; // object covariance matrix
int main() {
/**
* Code used as example to work with Eigen matrices
*/
// design the KF with 1D motion
x = VectorXd(2);
x << 0, 0;
std::cout<<"Matrix x:\n"<<x<<std::endl;

P = MatrixXd(2, 2);
P << 1000, 0, 0, 1000;
std::cout<<"Matrix P:\n"<<P<<std::endl;
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.

g++ km.cpp

./a.out

  • 收藏
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
eigen测试程序
Eigen常用函数以及注意事项总结
求解非线性最小二乘法 Eigen
Kalman滤波器的C++实现
Eigen 3.2稀疏矩阵入门
法向量、旋转矩阵计算(五十一)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服