matlab reshape Eigen 中的实现
发布时间
阅读量:
阅读量
https://eigen.tuxfamily.org/dox-devel/group__TutorialReshape.html
请注意,必须使用Eigen3.4版本
从3.4版本开始,Eigen提供了便捷的方法,可将矩阵重新调整为不同尺寸的矩阵或向量。所有相关情况均通过DenseBase::reshaped(NRowsType,NColsType)和DenseBase::reshaped()这两个函数进行处理。需要说明的是,这些函数并不会直接对矩阵进行重塑操作,而是返回一个对原始表达式的视图。
Reshaped 2D views 2维矩阵的重排
The more general reshaping transformation is handled via: reshaped(nrows,ncols). Here is an example reshaping a 4x4 matrix to a 2x8 one:
小标题
需注意的是,默认情况下采用的是列优先的方式,MATLAB中的reshape函数同样遵循列优先的原则。
Matrix4i m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
c
全部评论 (0)
还没有任何评论哟~
