PCL Lesson6:Eigen基础

#include "stdio.h"
#include 
#include 
#include         //LU分解求逆
int main(int argc,char*argv[])
{
    Eigen::Matrix3d R = Eigen::Matrix3d::Random();
    Eigen::Matrix3d RInv = Eigen::Matrix3d::Random();
    Eigen::Matrix3d X = Eigen::Matrix3d::Random();
    Eigen::Vector3d f1 = Eigen::Vector3d::Random();  //3*1,转置f1.transpose()
    //R << 1,2,3,4,5,6,7,8,9;
    X << 1,1,1,0,1,0,0,0,1;
    f1 << 1,2,3;
    RInv = R.inverse();

    std::cout << "R =" << std::endl << R << std::endl; 
    std::cout << "R.transpose =" << std::endl << R.transpose() << std::endl; 
    std::cout << "R.inv =" << std::endl << RInv << std::endl; 

    std::cout << "R*R.inv =" << std::endl << R*RInv << std::endl; 

    std::cout << "R*X =" << std::endl << R*X << std::endl;  //3*3,3*3
    std::cout << "R*f1 =" << std::endl << R*f1 << std::endl; //3*3,3*1
    std::cout << "f1.transpose()*R" <

结果:
lx@lx-B5400:~/kdevelopProjects/demo_eigen/build$ ./demo_eigen
R =
0.680375 0.59688 -0.329554
-0.211234 0.823295 0.536459
0.566198 -0.604897 -0.444451
R.transpose =
0.680375 -0.211234 0.566198
0.59688 0.823295 -0.604897
-0.329554 0.536459 -0.444451
R.inv =
-0.198521 2.22739 2.8357
1.00605 -0.555135 -1.41603
-1.62213 3.59308 3.28973
RR.inv =
1 -2.22045e-16 0
1.73472e-16 1 1.11022e-16
1.38778e-17 0 1
R
X =
0.680375 1.27726 0.350821
-0.211234 0.612061 0.325225
0.566198 -0.0386988 0.121748
R*f1 =
0.885472
3.04473
-1.97695
f1.transpose()*R
1.9565 0.428778 -0.589988
hello world !

你可能感兴趣的:(PCL学习系列)