参考
Reshape
- 用法:DenseBase::reshaped(NRowsType,NColsType)
- 默认按照列优先进行元素重排;
- 通过RowMajor设置按照行优先;
- 通过AutoOrder设置按照存储顺序重排;
- PlainObjectBase::resize(Index,Index)也可以实现重排;
void demo_26()
{
MatrixXi m = Matrix4i::Random();
m = m - m / 10 * 10;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl;
m.resize(2,8);
cout << "Here is the matrix m after m.resize(2,8):" << endl