1.在Eigen官网下载Eigen:
Windows选压缩包zip下载,点击一下即可。下载后解压。
2.配置VS2015
打开vs2013,可以新建一个项目,也可以打开以前的项目,右键项目名,选择属性,在c/c++附加目录里加入解压后eigen文件夹的路径。
3.测试eigen是否配置好
1 #include <iostream>
2
3 #include <Eigen\Dense>
4
5 using namespace std;
6
7 using namespace Eigen;
8
9 void main()
10
11 {
12
13 Matrix2d a;
14
15 a << 1, 2,
16
17 3, 4;
18
19 MatrixXd b(2, 2);
20
21 b << 2, 3,
22
23 1, 4;
24
25 cout << "a + b =\n" << a + b << endl;
26
27 cout << "a - b =\n" << a - b << endl;
28
29 cout << "Doing a += b;" << endl;
30
31 a += b;
32
33 cout << "Now a =\n" << a << endl;
34
35 cout << "a^T= " << a.transpose() << endl;
36
37 cout << "a*b= " << a*b << endl;
38
39 Vector3d v(1, 2, 3);
40
41 Vector3d w(1, 0, 0);
42
43 cout << "-v + w - v =\n" << -v + w - v << endl;
44
45 cout << v << endl;
46
47 cout << v.transpose() << endl;
48
49 system("pause");
50
51 }