Eigen学习笔记2:C++矩阵运算库Eigen介绍

Eigen常规矩阵定义

1.使用

Eigen的使用在官网上有详细的介绍,这里对我学习过程中用到的基本操作进行介绍。首先是矩阵的定义。
在矩阵类的模板参数共有6个。一般情况下我们只需要关注前三个参数即可。前三个模板参数如下所示:

Matrix<typename Scalar,int RowsAtCompileTime,int ColsAtCompileTime>

 

  1. Scalar参数为矩阵元素的类型,该参数可以是int,float,double等。
  2. RowsAtCompileTime和ColsAtCompileTime是矩阵的行数和列数。

Matrix<float,4,4> M44是定义一个4×4的矩阵,矩阵元素以float类型存储。直接使用矩阵模板定义一个矩阵往往会觉得麻烦,Eigen提供了一些基本矩阵的别名定义,如typedef Matrix<float,4,4> Matrix4f.下面是一些内置的别名定义.来源于官方手册

typedef Matrix< std::complex<double> , 2 , 2 > Matrix2cd typedef Matrix< std::complex<float> , 2 , 2 > Matrix2cf typedef Matrix< double , 2 , 2 > Matrix2d typedef Matrix< float , 2 , 2 > Matrix2f typedef Matrix< int , 2 , 2 > Matrix2i typedef Matrix< std::complex<double> , 3 , 3 > Matrix3cd typedef Matrix< std::complex<float> , 3 , 3 > Matrix3cf typedef Matrix< double , 3 , 3 > Matrix3d typedef Matrix< float , 3 , 3 > Matrix3f typedef Matrix< int , 3 , 3 > Matrix3i typedef Matrix< std::complex<double> , 4 , 4 > Matrix4cd typedef Matrix< std::complex<float> , 4 , 4 > Matrix4cf typedef Matrix< double , 4 , 4 > Matrix4d typedef Matrix< float , 4 , 4 > Matrix4f typedef Matrix< int , 4 , 4 > Matrix4i typedef Matrix< std::complex<double> , Dynamic , Dynamic > MatrixXcd typedef Matrix< std::complex<float> , Dynamic , Dynamic > MatrixXcf typedef Matrix< double , Dynamic , Dynamic > MatrixXd typedef Matrix< float , Dynamic , Dynamic > MatrixXf typedef Matrix< int , Dynamic , Dynamic > MatrixXi typedef Matrix< std::complex<double> , 1, 2 > RowVector2cd typedef Matrix< std::complex<float> , 1, 2 > RowVector2cf typedef Matrix< double , 1, 2 > RowVector2d typedef Matrix< float , 1, 2 > RowVector2f typedef Matrix< int , 1, 2 > RowVector2i typedef Matrix< std::complex<double> , 1, 3 > RowVector3cd typedef Matrix< std::complex<float> , 1, 3 > RowVector3cf typedef Matrix< double , 1, 3 > RowVector3d typedef Matrix< float , 1, 3 > RowVector3f typedef Matrix< int , 1, 3 > RowVector3i typedef Matrix< std::complex<double> , 1, 4 > RowVector4cd typedef Matrix< std::complex<float> , 1, 4 > RowVector4cf typedef Matrix< double , 1, 4 > RowVector4d typedef Matrix< float , 1, 4 > RowVector4f typedef Matrix< int , 1, 4 > RowVector4i typedef Matrix< std::complex<double> , 1, Dynamic > RowVectorXcd typedef Matrix< std::complex<float> , 

转载于:https://www.cnblogs.com/aiguona/p/9413748.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值