Matrix.middleRows(startRow,n)
返回的是矩阵的(startRow,startRow+n,:)部分。
例子:
#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
return 0;
}
输出:
A =
7 -6 0 9 -10
-2 -3 3 3 -5
6 6 -3 5 -8
6 -5 0 -8 6
9 1 9 2 -7
A(2..3,:) =
6 6 -3 5 -8
6 -5 0 -8 6
startCol
也是同理。
参考:https://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a4ef4483df4451e9cf5a629e70132aa22