#include <iostream>
#include <eigen3/Eigen/Dense>
using namespace std;
using namespace Eigen;
int main(){
Matrix2f ss;
ss<<2.3f,3.2f,
3.4f,3.1f;
cout<<ss<<endl;
cout<<"======="<<endl;
ArrayXd xx(9); ///Vector3f
xx << 2.3f,2.8f,4.1f,2.3f,2.8f,4.1f,2.3f,2.8f,4.1f;
cout<<xx.head(3)<<endl;
cout<<xx.tail(3)<<endl;
cout<<xx.segment(2,1)<<endl;
MatrixXd mat(4,4);
mat<<1,2,3,4,
5,4,3,2,
1,4,2,3,
3,4,2,1;
///start index x,y, count x,x
cout<<mat.block(1,1,2,2)<<endl;
cout<<mat.block<2,2>(1,1)<<endl;
}
标签:Eigen,ss,mat,namespace,xx,操作,cout From: https://www.cnblogs.com/gishuanhuan/p/17566668.html